# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	v2.5.62 -> 1.1038 
#	arch/i386/kernel/process.c	1.45    -> 1.46   
#	drivers/acpi/namespace/nsxfobj.c	1.17    -> 1.19   
#	  arch/sparc/Kconfig	1.8     -> 1.9    
#	include/acpi/acglobal.h	1.19    -> 1.20   
#	    fs/binfmt_flat.c	1.2     -> 1.4    
#	   fs/nfsd/nfs3xdr.c	1.29    -> 1.32   
#	drivers/i2c/i2c-frodo.c	1.5     -> 1.6    
#	arch/alpha/kernel/entry.S	1.26    -> 1.27   
#	drivers/hotplug/ibmphp_pci.c	1.5     -> 1.6    
#	drivers/char/ipmi/ipmi_kcs_intf.c	1.1     -> 1.3    
#	  drivers/net/znet.c	1.9     -> 1.10   
#	include/asm-i386/desc.h	1.12    -> 1.13   
#	net/rose/sysctl_net_rose.c	1.2     -> 1.3    
#	arch/ia64/sn/io/xbow.c	1.5     -> 1.6    
#	include/asm-i386/delay.h	1.1     -> 1.2    
#	include/acpi/acpixf.h	1.17    -> 1.19   
#	drivers/acpi/resources/rsio.c	1.12    -> 1.13   
#	drivers/scsi/megaraid.c	1.34    -> 1.35   
#	arch/sparc64/kernel/smp.c	1.47    -> 1.48   
#	drivers/pcmcia/cs_internal.h	1.3     -> 1.5    
#	      fs/cifs/file.c	1.6     -> 1.7    
#	arch/i386/kernel/cpu/cpufreq/speedstep.c	1.11    -> 1.12   
#	include/asm-x86_64/smp.h	1.5     -> 1.6    
#	include/asm-i386/mmu_context.h	1.14    -> 1.15   
#	drivers/i2c/chips/lm75.c	1.4     -> 1.5    
#	drivers/ide/pci/via82cxxx.c	1.8     -> 1.9    
#	drivers/net/aironet4500_core.c	1.11    ->         (deleted)      
#	drivers/ide/legacy/macide.c	1.3     -> 1.4    
#	drivers/net/tc35815.c	1.8     -> 1.9    
#	drivers/scsi/sym53c8xx_2/sym_hipd.c	1.4     -> 1.5    
#	drivers/acpi/namespace/nsdumpdv.c	1.7     -> 1.8    
#	  drivers/char/esp.c	1.13    -> 1.14   
#	  drivers/scsi/ips.c	1.47    -> 1.48   
#	drivers/pnp/Makefile	1.11    -> 1.12   
#	drivers/net/pcmcia/Makefile	1.13    -> 1.14   
#	 drivers/pnp/names.c	1.3     -> 1.5    
#	drivers/acpi/executer/exoparg3.c	1.9     -> 1.10   
#	net/bluetooth/rfcomm/core.c	1.7.1.2 -> 1.13   
#	drivers/scsi/scsi_error.c	1.34    -> 1.38   
#	include/asm-i386/system.h	1.23    -> 1.24   
#	drivers/acpi/hardware/hwacpi.c	1.14    -> 1.15   
#	include/acpi/acutils.h	1.23    -> 1.24   
#	drivers/ieee1394/raw1394.c	1.17    -> 1.18   
#	arch/ppc64/boot/zImage.lds	1.2     -> 1.3    
#	include/asm-ppc64/unistd.h	1.17    -> 1.19   
#	      kernel/ksyms.c	1.183   -> 1.184  
#	drivers/usb/class/Makefile.lib	1.3     -> 1.5     drivers/usb/Makefile.lib (moved)
#	include/acpi/acpiosxf.h	1.21    -> 1.24   
#	arch/ppc64/kernel/entry.S	1.20    -> 1.22   
#	include/asm-x86_64/signal.h	1.6     -> 1.7    
#	Documentation/sonypi.txt	1.10    -> 1.11   
#	include/linux/cdrom.h	1.11    -> 1.12   
#	drivers/i2c/chips/adm1021.c	1.4     -> 1.5    
#	drivers/acpi/hardware/hwgpe.c	1.14    -> 1.16   
#	drivers/acpi/dispatcher/dsobject.c	1.22    -> 1.23   
#	arch/parisc/kernel/ioctl32.c	1.3     -> 1.4    
#	drivers/scsi/pci2220i.c	1.15    -> 1.18   
#	    fs/nfsd/nfsxdr.c	1.22    -> 1.23   
#	arch/mips/philips/nino/int-handler.S	1.1     -> 1.2    
#	 fs/cifs/cifsproto.h	1.6     -> 1.7    
#	drivers/video/Kconfig	1.13    -> 1.14   
#	drivers/scsi/eata_dma.c	1.9     ->         (deleted)      
#	include/linux/swap.h	1.70    -> 1.71   
#	drivers/serial/8250_pnp.c	1.7     -> 1.10   
#	drivers/net/irda/vlsi_ir.c	1.14    -> 1.15   
#	drivers/char/isicom.c	1.12    -> 1.13   
#	drivers/bluetooth/hci_uart.h	1.5     -> 1.6    
#	drivers/pnp/pnpbios/core.c	1.23    -> 1.25   
#	drivers/message/fusion/mptctl.c	1.11    -> 1.13   
#	fs/xfs/pagebuf/page_buf.c	1.38    -> 1.40   
#	arch/alpha/mm/numa.c	1.10    -> 1.11   
#	include/net/dn_route.h	1.3     -> 1.4    
#	include/asm-i386/processor.h	1.39    -> 1.40   
#	drivers/acpi/executer/exconvrt.c	1.19    -> 1.20   
#	arch/x86_64/kernel/setup.c	1.9     -> 1.10   
#	drivers/parisc/dino.c	1.4     -> 1.5    
#	  net/ipv6/exthdrs.c	1.5     -> 1.6    
#	include/linux/init.h	1.23    -> 1.24   
#	arch/i386/kernel/cpu/common.c	1.17    -> 1.18   
#	     fs/file_table.c	1.16    -> 1.17   
#	drivers/scsi/aha152x.c	1.21    -> 1.22   
#	include/linux/raid/md_k.h	1.49    -> 1.51   
#	arch/ia64/sn/io/sn2/pcibr/pcibr_error.c	1.2     -> 1.3    
#	 net/ipv4/ipconfig.c	1.21    -> 1.22   
#	include/video/sgivw.h	1.3     -> 1.4    
#	drivers/acpi/parser/psscope.c	1.10    -> 1.11   
#	drivers/acpi/executer/exfield.c	1.17    -> 1.18   
#	drivers/scsi/hosts.c	1.51    -> 1.53   
#	        lib/Makefile	1.18    -> 1.20   
#	drivers/net/natsemi.c	1.46    -> 1.47   
#	           fs/open.c	1.35    -> 1.36   
#	drivers/char/ip2/i2ellis.h	1.4     -> 1.5    
#	include/linux/i2c-id.h	1.8     -> 1.9    
#	arch/i386/mach-visws/visws_apic.c	1.5     -> 1.6    
#	drivers/acpi/toshiba_acpi.c	1.7     -> 1.8    
#	drivers/scsi/cpqfcTSinit.c	1.30    -> 1.31   
#	drivers/ide/pci/serverworks.c	1.11    -> 1.14   
#	drivers/scsi/53c700.h	1.8     -> 1.10   
#	net/ipv6/ip6_output.c	1.9     -> 1.10   
#	drivers/ide/pci/piix.c	1.10    -> 1.12   
#	 net/ipv4/ip_input.c	1.12    -> 1.13   
#	arch/sparc64/lib/Makefile	1.7     -> 1.8    
#	drivers/scsi/psi_chip.h	1.1     -> 1.2    
#	include/linux/raid/md.h	1.22    -> 1.23   
#	drivers/scsi/aic7xxx/aic7xxx_osm.c	1.17    -> 1.19   
#	drivers/scsi/scsi_proc.c	1.16    -> 1.17   
#	include/asm-ppc64/processor.h	1.23    -> 1.26   
#	include/acpi/acexcep.h	1.13    -> 1.14   
#	arch/ppc/8260_io/uart.c	1.10    -> 1.11   
#	include/asm-sparc64/psrcompat.h	1.2     -> 1.3    
#	drivers/acpi/utilities/uteval.c	1.16    -> 1.17   
#	drivers/acpi/resources/rsutils.c	1.13    -> 1.14   
#	drivers/acpi/dispatcher/dswload.c	1.21    -> 1.22   
#	arch/alpha/kernel/alpha_ksyms.c	1.31    -> 1.32   
#	drivers/parisc/power.c	1.3     -> 1.4    
#	drivers/acpi/utilities/utmisc.c	1.21    -> 1.22   
#	drivers/ide/pci/cs5520.c	1.3     -> 1.4    
#	include/asm-ppc64/iSeries/ItLpNaca.h	1.1     -> 1.2    
#	drivers/acpi/hardware/hwsleep.c	1.15    -> 1.16   
#	drivers/acpi/events/evrgnini.c	1.14    -> 1.15   
#	drivers/input/serio/i8042.c	1.23    -> 1.24   
#	arch/sparc/kernel/sparc_ksyms.c	1.13    -> 1.14   
#	arch/m68knommu/platform/68328/entry.S	1.2     -> 1.3    
#	arch/alpha/kernel/sys_sable.c	1.6     -> 1.7    
#	drivers/acpi/pci_link.c	1.12    -> 1.14   
#	drivers/acpi/executer/exdump.c	1.18    -> 1.19   
#	include/asm-i386/ide.h	1.10    -> 1.11   
#	arch/m68k/ifpsp060/src/pfpsp.S	1.4     -> 1.5    
#	include/linux/init_task.h	1.21    -> 1.23   
#	sound/drivers/serial-u16550.c	1.12    -> 1.13   
#	include/acpi/acstruct.h	1.13    -> 1.14   
#	arch/i386/kernel/head.S	1.22    -> 1.25   
#	include/asm-i386/mach-visws/irq_vectors.h	1.3     -> 1.4    
#	include/linux/sched.h	1.133   -> 1.135  
#	       kernel/fork.c	1.105   -> 1.108  
#	net/sunrpc/svcsock.c	1.39    -> 1.40   
#	drivers/ide/ppc/pmac.c	1.6     -> 1.7    
#	drivers/net/aironet4500_proc.c	1.13    ->         (deleted)      
#	drivers/acpi/namespace/nsparse.c	1.6     -> 1.7    
#	fs/xfs/support/debug.c	1.8     -> 1.9    
#	arch/alpha/lib/ev6-memcpy.S	1.1     -> 1.2    
#	scripts/checkhelp.pl	1.1     ->         (deleted)      
#	drivers/acpi/events/evregion.c	1.15    -> 1.16   
#	drivers/acpi/dispatcher/dsfield.c	1.16    -> 1.17   
#	drivers/net/wireless/airo.c	1.31    -> 1.32   
#	drivers/acpi/utilities/utglobal.c	1.22    -> 1.24   
#	drivers/acpi/executer/exstoren.c	1.16    -> 1.17   
#	include/acpi/acnamesp.h	1.17    -> 1.18   
#	drivers/i2c/i2c-philips-par.c	1.9     -> 1.10   
#	include/asm-i386/cobalt.h	1.2     -> 1.3     include/asm-i386/mach-visws/cobalt.h (moved)
#	   fs/befs/ChangeLog	1.3     -> 1.4    
#	drivers/acpi/hardware/hwtimer.c	1.13    -> 1.14   
#	include/acpi/acobject.h	1.16    -> 1.17   
#	include/acpi/acresrc.h	1.11    -> 1.12   
#	drivers/acpi/utilities/utalloc.c	1.14    -> 1.15   
#	include/asm-alpha/machvec.h	1.9     -> 1.10   
#	drivers/serial/amba.c	1.14    -> 1.16   
#	drivers/acpi/utilities/utxface.c	1.15    -> 1.16   
#	drivers/net/lasi_82596.c	1.17    -> 1.18   
#	Documentation/vm/hugetlbpage.txt	1.2     -> 1.3    
#	drivers/isdn/hardware/eicon/divasmain.c	1.6     -> 1.7    
#	sound/pci/rme9652/hammerfall_mem.c	1.11    -> 1.12   
#	  net/ipv4/af_inet.c	1.37    -> 1.38   
#	Documentation/pnp.txt	1.1     -> 1.2    
#	drivers/ide/legacy/q40ide.c	1.3     -> 1.4    
#	drivers/acpi/executer/exregion.c	1.14    -> 1.15   
#	 arch/ppc64/Makefile	1.22    -> 1.23   
#	drivers/serial/sa1100.c	1.15    -> 1.16   
#	arch/um/include/sysdep-i386/checksum.h	1.1     -> 1.2    
#	arch/arm/mm/alignment.c	1.6     -> 1.7    
#	arch/x86_64/kernel/apic.c	1.10    -> 1.11   
#	include/acpi/actbl1.h	1.10    -> 1.11   
#	drivers/pnp/interface.c	1.8     -> 1.12   
#	drivers/net/sk98lin/skge.c	1.12    -> 1.13   
#	arch/i386/mach-visws/setup.c	1.5     -> 1.6    
#	arch/ia64/sn/io/xtalk.c	1.5     -> 1.6    
#	   arch/i386/Kconfig	1.40    -> 1.42   
#	drivers/acpi/parser/psopcode.c	1.18    -> 1.20   
#	drivers/sbus/char/aurora.c	1.18    -> 1.19   
#	drivers/block/floppy.c	1.67    -> 1.68   
#	include/linux/genhd.h	1.45    -> 1.46   
#	include/linux/nfsd/xdr4.h	1.8     -> 1.9    
#	include/linux/flat.h	1.2     -> 1.3    
#	drivers/scsi/53c700.c	1.24    -> 1.26   
#	drivers/acpi/events/evxfregn.c	1.13    -> 1.14   
#	include/acpi/acdebug.h	1.17    -> 1.18   
#	arch/x86_64/kernel/x8664_ksyms.c	1.11    -> 1.13   
#	drivers/acpi/parser/psparse.c	1.20    -> 1.21   
#	include/asm-i386/signal.h	1.6     -> 1.7    
#	drivers/message/fusion/mptbase.h	1.8     -> 1.10   
#	  drivers/pnp/base.h	1.3     -> 1.4    
#	arch/v850/kernel/process.c	1.3     -> 1.4    
#	arch/i386/kernel/traps.c	1.44    -> 1.46   
#	arch/sparc64/kernel/sys32.S	1.3     -> 1.4    
#	drivers/ide/pci/cy82c693.c	1.10    -> 1.12   
#	arch/i386/kernel/Makefile	1.34    -> 1.36   
#	 include/linux/i2c.h	1.11    -> 1.12   
#	include/asm-ppc64/hardirq.h	1.10    -> 1.11   
#	include/linux/signal.h	1.9     -> 1.10   
#	         kernel/pm.c	1.7     -> 1.8    
#	arch/s390/kernel/entry.S	1.23    -> 1.24   
#	include/net/bluetooth/l2cap.h	1.4     -> 1.5    
#	   scripts/modpost.c	1.7     -> 1.8    
#	net/bluetooth/af_bluetooth.c	1.12    -> 1.13   
#	drivers/ide/legacy/umc8672.c	1.4     -> 1.5    
#	arch/v850/kernel/init_task.c	1.1     -> 1.2    
#	drivers/ide/legacy/qd65xx.c	1.3     -> 1.4    
#	Documentation/s390/Debugging390.txt	1.7     -> 1.8    
#	drivers/ieee1394/hosts.h	1.11    -> 1.12   
#	include/asm-ppc/unistd.h	1.22    -> 1.23   
#	drivers/acpi/executer/exprep.c	1.16    -> 1.17   
#	arch/sparc64/kernel/Makefile	1.19    -> 1.21   
#	  drivers/pnp/core.c	1.6     -> 1.7    
#	include/asm-x86_64/mtrr.h	1.4     -> 1.5    
#	drivers/ide/legacy/ali14xx.c	1.3     -> 1.4    
#	drivers/acpi/executer/exutils.c	1.18    -> 1.19   
#	drivers/scsi/scsi_sysfs.c	1.6     -> 1.7    
#	arch/i386/vmlinux.lds.S	1.24    -> 1.25   
#	include/linux/ioport.h	1.6     -> 1.7    
#	include/asm-ia64/sn/pci/bridge.h	1.4     -> 1.5    
#	  fs/cifs/cifsglob.h	1.4     -> 1.5    
#	drivers/pcmcia/pci_socket.h	1.3     -> 1.4    
#	drivers/serial/sunsu.c	1.29    -> 1.30   
#	Documentation/rpc-cache.txt	1.5     -> 1.6    
#	  drivers/md/raid5.c	1.57    -> 1.59   
#	drivers/net/pcmcia/rayctl.h	1.1     -> 1.2     drivers/net/wireless/rayctl.h (moved)
#	     kernel/Makefile	1.26    -> 1.27   
#	arch/i386/kernel/cpu/cyrix.c	1.7     -> 1.8    
#	Documentation/i2c/writing-clients	1.3     -> 1.4    
#	drivers/char/synclinkmp.c	1.6     -> 1.7    
#	drivers/serial/anakin.c	1.11    -> 1.12   
#	arch/ppc64/kernel/ppc_ksyms.c	1.21    -> 1.22   
#	drivers/char/cyclades.c	1.13    -> 1.14   
#	net/netrom/sysctl_net_netrom.c	1.2     -> 1.3    
#	   fs/cifs/cifssmb.c	1.7     -> 1.8    
#	arch/m68k/ifpsp060/src/isp.S	1.3     -> 1.4    
#	include/acpi/platform/acenv.h	1.15    -> 1.17   
#	include/linux/blkdev.h	1.97    -> 1.98   
#	drivers/video/pm3fb.c	1.4     -> 1.5    
#	arch/i386/pci/direct.c	1.12    -> 1.14   
#	drivers/isdn/hardware/eicon/capimain.c	1.2     -> 1.3    
#	drivers/block/cciss_scsi.c	1.8.1.3 -> 1.10   
#	drivers/acpi/tables/tbinstal.c	1.17    -> 1.18   
#	drivers/acpi/namespace/nsxfname.c	1.14    -> 1.15   
#	drivers/acpi/executer/exresnte.c	1.19    -> 1.20   
#	drivers/message/fusion/mptbase.c	1.8     -> 1.9    
#	drivers/ide/pci/trm290.c	1.9     -> 1.11   
#	arch/alpha/kernel/irq_alpha.c	1.10    -> 1.11   
#	arch/i386/kernel/cpu/mtrr/if.c	1.4     -> 1.5    
#	drivers/scsi/3w-xxxx.h	1.17    -> 1.18   
#	arch/x86_64/kernel/ioport.c	1.4     -> 1.5    
#	drivers/usb/core/message.c	1.20    -> 1.21   
#	drivers/net/wireless/Kconfig	1.3     -> 1.4    
#	 net/bluetooth/sco.c	1.8     -> 1.11   
#	arch/s390x/kernel/entry.S	1.25    -> 1.26   
#	    net/key/af_key.c	1.20    -> 1.21   
#	arch/x86_64/kernel/smp.c	1.11    -> 1.12   
#	drivers/net/tulip/interrupt.c	1.14    -> 1.15   
#	 drivers/scsi/scsi.h	1.60    -> 1.64   
#	fs/jfs/jfs_metapage.c	1.22    -> 1.23   
#	include/linux/i2c-dev.h	1.6     -> 1.7    
#	     fs/jffs2/wbuf.c	1.5     -> 1.6    
#	drivers/isdn/hardware/eicon/io.c	1.1     -> 1.2    
#	arch/i386/mach-visws/mpparse.c	1.3     -> 1.4    
#	net/bluetooth/hci_core.c	1.12.1.1 -> 1.17   
#	 drivers/pcmcia/cs.c	1.13    -> 1.16   
#	  include/linux/fs.h	1.219   -> 1.220  
#	drivers/usb/misc/atmsar.c	1.5.1.1 -> 1.10   
#	include/asm-i386/segment.h	1.5     -> 1.6    
#	Documentation/networking/bonding.txt	1.6     -> 1.7    
#	arch/i386/kernel/entry.S	1.54    -> 1.57   
#	drivers/pcmcia/cardbus.c	1.16    -> 1.22   
#	include/linux/delay.h	1.1     -> 1.2    
#	drivers/acpi/resources/rsmisc.c	1.10    -> 1.11   
#	drivers/oprofile/buffer_sync.c	1.7     -> 1.8    
#	arch/ppc64/defconfig	1.25    -> 1.27   
#	drivers/video/q40fb.c	1.20    -> 1.21   
#	net/bluetooth/hci_proc.c	1.1     -> 1.2    
#	include/asm-alpha/core_marvel.h	1.3     -> 1.4    
#	include/linux/meye.h	1.2     -> 1.3    
#	include/acpi/actables.h	1.14    -> 1.15   
#	drivers/net/Makefile	1.54    -> 1.56   
#	drivers/acpi/events/evxfevnt.c	1.13    -> 1.14   
#	arch/x86_64/kernel/setup64.c	1.9     -> 1.10   
#	net/ipv4/ip_fragment.c	1.7     -> 1.8    
#	arch/sparc64/kernel/profile.c	1.1     ->         (deleted)      
#	 fs/cifs/transport.c	1.4     -> 1.5    
#	     drivers/md/md.c	1.135   -> 1.139  
#	drivers/serial/clps711x.c	1.11    -> 1.12   
#	   drivers/ide/ide.c	1.48    -> 1.51   
#	drivers/scsi/advansys.c	1.26    -> 1.27   
#	drivers/ide/pci/cy82c693.h	1.5     -> 1.6    
#	include/asm-generic/siginfo.h	1.4     -> 1.5    
#	drivers/ide/legacy/dtc2278.c	1.3     -> 1.4    
#	       kernel/kmod.c	1.23    -> 1.24   
#	drivers/acpi/parser/pstree.c	1.12    -> 1.13   
#	Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl	1.3     -> 1.4    
#	include/net/sctp/ulpqueue.h	1.5     -> 1.6    
#	     net/ipv6/icmp.c	1.14    -> 1.15   
#	drivers/scsi/cpqioctl.c	1.1     ->         (deleted)      
#	drivers/acpi/parser/psargs.c	1.15    -> 1.16   
#	arch/m68knommu/kernel/init_task.c	1.1     -> 1.2    
#	drivers/acpi/executer/exnames.c	1.12    -> 1.13   
#	drivers/scsi/u14-34f.c	1.23    -> 1.24   
#	arch/x86_64/kernel/ptrace.c	1.9     -> 1.10   
#	arch/mips/au1000/common/serial.c	1.6     -> 1.7    
#	include/asm-i386/mach-visws/do_timer.h	1.5     -> 1.6    
#	drivers/scsi/pcmcia/nsp_message.c	1.5     -> 1.6    
#	arch/i386/kernel/mpparse.c	1.32.1.2 -> 1.35   
#	arch/parisc/kernel/Makefile	1.9     -> 1.10   
#	drivers/pcmcia/cistpl.c	1.7     -> 1.8    
#	net/ipv6/reassembly.c	1.8     -> 1.9    
#	drivers/acpi/executer/exfldio.c	1.20    -> 1.21   
#	arch/x86_64/kernel/mpparse.c	1.6     -> 1.7    
#	drivers/scsi/hosts.h	1.52    -> 1.56   
#	drivers/usb/media/ov511.c	1.39    -> 1.40   
#	arch/v850/kernel/rte_cb_multi.c	1.1     -> 1.3    
#	drivers/scsi/eata_dma_proc.h	1.1     ->         (deleted)      
#	include/asm-sparc/posix_types.h	1.1     -> 1.2    
#	drivers/message/fusion/linux_compat.h	1.7     -> 1.8    
#	arch/i386/kernel/io_apic.c	1.45    -> 1.48   
#	drivers/ide/ide-tape.c	1.16    -> 1.17   
#	drivers/ide/pci/sl82c105.c	1.9     -> 1.11   
#	drivers/acorn/block/fd1772.c	1.30    -> 1.31   
#	        mm/filemap.c	1.179   -> 1.180  
#	drivers/scsi/pluto.c	1.9     -> 1.10   
#	drivers/net/aironet4500_rid.c	1.2     ->         (deleted)      
#	drivers/acpi/resources/rscreate.c	1.16    -> 1.17   
#	drivers/ide/ide-iops.c	1.4     -> 1.7    
#	drivers/char/pcmcia/synclink_cs.c	1.7     -> 1.8    
#	drivers/ide/pci/cs5530.c	1.9     -> 1.11   
#	drivers/ide/pci/adma100.c	1.3     -> 1.4    
#	  fs/xfs/xfs_mount.c	1.16    -> 1.17   
#	drivers/ieee1394/pcilynx.c	1.24    -> 1.25   
#	  arch/i386/Makefile	1.44    -> 1.47   
#	arch/x86_64/kernel/entry.S	1.9     -> 1.10   
#	include/asm-parisc/irq.h	1.3     -> 1.4    
#	drivers/ide/pci/rz1000.c	1.7     -> 1.9    
#	drivers/char/synclink.c	1.24    -> 1.25   
#	include/acpi/acoutput.h	1.14    -> 1.15   
#	drivers/char/ftape/zftape/zftape-ctl.c	1.6     -> 1.7    
#	drivers/ide/pci/alim15x3.c	1.8     -> 1.10   
#	drivers/acpi/namespace/nsinit.c	1.19    -> 1.20   
#	drivers/ide/pci/siimage.c	1.8     -> 1.10   
#	arch/cris/drivers/eeprom.c	1.8     -> 1.9    
#	sound/pci/ac97/ac97_codec.c	1.27    -> 1.29   
#	 sound/oss/rme96xx.c	1.10    -> 1.11   
#	drivers/acpi/dispatcher/dsmthdat.c	1.18    -> 1.19   
#	drivers/net/e1000/e1000_main.c	1.46    -> 1.47   
#	drivers/isdn/hardware/eicon/divasi.c	1.4     -> 1.5    
#	  fs/nfsd/nfs3proc.c	1.20    -> 1.21   
#	include/asm-x86_64/pda.h	1.7     -> 1.8    
#	include/asm-sparc64/ide.h	1.14    -> 1.15   
#	include/linux/sonypi.h	1.8     -> 1.9    
#	include/asm-m68knommu/machdep.h	1.1     -> 1.2    
#	arch/x86_64/lib/delay.c	1.1     -> 1.2    
#	           fs/exec.c	1.70    -> 1.71   
#	arch/i386/mach-voyager/voyager_smp.c	1.6     -> 1.7    
#	drivers/scsi/nsp32.c	1.6     -> 1.7    
#	 include/linux/ide.h	1.33    -> 1.39   
#	drivers/ide/pci/hpt34x.c	1.9     -> 1.11   
#	drivers/char/ftape/zftape/zftape-vtbl.h	1.2     -> 1.3    
#	arch/ppc64/xmon/ansidecl.h	1.1     -> 1.2    
#	drivers/scsi/aacraid/linit.c	1.8     -> 1.10   
#	drivers/usb/storage/transport.c	1.62    -> 1.63   
#	drivers/ide/pci/opti621.c	1.8     -> 1.10   
#	drivers/ide/legacy/buddha.c	1.3     -> 1.4    
#	net/ipv4/netfilter/ip_fw_compat.c	1.10    -> 1.11   
#	drivers/acpi/namespace/nsobject.c	1.16    -> 1.17   
#	drivers/acpi/executer/exresolv.c	1.18    -> 1.19   
#	drivers/net/pcmcia/ray_cs.c	1.14    -> 1.15    drivers/net/wireless/ray_cs.c (moved)
#	arch/i386/kernel/trampoline.S	1.6     -> 1.7    
#	drivers/ieee1394/hosts.c	1.13    -> 1.14   
#	arch/parisc/kernel/irq.c	1.10    -> 1.11   
#	include/asm-alpha/delay.h	1.3     -> 1.4    
#	     kernel/signal.c	1.73    -> 1.75   
#	drivers/video/fm2fb.c	1.22    -> 1.23   
#	drivers/bluetooth/dtl1_cs.c	1.5     -> 1.7    
#	 include/linux/sys.h	1.2     -> 1.3    
#	drivers/acpi/tables/tbconvrt.c	1.18    -> 1.19   
#	drivers/bluetooth/Kconfig	1.1.2.1 -> 1.6    
#	arch/parisc/kernel/time.c	1.5     -> 1.6    
#	arch/parisc/kernel/profile.c	1.1     ->         (deleted)      
#	drivers/message/fusion/mptscsih.c	1.18    -> 1.20   
#	include/asm-m68knommu/m68360_enet.h	1.1     -> 1.2    
#	   drivers/char/sx.c	1.19    -> 1.20   
#	       net/netsyms.c	1.48    -> 1.49   
#	drivers/acpi/namespace/nseval.c	1.18    -> 1.19   
#	arch/alpha/kernel/sys_wildfire.c	1.6     -> 1.7    
#	drivers/ide/setup-pci.c	1.11    -> 1.12   
#	include/asm-x86_64/bitops.h	1.7     -> 1.8    
#	arch/i386/pci/common.c	1.34    -> 1.35   
#	  net/rxrpc/sysctl.c	1.1     -> 1.2    
#	include/linux/pci_ids.h	1.81    -> 1.82   
#	drivers/scsi/aic7xxx_old.c	1.42    -> 1.43   
#	drivers/usb/serial/usb-serial.c	1.70    -> 1.72   
#	include/asm-ppc/system.h	1.16    -> 1.17   
#	arch/m68knommu/vmlinux.lds.S	1.4     -> 1.5    
#	arch/x86_64/boot/compressed/misc.c	1.4     -> 1.5    
#	 drivers/md/linear.c	1.22    -> 1.23   
#	Documentation/scsi/ChangeLog.sym53c8xx_2	1.4     -> 1.5    
#	drivers/char/ftape/zftape/zftape-vtbl.c	1.4     -> 1.5    
#	drivers/acpi/utilities/utcopy.c	1.21    -> 1.22   
#	arch/alpha/kernel/Makefile	1.23    -> 1.25   
#	arch/x86_64/ia32/sys_ia32.c	1.19    -> 1.20   
#	drivers/acpi/executer/exstore.c	1.22    -> 1.23   
#	arch/sparc64/kernel/systbls.S	1.30    -> 1.31   
#	  fs/befs/linuxvfs.c	1.5     -> 1.6    
#	drivers/serial/mcfserial.c	1.2     -> 1.3    
#	 include/linux/usb.h	1.69    -> 1.71   
#	drivers/net/sis900.c	1.31    -> 1.32   
#	include/asm-ppc/posix_types.h	1.4     -> 1.5    
#	drivers/media/radio/radio-cadet.c	1.10    -> 1.11   
#	include/asm-v850/asm.h	1.2     -> 1.3    
#	drivers/usb/misc/atmsar.h	1.3     -> 1.6    
#	drivers/ide/ide-cd.c	1.35    -> 1.38   
#	include/asm-m68knommu/mcfmbus.h	1.1     -> 1.2    
#	drivers/acpi/pci_irq.c	1.15    -> 1.16   
#	drivers/bluetooth/hci_h4.c	1.11    -> 1.12   
#	drivers/ide/pci/ns87415.c	1.8     -> 1.10   
#	drivers/md/multipath.c	1.42    -> 1.43   
#	arch/x86_64/kernel/nmi.c	1.7     -> 1.8    
#	drivers/char/riscom8.c	1.9     -> 1.10   
#	   arch/v850/Kconfig	1.6     -> 1.7    
#	   drivers/scsi/sg.c	1.47    -> 1.48   
#	  fs/xfs/xfs_trans.c	1.4     -> 1.5    
#	drivers/s390/block/dasd.c	1.47    -> 1.48   
#	 net/sched/sch_atm.c	1.6     -> 1.7    
#	arch/ppc64/boot/addSystemMap.c	1.1     -> 1.2    
#	drivers/net/dgrs_plx9060.h	1.1     -> 1.2    
#	net/sunrpc/auth_gss/auth_gss.c	1.2     -> 1.3    
#	include/asm-ppc64/semaphore.h	1.4     -> 1.5    
#	 drivers/ide/Kconfig	1.7     -> 1.8    
#	drivers/acpi/dispatcher/dsutils.c	1.18    -> 1.19   
#	drivers/scsi/aic7xxx/aic79xx_pci.c	1.4     -> 1.5    
#	include/linux/profile.h	1.3     -> 1.4    
#	drivers/char/watchdog/sc520_wdt.c	1.4     -> 1.5    
#	arch/i386/kernel/setup.c	1.67    -> 1.68   
#	arch/ppc/kernel/process.c	1.30    -> 1.31   
#	drivers/bluetooth/bluecard_cs.c	1.7     -> 1.9    
#	drivers/acpi/utilities/utdelete.c	1.16    -> 1.17   
#	drivers/scsi/AM53C974.c	1.10    -> 1.11   
#	drivers/video/sgivwfb.c	1.24    -> 1.25   
#	     net/ipv4/ipmr.c	1.14    -> 1.15   
#	drivers/acpi/dispatcher/dsmethod.c	1.15    -> 1.16   
#	Documentation/sysrq.txt	1.6     -> 1.7    
#	include/asm-x86_64/ide.h	1.10    -> 1.11   
#	drivers/char/tpqic02.c	1.19    -> 1.20   
#	arch/x86_64/mm/pageattr.c	1.1     -> 1.2    
#	arch/i386/kernel/time.c	1.26    -> 1.27   
#	Documentation/networking/alias.txt	1.2     -> 1.3    
#	drivers/ide/pci/sis5513.c	1.10    -> 1.12   
#	drivers/scsi/scsi_syms.c	1.26    -> 1.28   
#	drivers/ide/ide-floppy.c	1.24    -> 1.25   
#	drivers/message/fusion/isense.c	1.5     -> 1.7    
#	drivers/scsi/scsi_lib.c	1.68    -> 1.73   
#	arch/sparc64/kernel/time.c	1.20    -> 1.21   
#	drivers/message/fusion/mptctl.h	1.4     -> 1.5    
#	drivers/message/fusion/mptlan.c	1.7     -> 1.8    
#	drivers/message/fusion/lsi/mpi_raid.h	1.2     -> 1.4    
#	include/asm-alpha/bitops.h	1.7     -> 1.8    
#	drivers/acpi/namespace/nsutils.c	1.20    -> 1.21   
#	 include/acpi/acpi.h	1.8     -> 1.10   
#	include/acpi/actbl.h	1.12    -> 1.13   
#	include/asm-s390x/cio.h	1.2     -> 1.3    
#	drivers/ide/arm/icside.c	1.4     -> 1.5    
#	include/asm-x86_64/i387.h	1.6     -> 1.7    
#	drivers/ide/Makefile	1.9     -> 1.10   
#	net/ipv4/xfrm_policy.c	1.14    -> 1.15   
#	arch/x86_64/kernel/io_apic.c	1.4     -> 1.5    
#	arch/ppc64/kernel/profile.c	1.1     ->         (deleted)      
#	drivers/ide/ide-dma.c	1.7     -> 1.9    
#	drivers/ide/legacy/pdc4030.c	1.5     -> 1.6    
#	drivers/acpi/executer/exoparg2.c	1.20    -> 1.21   
#	 drivers/scsi/scsi.c	1.90    -> 1.96   
#	include/asm-sparc/ide.h	1.13    -> 1.14   
#	drivers/usb/core/usb.c	1.114   -> 1.115  
#	drivers/acpi/namespace/nsalloc.c	1.15    -> 1.16   
#	arch/ppc64/kernel/head.S	1.22    -> 1.24   
#	net/ipv4/netfilter/ipt_esp.c	1.3     -> 1.4    
#	drivers/i2c/i2c-proc.c	1.14    -> 1.15   
#	include/asm-ia64/sn/eeprom.h	1.4     -> 1.5    
#	drivers/isdn/hardware/eicon/divamnt.c	1.4     -> 1.5    
#	drivers/scsi/aha1542.c	1.19.1.1 -> 1.21   
#	   net/sunrpc/auth.c	1.10    -> 1.11   
#	fs/xfs/linux/xfs_iomap.c	1.4     -> 1.5    
#	drivers/ide/pci/generic.c	1.6     -> 1.8    
#	drivers/net/aironet4500.h	1.6     ->         (deleted)      
#	arch/x86_64/ia32/ia32_ioctl.c	1.14    -> 1.15   
#	drivers/i2c/i2c-algo-bit.c	1.11    -> 1.12   
#	arch/v850/kernel/intv.S	1.2     -> 1.3    
#	arch/x86_64/mm/hugetlbpage.c	1.8     ->         (deleted)      
#	include/linux/sunrpc/auth.h	1.7     -> 1.8    
#	include/linux/binfmts.h	1.6     -> 1.7    
#	include/asm-i386/mach-visws/setup_arch_post.h	1.7     -> 1.8    
#	arch/x86_64/kernel/profile.c	1.2     ->         (deleted)      
#	Documentation/DocBook/kernel-hacking.tmpl	1.12    -> 1.13   
#	    scripts/Makefile	1.30    -> 1.31   
#	drivers/net/sk98lin/skgeinit.c	1.4     -> 1.6    
#	include/asm-sparc64/irq.h	1.11    -> 1.12   
#	include/net/bluetooth/hci_core.h	1.8     -> 1.10   
#	drivers/net/arlan-proc.c	1.6     -> 1.7     drivers/net/wireless/arlan-proc.c (moved)
#	drivers/acpi/resources/rsaddr.c	1.11    -> 1.13   
#	drivers/isdn/hardware/eicon/mi_pc.h	1.2     -> 1.3    
#	include/asm-arm/arch-integrator/platform.h	1.1     -> 1.2    
#	drivers/acpi/resources/rscalc.c	1.15    -> 1.16   
#	net/bluetooth/rfcomm/Kconfig	1.1.1.1 -> 1.3    
#	drivers/net/au1000_eth.c	1.9     -> 1.11   
#	drivers/ide/pci/siimage.h	1.5     -> 1.6    
#	drivers/media/video/meye.h	1.6     -> 1.7    
#	drivers/ide/ide-proc.c	1.6     -> 1.8    
#	fs/xfs/xfs_log_recover.c	1.9     -> 1.10   
#	  drivers/md/raid1.c	1.50    -> 1.52   
#	net/bluetooth/rfcomm/tty.c	1.8     -> 1.13   
#	include/linux/sunrpc/svc.h	1.18    -> 1.19   
#	net/bluetooth/bnep/bnep.h	1.2     -> 1.4    
#	include/acpi/acmacros.h	1.19    -> 1.20   
#	drivers/pnp/isapnp/core.c	1.29    -> 1.31   
#	fs/xfs/support/spin.h	1.1     -> 1.2    
#	drivers/s390/cio/chsc.c	1.7     -> 1.8    
#	arch/alpha/math-emu/Makefile	1.7     -> 1.9    
#	arch/ppc64/kernel/xics.c	1.18    -> 1.19   
#	   sound/oss/vwsnd.c	1.8     -> 1.9    
#	drivers/scsi/aic7xxx/aic79xx_osm.c	1.17.1.2 -> 1.22   
#	arch/x86_64/kernel/process.c	1.13    -> 1.14   
#	    fs/nfsd/nfssvc.c	1.33    -> 1.34   
#	drivers/pcmcia/tcic.c	1.14    -> 1.15   
#	drivers/acpi/resources/rsdump.c	1.13    -> 1.15   
#	 drivers/net/arlan.h	1.4     -> 1.5     drivers/net/wireless/arlan.h (moved)
#	drivers/char/ipmi/ipmi_msghandler.c	1.1     -> 1.2    
#	 net/ipv6/af_inet6.c	1.19    -> 1.21   
#	arch/i386/pci/Makefile	1.14    -> 1.15   
#	net/bluetooth/hci_sock.c	1.14    -> 1.17   
#	fs/proc/task_nommu.c	1.1     -> 1.2    
#	drivers/pcmcia/hd64465_ss.c	1.9     -> 1.10   
#	arch/sparc64/kernel/signal.c	1.25    -> 1.27   
#	net/ipv4/xfrm_user.c	1.8     -> 1.10   
#	arch/sparc/kernel/time.c	1.12    -> 1.13   
#	drivers/ide/pci/hpt366.c	1.12    -> 1.14   
#	net/bluetooth/syms.c	1.7     -> 1.8    
#	arch/ppc64/boot/addRamDisk.c	1.1     -> 1.2    
#	         fs/buffer.c	1.185   -> 1.186  
#	drivers/pnp/resource.c	1.6     -> 1.9    
#	drivers/acpi/utilities/utinit.c	1.14    -> 1.15   
#	drivers/acpi/parser/psutils.c	1.15    -> 1.16   
#	drivers/acpi/events/evxface.c	1.16    -> 1.18   
#	    fs/nfsd/export.c	1.69    -> 1.70   
#	drivers/ide/ide-probe.c	1.31    -> 1.32   
#	include/linux/i2c-proc.h	1.3     -> 1.4    
#	drivers/scsi/dmx3191d.c	1.9     -> 1.10   
#	drivers/acpi/events/evmisc.c	1.17    -> 1.19   
#	arch/ppc64/kernel/htab.c	1.29    -> 1.31   
#	include/acpi/acevents.h	1.12    -> 1.14   
#	include/acpi/actypes.h	1.20    -> 1.22   
#	include/asm-alpha/system.h	1.14.1.1 -> 1.17   
#	arch/ppc64/mm/init.c	1.39    -> 1.40   
#	 drivers/char/epca.c	1.13    -> 1.14   
#	drivers/media/video/meye.c	1.13    -> 1.14   
#	arch/ppc64/kernel/open_pic.c	1.10    -> 1.11   
#	Documentation/networking/8139too.txt	1.14    -> 1.15   
#	include/linux/raid/raid1.h	1.14    -> 1.15   
#	include/asm-x86_64/delay.h	1.1     -> 1.2    
#	  drivers/scsi/ppa.c	1.17.1.1 -> 1.19   
#	drivers/acpi/events/evgpe.c	1.6     -> 1.8    
#	net/sunrpc/auth_unix.c	1.9     -> 1.10   
#	include/linux/skbuff.h	1.18    -> 1.19   
#	fs/xfs/pagebuf/page_buf.h	1.20    -> 1.22   
#	drivers/char/sonypi.h	1.14    -> 1.15   
#	drivers/char/tty_io.c	1.58    -> 1.62   
#	drivers/acpi/executer/exconfig.c	1.15    -> 1.17   
#	arch/ppc64/kernel/process.c	1.26.1.1 -> 1.29   
#	include/acpi/achware.h	1.11    -> 1.12   
#	            fs/bio.c	1.37    -> 1.38   
#	drivers/usb/core/urb.c	1.10    -> 1.11   
#	       fs/ntfs/mst.c	1.6     -> 1.7    
#	arch/ppc64/boot/crt0.S	1.1     -> 1.2    
#	         MAINTAINERS	1.120   -> 1.124  
#	include/linux/oprofile.h	1.2.1.3 -> 1.5    
#	include/asm-v850/page.h	1.1     -> 1.2    
#	drivers/ide/pci/sc1200.c	1.3     -> 1.5    
#	arch/sparc64/kernel/sys_sunos32.c	1.27    -> 1.28   
#	arch/ia64/ia32/sys_ia32.c	1.42    -> 1.43   
#	include/acpi/actbl2.h	1.14    -> 1.15   
#	drivers/char/rio/rio_linux.c	1.12    -> 1.13   
#	drivers/pcmcia/sa1100_generic.c	1.16    -> 1.17   
#	 include/linux/in6.h	1.2     -> 1.3    
#	include/acpi/aclocal.h	1.24    -> 1.25   
#	drivers/ide/ide-pnp.c	1.4     -> 1.6    
#	fs/partitions/msdos.c	1.17    -> 1.18   
#	drivers/acpi/tables/tbrsdt.c	1.9     -> 1.10   
#	arch/ia64/hp/sim/simeth.c	1.4     -> 1.5    
#	arch/mips64/kernel/linux32.c	1.10    -> 1.11   
#	include/asm-m68knommu/mcfpci.h	1.1     -> 1.2    
#	drivers/char/watchdog/w83877f_wdt.c	1.14    -> 1.15   
#	 arch/alpha/Makefile	1.18.1.5 -> 1.23   
#	Documentation/i2c/summary	1.3     -> 1.4    
#	drivers/acpi/utilities/utdebug.c	1.15    -> 1.16   
#	include/linux/time.h	1.8     -> 1.9    
#	drivers/video/sstfb.c	1.18    -> 1.19   
#	arch/sparc64/kernel/sys_sparc32.c	1.64    -> 1.65   
#	 drivers/net/arlan.c	1.14    -> 1.15    drivers/net/wireless/arlan.c (moved)
#	arch/v850/vmlinux.lds.S	1.6     -> 1.7    
#	drivers/net/aironet4500_card.c	1.14    ->         (deleted)      
#	net/ipv4/netfilter/ipt_ah.c	1.3     -> 1.4    
#	drivers/usb/class/cdc-acm.c	1.33    -> 1.34   
#	include/linux/compiler.h	1.10    -> 1.11   
#	arch/mips/baget/vacserial.c	1.7     -> 1.8    
#	arch/m68knommu/kernel/signal.c	1.5     -> 1.6    
#	 sound/oss/sb_card.c	1.14    -> 1.15   
#	net/bluetooth/rfcomm/sock.c	1.9     -> 1.12   
#	drivers/acpi/tables/tbget.c	1.17    -> 1.18   
#	include/asm-i386/unistd.h	1.23    -> 1.24   
#	drivers/scsi/eata_pio.c	1.12    -> 1.13   
#	include/acpi/acparser.h	1.14    -> 1.15   
#	include/linux/nfsd/nfsfh.h	1.11    -> 1.12   
#	drivers/acpi/utilities/utobject.c	1.16    -> 1.17   
#	drivers/usb/host/ehci-hcd.c	1.43    -> 1.44   
#	include/acpi/amlcode.h	1.15    -> 1.17   
#	include/linux/ipmi_smi.h	1.1     -> 1.2    
#	include/asm-alpha/compiler.h	1.4     -> 1.6    
#	drivers/scsi/pci2000.c	1.12    -> 1.13   
#	drivers/net/ac3200.c	1.10    -> 1.11   
#	drivers/acpi/events/evsci.c	1.11    -> 1.12   
#	arch/cris/drivers/serial.c	1.10    -> 1.11   
#	drivers/scsi/sym53c8xx.c	1.23    -> 1.24   
#	drivers/ide/legacy/falconide.c	1.4     -> 1.5    
#	drivers/scsi/aic7xxx/aic79xx.h	1.3     -> 1.4    
#	drivers/acpi/executer/exsystem.c	1.11    -> 1.12   
#	include/asm-x86_64/unistd.h	1.11    -> 1.12   
#	arch/x86_64/kernel/time.c	1.11    -> 1.12   
#	net/bluetooth/bnep/core.c	1.9.1.1 -> 1.14   
#	include/asm-ppc/delay.h	1.5     -> 1.6    
#	arch/i386/mach-visws/traps.c	1.2     -> 1.3    
#	    fs/ntfs/unistr.c	1.17    -> 1.18   
#	drivers/media/video/bt832.h	1.1     -> 1.2    
#	net/bluetooth/l2cap.c	1.13    -> 1.18   
#	drivers/oprofile/oprofile_stats.c	1.1     -> 1.2    
#	drivers/acpi/resources/rsxface.c	1.11    -> 1.12   
#	arch/v850/kernel/bug.c	1.2     -> 1.3    
#	drivers/ide/legacy/ide-cs.c	1.7     -> 1.8    
#	include/asm-alpha/posix_types.h	1.2     -> 1.3    
#	arch/alpha/lib/udelay.c	1.1     -> 1.2    
#	arch/m68knommu/Kconfig	1.5     -> 1.6    
#	arch/ppc64/kernel/syscalls.c	1.8     -> 1.9    
#	include/asm-x86_64/thread_info.h	1.7     -> 1.8    
#	arch/alpha/kernel/core_irongate.c	1.9     -> 1.10   
#	arch/m68knommu/platform/68360/entry.S	1.2     -> 1.3    
#	arch/ppc64/kernel/sys_ppc32.c	1.48    -> 1.49   
#	  sound/pci/es1968.c	1.16    -> 1.18   
#	drivers/parisc/lba_pci.c	1.5     -> 1.6    
#	arch/sparc64/oprofile/timer_int.c	1.3     -> 1.4    
#	             CREDITS	1.76    -> 1.77   
#	drivers/scsi/fdomain.c	1.16    -> 1.17   
#	 drivers/pci/probe.c	1.26    -> 1.29   
#	arch/mips/kernel/pci.c	1.3     -> 1.4    
#	 drivers/net/strip.c	1.8     -> 1.9     drivers/net/wireless/strip.c (moved)
#	arch/i386/kernel/cpu/cpufreq/longrun.c	1.8     -> 1.9    
#	drivers/char/sonypi.c	1.13    -> 1.14   
#	net/ipv6/ipv6_syms.c	1.6     -> 1.7    
#	drivers/usb/net/kaweth.c	1.36    -> 1.38   
#	drivers/char/tipar.c	1.4     -> 1.5    
#	  fs/xfs/xfs_error.h	1.2     -> 1.3    
#	drivers/scsi/eata_dma_proc.c	1.2     ->         (deleted)      
#	arch/sparc64/mm/ultra.S	1.21    -> 1.22   
#	arch/s390x/kernel/linux32.c	1.37    -> 1.38   
#	drivers/acpi/parser/pswalk.c	1.11    -> 1.12   
#	include/asm-x86_64/pgtable.h	1.12    -> 1.13   
#	drivers/usb/serial/Kconfig	1.5     -> 1.6    
#	drivers/scsi/qlogicfc.c	1.25    -> 1.26   
#	include/asm-ppc64/elf.h	1.7     -> 1.8    
#	include/acpi/acdispat.h	1.12    -> 1.13   
#	arch/ppc/8xx_io/uart.c	1.17    -> 1.18   
#	drivers/ide/legacy/pdc4030.h	1.3     -> 1.4    
#	       fs/quota_v1.c	1.6     -> 1.7    
#	drivers/ide/pci/pdc202xx_new.c	1.10    -> 1.12   
#	drivers/acpi/executer/exoparg6.c	1.7     -> 1.8    
#	arch/x86_64/kernel/Makefile	1.16    -> 1.17   
#	drivers/net/pcmcia/Kconfig	1.2     -> 1.3    
#	drivers/media/video/bt832.c	1.1     -> 1.2    
#	net/ipv6/ip6_input.c	1.5     -> 1.6    
#	arch/i386/mach-visws/pci-visws.c	1.7     -> 1.9     arch/i386/pci/visws.c (moved)
#	include/asm-i386/pgtable.h	1.25    -> 1.26   
#	drivers/acpi/tables/tbxfroot.c	1.16    -> 1.17   
#	arch/x86_64/mm/Makefile	1.8     -> 1.9    
#	drivers/pnp/driver.c	1.10    -> 1.12   
#	drivers/acpi/tables/tbgetall.c	1.8     -> 1.9    
#	include/acpi/acconfig.h	1.31    -> 1.32   
#	drivers/serial/21285.c	1.12    -> 1.13   
#	drivers/media/dvb/av7110/saa7146_core.c	1.4     -> 1.5    
#	Documentation/video4linux/meye.txt	1.5     -> 1.6    
#	drivers/isdn/hardware/eicon/divasproc.c	1.3     -> 1.4    
#	   sound/oss/mad16.c	1.7     -> 1.8    
#	include/asm-arm/arch-iop310/dma.h	1.1     -> 1.2    
#	net/ipv6/xfrm_policy.c	1.1     ->         (deleted)      
#	drivers/usb/input/Kconfig	1.2.1.2 -> 1.4    
#	net/sunrpc/svcauth.c	1.10    -> 1.11   
#	   net/ipv6/Makefile	1.8     -> 1.9    
#	drivers/ide/pci/slc90e66.c	1.8     -> 1.10   
#	drivers/serial/8250_pci.c	1.14    -> 1.15   
#	drivers/bluetooth/hci_ldisc.c	1.6     -> 1.8    
#	 drivers/acpi/numa.c	1.4     -> 1.5    
#	  arch/alpha/Kconfig	1.6.1.9 -> 1.10   
#	drivers/ide/pci/pdcadma.c	1.9     -> 1.11   
#	drivers/net/am79c961a.c	1.8     -> 1.9    
#	include/acpi/platform/aclinux.h	1.18    -> 1.20   
#	arch/x86_64/kernel/vsyscall.c	1.8     -> 1.10   
#	drivers/i2c/i2c-dev.c	1.21    -> 1.22   
#	drivers/i2c/i2c-algo-pcf.c	1.7     -> 1.8    
#	arch/v850/kernel/irq.c	1.3     -> 1.4    
#	Documentation/scsi/scsi_mid_low_api.txt	1.9     -> 1.11   
#	           mm/slab.c	1.61    -> 1.62   
#	include/linux/module.h	1.50    -> 1.51   
#	drivers/scsi/sym53c8xx_defs.h	1.7     -> 1.8    
#	drivers/scsi/eata_pio_proc.c	1.3     ->         (deleted)      
#	include/linux/socket.h	1.5     -> 1.6    
#	drivers/acpi/tables/tbutils.c	1.16    -> 1.17   
#	    fs/xfs/xfsidbg.c	1.18    -> 1.19   
#	drivers/ide/pci/it8172.c	1.8     -> 1.9    
#	drivers/ide/legacy/gayle.c	1.3     -> 1.4    
#	 arch/x86_64/Kconfig	1.14    -> 1.15   
#	drivers/scsi/scsi_scan.c	1.58    -> 1.60   
#	arch/sparc64/mm/Makefile	1.8     -> 1.9    
#	      kernel/sched.c	1.159   -> 1.161  
#	drivers/acpi/executer/exmutex.c	1.10    -> 1.11   
#	Documentation/s390/cds.txt	1.6     -> 1.7    
#	include/asm-i386/lithium.h	1.2     -> 1.3     include/asm-i386/mach-visws/lithium.h (moved)
#	drivers/acpi/parser/psxface.c	1.15    -> 1.16   
#	drivers/ide/arm/rapide.c	1.3     -> 1.4    
#	include/asm-parisc/pdcpat.h	1.1     -> 1.2    
#	drivers/scsi/Makefile	1.37    -> 1.38   
#	       fs/quota_v2.c	1.9     -> 1.10   
#	drivers/ide/legacy/ht6560b.c	1.3     -> 1.4    
#	  drivers/acpi/osl.c	1.24    -> 1.27   
#	drivers/ide/pci/aec62xx.c	1.9     -> 1.11   
#	drivers/i2c/i2c-elv.c	1.9     -> 1.10   
#	drivers/scsi/sim710.c	1.8     -> 1.11   
#	drivers/i2c/i2c-velleman.c	1.7     -> 1.8    
#	drivers/acpi/resources/rsmemory.c	1.10    -> 1.11   
#	arch/sparc64/prom/Makefile	1.8     -> 1.9    
#	include/linux/atmdev.h	1.6     -> 1.7    
#	drivers/char/drm/drm_drv.h	1.11    -> 1.12   
#	drivers/acpi/dispatcher/dsopcode.c	1.18    -> 1.19   
#	include/asm-x86_64/system.h	1.11    -> 1.12   
#	   sound/oss/Kconfig	1.4     -> 1.5    
#	arch/sparc64/kernel/sparc64_ksyms.c	1.36    -> 1.37   
#	drivers/usb/serial/console.c	1.1     -> 1.2    
#	arch/i386/pci/legacy.c	1.7     -> 1.8    
#	 sound/pci/via82xx.c	1.25    -> 1.26   
#	      kernel/timer.c	1.40    -> 1.42   
#	   fs/nfsd/nfs4xdr.c	1.8     -> 1.9    
#	drivers/acpi/executer/exmisc.c	1.19    -> 1.20   
#	drivers/acpi/events/evevent.c	1.21    -> 1.22   
#	drivers/char/agp/via-agp.c	1.27    -> 1.28   
#	arch/i386/mach-visws/Makefile	1.5     -> 1.6    
#	arch/ppc64/kernel/sys32.S	1.10    -> 1.11   
#	drivers/acpi/hardware/hwregs.c	1.17    -> 1.18   
#	drivers/serial/nb85e_uart.c	1.7     -> 1.9    
#	include/linux/raid/raid5.h	1.13    -> 1.14   
#	drivers/scsi/sym53c8xx_2/sym_malloc.c	1.1     -> 1.2    
#	arch/mips/kernel/irixsig.c	1.6     -> 1.7    
#	drivers/pnp/quirks.c	1.7     -> 1.8    
#	arch/m68knommu/platform/68360/commproc.c	1.1     -> 1.2    
#	drivers/ieee1394/ohci1394.c	1.19    -> 1.20   
#	drivers/usb/host/ehci.h	1.17    -> 1.18   
#	 drivers/net/Kconfig	1.16    -> 1.18   
#	drivers/char/sysrq.c	1.25    -> 1.26   
#	arch/ppc64/boot/Makefile	1.9     -> 1.10   
#	drivers/net/pcmcia/ray_cs.h	1.1     -> 1.2     drivers/net/wireless/ray_cs.h (moved)
#	 drivers/scsi/eata.c	1.27    -> 1.28   
#	net/bluetooth/Kconfig	1.1.1.1 -> 1.3    
#	include/asm-alpha/ide.h	1.10    -> 1.11   
#	arch/i386/kernel/profile.c	1.1     ->         (deleted)      
#	arch/cris/boot/compressed/misc.c	1.5     -> 1.6    
#	drivers/acpi/dispatcher/dswstate.c	1.18    -> 1.19   
#	arch/ppc64/kernel/misc.S	1.49    -> 1.50   
#	include/asm-sparc64/posix_types.h	1.4     -> 1.5    
#	drivers/message/fusion/mptlan.h	1.8     -> 1.9    
#	       kernel/exit.c	1.94    -> 1.98   
#	     fs/cifs/CHANGES	1.4     -> 1.5    
#	 sound/oss/maestro.c	1.17    -> 1.18   
#	include/linux/types.h	1.8     -> 1.9    
#	include/asm-parisc/pgtable.h	1.9     -> 1.10   
#	              README	1.6     -> 1.7    
#	arch/ppc/kernel/entry.S	1.25    -> 1.26   
#	drivers/ide/pci/cmd64x.c	1.8     -> 1.10   
#	drivers/acpi/executer/exresop.c	1.19    -> 1.21   
#	drivers/char/specialix.c	1.9     -> 1.10   
#	include/asm-s390/cio.h	1.2     -> 1.3    
#	fs/xfs/xfs_dir_leaf.c	1.3     -> 1.4    
#	drivers/pcmcia/i82365.c	1.21    -> 1.22   
#	arch/alpha/kernel/ptrace.c	1.12    -> 1.13   
#	include/acpi/acinterp.h	1.20    -> 1.21   
#	drivers/net/tulip/dmfe.c	1.25    -> 1.26   
#	arch/sparc64/kernel/ioctl32.c	1.46.1.4 -> 1.52   
#	drivers/scsi/pcmcia/aha152x_stub.c	1.11    -> 1.12   
#	arch/i386/lib/delay.c	1.3     -> 1.4    
#	drivers/acpi/tables/tbxface.c	1.15    -> 1.16   
#	drivers/scsi/Kconfig	1.12    -> 1.15   
#	fs/xfs/linux/xfs_aops.c	1.23    -> 1.24   
#	include/asm-ppc/ppcboot.h	1.3     -> 1.4    
#	   fs/cifs/connect.c	1.8     -> 1.9    
#	include/net/bluetooth/hci.h	1.8     -> 1.11   
#	include/asm-ppc/ide.h	1.17    -> 1.18   
#	drivers/acpi/namespace/nsdump.c	1.18    -> 1.19   
#	drivers/acpi/executer/exoparg1.c	1.20    -> 1.21   
#	arch/i386/kernel/cpu/cpufreq/p4-clockmod.c	1.10    -> 1.11   
#	arch/ppc64/kernel/signal32.c	1.37    -> 1.38   
#	drivers/pci/Makefile	1.22    -> 1.23   
#	drivers/message/i2o/i2o_config.c	1.13    -> 1.14   
#	include/asm-alpha/byteorder.h	1.1     -> 1.2    
#	arch/ppc/kernel/misc.S	1.39    -> 1.41   
#	drivers/char/mwave/3780i.c	1.2     -> 1.3    
#	drivers/pci/hotplug.c	1.10    -> 1.11   
#	arch/v850/kernel/entry.S	1.5     -> 1.6    
#	fs/xfs/linux/xfs_super.c	1.27    -> 1.28   
#	arch/i386/mm/hugetlbpage.c	1.31    -> 1.32   
#	drivers/acpi/namespace/nsload.c	1.17    -> 1.18   
#	drivers/char/genrtc.c	1.4     -> 1.6    
#	 drivers/net/setup.c	1.5     -> 1.6    
#	drivers/acpi/dispatcher/dsinit.c	1.7     -> 1.8    
#	arch/ppc64/kernel/time.c	1.17    -> 1.19   
#	arch/i386/kernel/i8259.c	1.19    -> 1.20   
#	drivers/ide/pci/cmd640.c	1.4     -> 1.5    
#	include/asm-m68knommu/cacheflush.h	1.1     -> 1.2    
#	drivers/input/joystick/grip_mp.c	1.2     -> 1.3    
#	drivers/net/bonding.c	1.16    -> 1.17   
#	Documentation/i2c/i2c-protocol	1.1     -> 1.2    
#	drivers/usb/input/usbmouse.c	1.21.1.1 -> 1.23   
#	drivers/scsi/3w-xxxx.c	1.22    -> 1.24   
#	drivers/bluetooth/hci_usb.c	1.19.1.1 -> 1.21   
#	 sound/pci/als4000.c	1.9     -> 1.10   
#	 net/ipv6/addrconf.c	1.21    -> 1.22   
#	fs/xfs/support/qsort.c	1.1     -> 1.2    
#	arch/ia64/sn/io/l1.c	1.5     -> 1.6    
#	drivers/char/watchdog/wafer5823wdt.c	1.4     -> 1.5    
#	drivers/acpi/executer/excreate.c	1.16    -> 1.17   
#	 net/sctp/ulpqueue.c	1.8     -> 1.9    
#	  drivers/pnp/card.c	1.5     -> 1.8    
#	arch/sparc64/kernel/sunos_ioctl32.c	1.2     -> 1.3    
#	    kernel/profile.c	1.3     -> 1.4    
#	drivers/bluetooth/hci_vhci.c	1.11    -> 1.12   
#	include/asm-i386/posix_types.h	1.1     -> 1.2    
#	 include/pcmcia/ss.h	1.5     -> 1.7    
#	drivers/acpi/executer/exstorob.c	1.17    -> 1.18   
#	  sound/pci/cs4281.c	1.21    -> 1.22   
#	include/asm-ia64/sn/sn2/shub_md.h	1.2     -> 1.3    
#	drivers/acpi/utilities/utmath.c	1.7     -> 1.8    
#	arch/m68knommu/platform/68360/uCquicc/crt0_rom.S	1.2     -> 1.3    
#	net/decnet/dn_route.c	1.11    -> 1.12   
#	drivers/usb/input/usbkbd.c	1.24.1.1 -> 1.26   
#	      fs/cifs/misc.c	1.4     -> 1.5    
#	drivers/acpi/namespace/nsaccess.c	1.16    -> 1.19   
#	drivers/acpi/namespace/nssearch.c	1.17    -> 1.18   
#	drivers/usb/misc/Kconfig	1.4     -> 1.5    
#	drivers/serial/68360serial.c	1.5     -> 1.6    
#	arch/alpha/lib/Makefile	1.12    -> 1.14   
#	drivers/scsi/wd7000.h	1.8     ->         (deleted)      
#	drivers/net/skfp/pmf.c	1.1     -> 1.2    
#	drivers/ide/ppc/mpc8xx.c	1.3     -> 1.4    
#	include/linux/i2c-algo-bit.h	1.2     -> 1.3    
#	drivers/i2c/i2c-rpx.c	1.4     -> 1.5    
#	drivers/isdn/hardware/eicon/i4lididrv.c	1.5     -> 1.6    
#	drivers/parport/parport_pc.c	1.32    -> 1.33   
#	include/asm-x86_64/hw_irq.h	1.4     -> 1.5    
#	drivers/net/wireless/airport.c	1.11    -> 1.12   
#	drivers/char/ppdev.c	1.18    -> 1.19   
#	Documentation/i2c/smbus-protocol	1.3     -> 1.4    
#	drivers/pci/setup-bus.c	1.12    -> 1.13   
#	arch/m68knommu/platform/68328/pilot/crt0_rom.S	1.1     -> 1.2    
#	arch/m68k/ifpsp060/src/fpsp.S	1.4     -> 1.5    
#	arch/ppc64/kernel/Makefile	1.20    -> 1.21   
#	drivers/acpi/dispatcher/dswexec.c	1.17    -> 1.18   
#	include/asm-x86_64/processor.h	1.11    -> 1.12   
#	drivers/ide/pci/pdc202xx_old.c	1.10    -> 1.12   
#	include/acpi/platform/acgcc.h	1.15    -> 1.16   
#	drivers/usb/net/pegasus.h	1.22    -> 1.23   
#	drivers/scsi/eata_dma.h	1.3     ->         (deleted)      
#	drivers/bluetooth/Makefile	1.9.1.1 -> 1.11   
#	net/decnet/dn_nsp_out.c	1.4     -> 1.5    
#	drivers/scsi/qlogicisp.c	1.17    -> 1.18   
#	include/asm-ppc64/hw_irq.h	1.7     -> 1.8    
#	include/linux/i2c-algo-pcf.h	1.1     -> 1.2    
#	drivers/acpi/namespace/nsxfeval.c	1.9     -> 1.10   
#	 include/linux/pnp.h	1.12    -> 1.14   
#	drivers/scsi/pcmcia/nsp_cs.c	1.15    -> 1.16   
#	drivers/scsi/eata_pio.h	1.4     -> 1.5    
#	     net/ipv4/igmp.c	1.12    -> 1.13   
#	include/asm-x86_64/posix_types.h	1.1     -> 1.2    
#	drivers/isdn/eicon/divalog.h	1.3     -> 1.4    
#	drivers/scsi/wd7000.c	1.16.1.1 -> 1.19   
#	arch/alpha/mm/Makefile	1.5     -> 1.7    
#	arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c	1.2     -> 1.3    
#	arch/mips/ddb5xxx/common/pci.c	1.2     -> 1.3    
#	drivers/pcmcia/pci_socket.c	1.11    -> 1.13   
#	drivers/serial/sunzilog.c	1.24    -> 1.26   
#	include/asm-i386/hw_irq.h	1.19    -> 1.20   
#	drivers/bluetooth/bt3c_cs.c	1.6.1.2 -> 1.10   
#	  drivers/scsi/imm.c	1.16.1.1 -> 1.18   
#	drivers/acpi/dispatcher/dswscope.c	1.12    -> 1.13   
#	net/bluetooth/bnep/Kconfig	1.1.1.1 -> 1.3    
#	    net/ipv4/route.c	1.38    -> 1.40   
#	arch/m68knommu/mm/Makefile	1.2     -> 1.3    
#	net/bluetooth/hci_conn.c	1.6     -> 1.7    
#	arch/ppc64/kernel/align.c	1.5     -> 1.6    
#	drivers/acpi/resources/rsirq.c	1.13    -> 1.14   
#	include/asm-ppc64/system.h	1.16    -> 1.17   
#	include/net/sctp/structs.h	1.33    -> 1.34   
#	arch/i386/kernel/i386_ksyms.c	1.43    -> 1.45   
#	drivers/ide/legacy/qd65xx.h	1.2     -> 1.3    
#	include/asm-arm/hardware/iomd.h	1.3     -> 1.4    
#	arch/ppc/xmon/ansidecl.h	1.3     -> 1.4    
#	include/linux/tty_ldisc.h	1.2     -> 1.3    
#	drivers/scsi/sym53c8xx_2/sym_glue.h	1.8     -> 1.9    
#	         fs/nfsctl.c	1.5     -> 1.6    
#	Documentation/sound/oss/PSS-updates	1.2     -> 1.3    
#	drivers/ide/pci/amd74xx.c	1.13    -> 1.14   
#	  fs/nfsd/nfs4proc.c	1.6     -> 1.8    
#	arch/m68k/kernel/head.S	1.10    -> 1.11   
#	drivers/acpi/namespace/nswalk.c	1.11    -> 1.12   
#	arch/ppc64/kernel/ioctl32.c	1.23    -> 1.24   
#	drivers/scsi/qla1280.c	1.30    -> 1.31   
#	arch/parisc/kernel/parisc_ksyms.c	1.7     -> 1.8    
#	drivers/message/fusion/mptscsih.h	1.14    -> 1.15   
#	drivers/char/amiserial.c	1.11    -> 1.12   
#	arch/ppc64/kernel/pSeries_lpar.c	1.17    -> 1.18   
#	drivers/acpi/resources/rslist.c	1.12    -> 1.13   
#	arch/v850/kernel/signal.c	1.7     -> 1.8    
#	arch/i386/kernel/apic.c	1.31    -> 1.33   
#	drivers/usb/misc/speedtouch.c	1.44    -> 1.60   
#	Documentation/DocBook/videobook.tmpl	1.3     -> 1.4    
#	    fs/xfs/xfs_log.c	1.9     -> 1.10   
#	    fs/ntfs/attrib.c	1.84    -> 1.85   
#	drivers/pcmcia/i82092.c	1.12    -> 1.13   
#	drivers/acpi/namespace/nsnames.c	1.16    -> 1.17   
#	arch/x86_64/kernel/smpboot.c	1.12    -> 1.13   
#	arch/ppc64/oprofile/timer_int.c	1.3     -> 1.4    
#	drivers/net/wireless/orinoco.c	1.19    -> 1.20   
#	arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c	1.4     -> 1.5    
#	include/asm-ppc64/posix_types.h	1.3     -> 1.4    
#	arch/m68knommu/platform/68360/uCquicc/crt0_ram.S	1.2     -> 1.3    
#	drivers/char/ip2main.c	1.23    -> 1.24   
#	drivers/pnp/system.c	1.4     -> 1.6    
#	arch/ppc64/boot/main.c	1.3     -> 1.5    
#	drivers/scsi/53c7xx.c	1.13    -> 1.14   
#	include/asm-v850/entry.h	1.1     -> 1.2    
#	net/bluetooth/bnep/sock.c	1.4     -> 1.7    
#	drivers/scsi/sym53c8xx_2/sym_glue.c	1.13    -> 1.15   
#	drivers/net/wireless/Makefile	1.9     -> 1.10   
#	    fs/xfs/xfs_log.h	1.2     -> 1.3    
#	net/sunrpc/auth_null.c	1.9     -> 1.10   
#	drivers/scsi/tmscsim.c	1.16    -> 1.17   
#	drivers/usb/serial/usb-serial.h	1.24    -> 1.25   
#	    net/atm/common.c	1.11    -> 1.12   
#	   scripts/header.tk	1.3     ->         (deleted)      
#	drivers/char/ftape/zftape/zftape-eof.c	1.1     -> 1.2    
#	               (new)	        -> 1.1     arch/ppc64/boot/string.S
#	               (new)	        -> 1.1     include/asm-i386/mach-visws/mach_apic.h
#	               (new)	        -> 1.2     include/linux/idr.h
#	               (new)	        -> 1.5     arch/alpha/oprofile/common.c
#	               (new)	        -> 1.1     arch/ppc64/boot/ppc32-types.h
#	               (new)	        -> 1.1     arch/i386/kernel/doublefault.c
#	               (new)	        -> 1.1     arch/m68knommu/mm/extable.c
#	               (new)	        -> 1.1     include/asm-v850/bug.h
#	               (new)	        -> 1.1     arch/i386/kernel/cpu/cpufreq/Kconfig
#	               (new)	        -> 1.2     drivers/pnp/support.c
#	               (new)	        -> 1.1     arch/ppc64/boot/README
#	               (new)	        -> 1.1     arch/m68knommu/platform/68VZ328/ucdimm/config.c
#	               (new)	        -> 1.1     include/asm-i386/i8259.h
#	               (new)	        -> 1.1     include/asm-v850/flat.h
#	               (new)	        -> 1.4     arch/alpha/oprofile/op_model_ev5.c
#	               (new)	        -> 1.4     arch/alpha/oprofile/op_model_ev4.c
#	               (new)	        -> 1.2     lib/idr.c      
#	               (new)	        -> 1.1     include/asm-i386/mach-visws/piix4.h
#	               (new)	        -> 1.1     arch/alpha/oprofile/Kconfig
#	               (new)	        -> 1.1     include/linux/posix-timers.h
#	               (new)	        -> 1.3     kernel/posix-timers.c
#	               (new)	        -> 1.1     sound/oss/sb_card.h
#	               (new)	        -> 1.5     arch/alpha/oprofile/op_model_ev6.c
#	               (new)	        -> 1.1     include/asm-generic/ide_iops.h
#	               (new)	        -> 1.1     arch/i386/mach-visws/reboot.c
#	               (new)	        -> 1.1     arch/m68knommu/platform/5307/vectors.c
#	               (new)	        -> 1.1     arch/ppc64/boot/prom.c
#	               (new)	        -> 1.1     include/asm-m68knommu/flat.h
#	               (new)	        -> 1.3     arch/alpha/oprofile/op_impl.h
#	               (new)	        -> 1.4     drivers/pnp/manager.c
#	               (new)	        -> 1.4     arch/alpha/oprofile/op_model_ev67.c
#	               (new)	        -> 1.4     arch/alpha/oprofile/Makefile
#	               (new)	        -> 1.4     drivers/bluetooth/btuart_cs.c
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/02/17	torvalds@home.transmeta.com	1.914.102.107
# Linux 2.5.62
# --------------------------------------------
# 03/02/17	jgarzik@redhat.com	1.914.175.1
# [netdrvr 8139too] add to the list of supported boards
# --------------------------------------------
# 03/02/18	anton@samba.org	1.914.102.108
# Merge samba.org:/scratch/anton/linux-2.5
# into samba.org:/scratch/anton/sfr
# --------------------------------------------
# 03/02/17	jgarzik@redhat.com	1.914.176.1
# Merge redhat.com:/garz/repo/linus-2.5
# into redhat.com:/garz/repo/net-drivers-2.5
# --------------------------------------------
# 03/02/17	jgarzik@redhat.com	1.914.176.2
# [netdrvr] Remove superceded wireless driver aironet4500
# 
# From the maintainer, Elmer Joandi(sp?):
# 	aironet4500 is superseded by cisco340 drivers (airo.c) by Ben Reed
# and the  only strenght of my driver is that it allows to access absolutely
# all registers on card. Which is useful for developers only. Besides there
# is no normal interface to configure crypto in my driver, as the general
# interface is not userfriendly at all. So in fact, I use Bens driver for my
# ISP bussiness in general cases and my driver for troubleshooting.
# --------------------------------------------
# 03/02/17	willy@debian.org	1.914.176.3
# [wireless airo] call pci_enable_device, pci_set_master as needed
# --------------------------------------------
# 03/02/17	jejb@raven.il.steeleye.com	1.914.177.1
# Merge raven.il.steeleye.com:/home/jejb/BK/scsi-misc-2.5
# into raven.il.steeleye.com:/home/jejb/BK/scsi-for-linus-2.5
# --------------------------------------------
# 03/02/17	neilb@cse.unsw.edu.au	1.914.177.2
# [PATCH] Bounds checking for NFSv3 readdirplus
# 
# From Ted Phelps <phelps@dstc.edu.au>
# 
# The NFSv3 readdirplus path doesn't check to see if maxcount is less
# than the size of a page before it fills it up, possibly overwriting
# random bits of memory.  At least, it makes my Solaris NFSv3 client
# work.
# 
# The attached patch, against 2.5.58, adds this check in a way which is
# consistent with the way readdir does under both NFSv2 andNFSv3.
# --------------------------------------------
# 03/02/17	neilb@cse.unsw.edu.au	1.914.177.3
# [PATCH] Keep track of which page is the 'tail' of an NFSd reply
# 
# NFS replies can have a 'tail' after a 'data' component
# (for read, readlink, readdir).
# 
# For nfsv2 and v3 this tail is in the same page as the head.
# For nfsv4, this tail is in a separate page.
# 
# We need to keep track of which page so that it right one
# gets sent.  This patch does that.
# --------------------------------------------
# 03/02/17	neilb@cse.unsw.edu.au	1.914.177.4
# [PATCH] Fix handling of error code in NFSv4 replies
# 
# As nfsv4 does some reply encoding while processing
# requests, the code which tries to put the overall status
# at the head of the reply fails.
# 
# With this patch, we take the address for the overall
# status very early so NFSv4's encoding wont confuse us.
# --------------------------------------------
# 03/02/17	neilb@cse.unsw.edu.au	1.914.177.5
# [PATCH] Fix problem where knfsd wouldn't release filesystem on unexport.
# 
# Problem was that the cache was being updated inplace, rather
# than swapping in a new entry, so old filesystem pointers
# were overwritten without being released.
# --------------------------------------------
# 03/02/17	neilb@cse.unsw.edu.au	1.914.177.6
# [PATCH] Make kNFSd pre/post_[acm]time use struct timespec
# 
# From Trond:
# 
#   When the nanosecond resolution on [acm]time was introduced to 2.5.x,
# the knfsd GETATTR responses were converted to make use of the
# nanosecond field, but the pre/post WCC attributes were not. This will
# lead to a lot of unnecessary cache invalidations on the clients.
# 
# The following trivial patch should fix up knfsd so that it stores and
# encodes the full 'struct timespec' in both pre and post attribute
# fields.
# --------------------------------------------
# 03/02/17	neilb@cse.unsw.edu.au	1.914.177.7
# [PATCH] Convert fs/nfsctl.c to use C99 named initiailzers
# 
# From Art Haas <ahaas@airmail.net>:
# 
# This converts the file to use C99 named initializers.  These change make
# the file compile with fewer warnings if '-W' is added to the compile
# flags, and may enhance code readability.  Let me know if you think this
# should be sent to Linus.
# --------------------------------------------
# 03/02/17	neilb@cse.unsw.edu.au	1.914.177.8
# [PATCH] Fix bug in md superblock sanity checking.
# 
# This call the super_90_load is meant to make sure that the new
# superblock is consistant with a pre-exisitnig one (on rdev0)...  but
# rdev0 was not passed :-(
# --------------------------------------------
# 03/02/17	neilb@cse.unsw.edu.au	1.914.177.9
# [PATCH] linear.c fix for gcc bug
# 
# From Andrew Morton <akpm@digeo.com>:
# 
# gcc-2.95.3 is getting an internal compiler error with CONFIG_LBD=y.  Reorganising
# the code a bit made it go away.
# --------------------------------------------
# 03/02/17	neilb@cse.unsw.edu.au	1.914.177.10
# [PATCH] Small bug fix for multipath.
# 
# by the nature of multipath, already be in-sync, so we should set the
# in-sync flag.
# --------------------------------------------
# 03/02/17	neilb@cse.unsw.edu.au	1.914.177.11
# [PATCH] C99 initializers for drivers/md/md.c
# 
# From Art Haas <ahaas@airmail.net>:
# 
# This converts md.c to use C99 initializers to improve readability and
# remove warnings if '-W' is used.
# --------------------------------------------
# 03/02/17	neilb@cse.unsw.edu.au	1.914.177.12
# [PATCH] Add name of md device to name of thread managing that device.
# 
# This allows the thread to easily identified and signalled.
# The point of signalling will appear in the next patch.
# --------------------------------------------
# 03/02/17	neilb@cse.unsw.edu.au	1.914.177.13
# [PATCH] Provide a 'safe-mode' for soft raid.
# 
# When a raid1 or raid5 array is in 'safe-mode', then the array
# is marked clean whenever there are no outstanding write requests,
# and is marked dirty again before allowing any write request to
# proceed.
# 
# This means than an unclean shutdown while no write activity is happening
# will NOT cause a resync to be required.  However it does mean extra
# updates to the superblock.
# 
# Currently safe-mode is turned on by sending SIGKILL to the raid thread
# as would happen at a normal shutdown.  This should mean that the
# reboot notifier is no longer needed.
# 
# After looking more at performance issues I may make safemode be on
# all the time.  I will almost certainly make it on when RAID5 is degraded
# as an unclean shutdown of a degraded RAID5 means data loss.
# 
# This code was provided by  Angus Sawyer <angus.sawyer@dsl.pipex.com>
# --------------------------------------------
# 03/02/17	davem@nuts.ninka.net	1.914.178.1
# Merge nuts.ninka.net:/home/davem/src/BK/network-2.5
# into nuts.ninka.net:/home/davem/src/BK/net-2.5
# --------------------------------------------
# 03/02/18	anton@samba.org	1.914.102.109
# Merge samba.org:/scratch/anton/linux-2.5
# into samba.org:/scratch/anton/sfr
# --------------------------------------------
# 03/02/18	tinglett@vnet.ibm.com	1.914.1.39
# Merge bk://ppc.bkbits.net/for-linus-ppc64
# into vnet.ibm.com:/u1/tinglett/bk/for-linus-ppc64
# --------------------------------------------
# 03/02/18	hch@lab343.munich.sgi.com	1.914.177.14
# Merge http://linux.bkbits.net/linux-2.5
# into lab343.munich.sgi.com:/home/hch/repo/bkbits/linux-2.5
# --------------------------------------------
# 03/02/18	baldrick@wanadoo.fr	1.914.169.21
# [PATCH] USB speedtouch: replace speedtouch crc routines
# 
# Use the kernel CRC routines rather than a do-it-yourself version.
# By the way, I created a common USB Makefile.lib, rather than having
# one for the class drivers, and one for speedtouch.
# --------------------------------------------
# 03/02/18	Andries.Brouwer@cwi.nl	1.914.179.1
# [PATCH] remove BSD_PARTITION
# 
# There is no reason to have both BSD_PARTITION and FREEBSD_PARTITION
# denoting the same partition type.
# --------------------------------------------
# 03/02/18	baldrick@wanadoo.fr	1.914.169.22
# [PATCH] USB speedtouch: speedtouch stability fix fix
# 
# It's usually considered stupid to stuff-up like this. However,
# for this once we'll just call it "inspired".
# --------------------------------------------
# 03/02/18	baldrick@wanadoo.fr	1.914.169.23
# [PATCH] USB speedtouch: speedtouch cleanups
# 
# Grab bag of minor cleanups.
# --------------------------------------------
# 03/02/18	agrover@groveronline.com	1.914.180.1
# Merge groveronline.com:/root/bk/linux-2.5
# into groveronline.com:/root/bk/linux-acpi
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.2
# [PATCH] ide resync
# 
# Ok this first piece eliminates some of the use of ide_ioreg_t, which
# actually only works as a ulong anyway. Its a dysfunctional abstraction.
# 
# We also need the ide pci stuff if we have IDE PCI not if we have PCI but
# only legacy mode IDE support
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.3
# [PATCH] add generic ide iops
# 
# This abstracts out the mmio copies as PPC at least has better ways to
# this and there are other issues on other platforms. It keeps DaveM happy
# too 8)
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.4
# [PATCH] eliminate use of ide_ioreg_t on ARM
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.5
# [PATCH] update ide.c
# 
# Remove ide_ioreg_t
# Add locking on the ide setting lists
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.6
# [PATCH] remove old style and unused bad drive list
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.7
# [PATCH] clean up the IDE iops, add ones for a dead iface
# 
# Also adds the new OUTBSYNC iop
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.8
# [PATCH] fix ide_ioreg_t and ifdefs in iops
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.9
# [PATCH] add ide_execute_command but do not use it yet
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.10
# [PATCH] remove ide_ioreg_t
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.11
# [PATCH] ide-probe updates
# 
# Fix crash with slave and no master
# Fix crash with hdb=noprobe hdb=cdrom
# Fix crash with pre ATA devices refusing IDENTIFY
# Fix flash slave making master disappear
# Add interfaces that the PPC uses to do disk spin up when the BIOS has not
# Add framework to allow hdparm -d1 on a box built with IDE_DMA_ONLYDISK
# Fix identify framework so we can fix the proc identify crash too
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.12
# [PATCH] ide-proc - fix crash on identify
# 
# We cannot do an identify on a drive with no driver loaded. The kernel
# has a ton of half backed "if no driver" cases but they dont cover all
# cases and its a mess.
# 
# For now we rely on the probe time identify unless a driver is loaded. A
# proper fix (an 'ide-unassigned' driver) will follow later
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.13
# [PATCH] add new settings locks to ide-proc
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.14
# [PATCH] ide-tape no longer needs this ifdef
# 
# Now handled at runtime
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.15
# [PATCH] fix path of file
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.16
# [PATCH] path/ide_ioreg_t fixes for legacy drivers
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.17
# [PATCH] fix int for i/o in pcmcia ide_cs
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.18
# [PATCH] fix the rest of the names/ide_ioreg_t in ide legacy
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.19
# [PATCH] rmeove ide_ioreg_t from PCI ide
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.20
# [PATCH] fix path names and printks in IDE pci
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.21
# [PATCH] add a 'NO_IRQ' definition to IDE
# 
# (second hunk just makes 2.4/2.5 header match format)
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.22
# [PATCH] exterminate unused io_ops structures and switch to ulong
# 
# The iops struct may be a good idea in the longer run but right now its
# unused and its mess that can be restored neatly later on.
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.23
# [PATCH] add pio_speed
# 
# Some drivers need this. Its in the core as the core eventually needs to
# be doing the tracking here
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.24
# [PATCH] kill more ioregs, add OUTBSYNC
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.25
# [PATCH] resync externs, add execute command remove is_flashcard
# 
# (is_flashcard is unneeded outside ide_probe as we have a drive->flash check)
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.26
# [PATCH] copy idesync
# 
# We need to copy the new io op. Actually we need to shoot the entire mess
# in this function and make the drivers always set it but not today.
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.27
# [PATCH] use ide_execute_command for CD
# 
# This is the only user I'll feed you this time. As with 2.4 I want it to
# run for a bit on read only media first 8)
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.28
# [PATCH] add a reminder for vdma on non disk
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.29
# [PATCH] clean up DMA reference, new style ONLYDISK
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.30
# [PATCH] ide-dma, fix bogus inc of waiting_for_dma
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.31
# [PATCH] update ide-floppy for new style onlydisk
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.32
# [PATCH] fix ALi 32bitisms, fix ALi FIFO, fix ALi IRQ crash
# 
# also Enable ATI IGP/ALi combo
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.33
# [PATCH] fix some escaped globals
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.34
# [PATCH] don't force enable generic IDE controllers
# 
# Fixes hangs on Micron Samurai boards
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.35
# [PATCH] part fix the highpoint timing/overclock bug
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.36
# [PATCH] clean up siimage, use generic mmio ops
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.37
# [PATCH] update sis driver
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.179.38
# [PATCH] make the sl82c105 work again
# --------------------------------------------
# 03/02/18	agrover@groveronline.com	1.914.180.2
# ACPI: Change NUMA maintainer email
# --------------------------------------------
# 03/02/18	agrover@groveronline.com	1.914.180.3
# ACPI: Eliminate use of acpi_gpl_gpe_number_info (Matthew Wilcox)
# --------------------------------------------
# 03/02/18	agrover@groveronline.com	1.914.180.4
# ACPI: Support translation attribute (Bjorn Helgaas)
# --------------------------------------------
# 03/02/18	agrover@groveronline.com	1.914.180.5
# ACPI: Add ability to override predefined object values (Ducrot Bruno)
# --------------------------------------------
# 03/02/18	george@mvista.com	1.914.179.39
# [PATCH] POSIX clocks & timers
# 
# This is version 23 or so of the POSIX timer code.
# 
# Internal changelog:
# 
#  - Changed the signals code to match the new order of things.  Also the
#    new xtime_lock code needed to be picked up.  It made some things a lot
#    simpler.
# 
#  - Fixed a spin lock hand off problem in locking timers (thanks
#    to Randy).
# 
#  - Fixed nanosleep to test for out of bound nanoseconds
#    (thanks to Julie).
# 
#  - Fixed a couple of id deallocation bugs that left old ids
#    laying around (hey I get this one).
# 
#  - This version has a new timer id manager.  Andrew Morton
#    suggested elimination of recursion (done) and I added code
#    to allow it to release unused nodes.  The prior version only
#    released the leaf nodes.  (The id manager uses radix tree
#    type nodes.)  Also added is a reuse count so ids will not
#    repeat for at least 256 alloc/ free cycles.
# 
#  - The changes for the new sys_call restart now allow one
#    restart function to handle both nanosleep and clock_nanosleep.
#    Saves a bit of code, nice.
# 
#  - All the requested changes and Lindent too :).
# 
#  - I also broke clock_nanosleep() apart much the same way
#    nanosleep() was with the 2.5.50-bk5 changes.
# 
# TIMER STORMS
# 
# The POSIX clocks and timers code prevents "timer storms" by
# not putting repeating timers back in the timer list until
# the signal is delivered for the prior expiry.  Timer events
# missed by this delay are accounted for in the timer overrun
# count.  The net result is MUCH lower system overhead while
# presenting the same info to the user as would be the case if
# an interrupt and timer processing were required for each
# increment in the overrun count.
# --------------------------------------------
# 03/02/18	torvalds@penguin.transmeta.com	1.914.179.40
# Add ndelay() compatibility macro. If the architecture
# doesn't define ndelay(), fall back on udelay().
# --------------------------------------------
# 03/02/18	agrover@groveronline.com	1.914.180.6
# ACPI: Decrease size of override's static array, add a define for the length,
# and print a msg if used
# --------------------------------------------
# 03/02/18	agrover@groveronline.com	1.914.180.7
# ACPI: Fix printk output (Jochen Hein)
# --------------------------------------------
# 03/02/18	agrover@groveronline.com	1.914.180.8
# ACPI: Misc interpreter improvements
# --------------------------------------------
# 03/02/18	agrover@groveronline.com	1.914.180.9
# ACPI: misc cleanups
# --------------------------------------------
# 03/02/18	agrover@groveronline.com	1.914.180.10
# ACPI: Change license from GPL to dual GPL and BSD-style
# --------------------------------------------
# 03/02/18	ink@jurassic.park.msu.ru	1.914.179.41
# [PATCH] numa fixes
# 
# As Jeff pointed out, reserve_bootmem() in core_irongate.c
# breaks build of generic discontiguous memory kernels because
# this function doesn't exist in such kernels.
# Ditto free_bootmem().
# Also, here's fixes for NUMA+initrd and memory info printk.
# 
# Ivan.
# --------------------------------------------
# 03/02/18	greg@kroah.com	1.914.169.24
# [PATCH] USB: add "present" flag to usb_device structure.
# 
# This solves lots of races when drivers hold a reference to the usb_device
# after the device is physically removed from the system (like when a user
# has a open handle.)  This now prevents any new urbs being submitted or
# canceled for the device.
# --------------------------------------------
# 03/02/18	agrover@groveronline.com	1.914.180.11
# ACPI: Toshiba ACPI device update (John Belmonte)
# --------------------------------------------
# 03/02/18	agrover@groveronline.com	1.914.181.1
# Merge groveronline.com:/root/bk/linux-2.5
# into groveronline.com:/root/bk/linux-acpi
# --------------------------------------------
# 03/02/18	rth@dorothy.sfbay.redhat.com	1.918
# Merge ssh://are.twiddle.net/BK/op-2.5
# into dorothy.sfbay.redhat.com:/dorothy/rth/linux/op-2.5
# --------------------------------------------
# 03/02/18	rth@dorothy.sfbay.redhat.com	1.919
# Merge
# --------------------------------------------
# 03/02/18	greg@kroah.com	1.914.169.25
# [PATCH] USB serial: fix locking logic
# 
# This gets rid of the port semaphore, and the serialization caused by
# that, and replaces it with the proper reference counting logic for
# the usb serial object.
# --------------------------------------------
# 03/02/18	greg@kroah.com	1.914.169.26
# [PATCH] USB: serial core fix to solve ordering issues when destroying our objects.
# --------------------------------------------
# 03/02/18	greg@kroah.com	1.914.182.1
# Merge kroah.com:/home/greg/linux/BK/bleeding_edge-2.5
# into kroah.com:/home/greg/linux/BK/gregkh-2.5
# --------------------------------------------
# 03/02/18	greg@kroah.com	1.914.182.2
# [PATCH] USB: added sched.h to usb.h
# 
# Thanks to Matt Wilcox for the info.
# --------------------------------------------
# 03/02/18	greg@kroah.com	1.914.182.3
# USB: usbnet driver also needs the crc32 code.
# 
# Thanks to David Brownell for this.
# --------------------------------------------
# 03/02/18	alan@lxorguk.ukuu.org.uk	1.914.181.2
# [PATCH] ndelay() for x86
# 
# The implementation is not ideal.  Thats something to tidy up.
# --------------------------------------------
# 03/02/18	torvalds@home.transmeta.com	1.914.181.3
# Merge bk://linuxusb.bkbits.net/linus-2.5
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/18	jgarzik@redhat.com	1.914.176.4
# Move the old wireless drivers into drivers/net/wireless:
# arlan, ray_cs, and strip.
# 
# Contributed by Randy Dunlap.
# --------------------------------------------
# 03/02/18	jgarzik@redhat.com	1.914.176.5
# Merge redhat.com:/garz/repo/linus-2.5
# into redhat.com:/garz/repo/net-drivers-2.5
# --------------------------------------------
# 03/02/18	torvalds@home.transmeta.com	1.914.176.6
# Merge bk://kernel.bkbits.net/jgarzik/net-drivers-2.5
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/18	rth@dorothy.sfbay.redhat.com	1.914.179.42
# [ALPHA] Mirror i386 change to include asm-generic/ide_iops.h.
# --------------------------------------------
# 03/02/18	rth@dorothy.sfbay.redhat.com	1.914.179.43
# [ALPHA] Add clockid_t and timer_t for posix clocks.
# --------------------------------------------
# 03/02/18	rth@dorothy.sfbay.redhat.com	1.920
# [OPROF] Update for change to cpu_type interface.
# --------------------------------------------
# 03/02/18	rth@dorothy.sfbay.redhat.com	1.914.176.7
# Merge dorothy.sfbay.redhat.com:/dorothy/rth/linux/linus-2.5
# into dorothy.sfbay.redhat.com:/dorothy/rth/linux/axp-2.5
# --------------------------------------------
# 03/02/18	rth@dorothy.sfbay.redhat.com	1.921
# [OPROF] Fix arguments to oprofile_add_sample.
# --------------------------------------------
# 03/02/18	rth@dorothy.sfbay.redhat.com	1.922
# Merge dorothy.sfbay.redhat.com:/dorothy/rth/linux/linus-2.5
# into dorothy.sfbay.redhat.com:/dorothy/rth/linux/op-2.5
# --------------------------------------------
# 03/02/18	stevef@smfhome1.austin.rr.com	1.914.183.1
# Remove compiler warnings and allow reconnection of tids after temporary tcp session failure
# --------------------------------------------
# 03/02/18	torvalds@home.transmeta.com	1.914.176.8
# Merge bk://are.twiddle.net/pci-2.5
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/18	kaber@trash.net	1.914.178.2
# [IPV{4,6}]: lru queue for ip_fragment evictor.
# The current ip_fragment evictor kills the oldest entry of each hash bucket
# starting with 0 instead of killing the oldest entry of all buckets. This 
# leads
# to unfair behaviour if one of the higher hash slots carries alot of 
# fragments.
# This patch holds the frag heads in a lru queue so we can kills the least
# recently used first. Each arriving fragment counts as usage.
# --------------------------------------------
# 03/02/18	torvalds@home.transmeta.com	1.923
# Merge bk://are.twiddle.net/op-2.5
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/18	elenstev@mesatop.com	1.924
# [PATCH] spelling fix accessable -> accessible
# 
# This provides the following spelling fix.
# 
#  accessable -> accessible
# --------------------------------------------
# 03/02/18	elenstev@mesatop.com	1.925
# [PATCH] spelling fix adress/addres -> address
# 
# This patch provides the following spelling fixes.
# 
#  adress  -> address
#  addres  -> address
# 
# except for cases in two files which appear to be in French and German.
# These were left as is.
# --------------------------------------------
# 03/02/18	elenstev@mesatop.com	1.926
# [PATCH] spelling fix for interupt -> interrupt
# 
# This patch provides the following spelling fix.
# 
#  interupt -> interrupt
# --------------------------------------------
# 03/02/18	elenstev@mesatop.com	1.927
# [PATCH] spelling fix for compatable -> compatible
# 
# This patch provides the following spelling fixes.
# 
#  compatable    -> compatible
#  compatability -> compatibility
# --------------------------------------------
# 03/02/18	elenstev@mesatop.com	1.928
# [PATCH] spelling fix for propogate -> propagate
# 
# This patch provides the following spelling fix.
# 
#  propogate -> propagate
# --------------------------------------------
# 03/02/18	elenstev@mesatop.com	1.929
# [PATCH] various spelling fixes
# 
# This provides the following spelling fixes.
# 
#  posible  -> possible
#  messsage -> message
#  reqeuest -> request
#  exeption -> exception
#  seqeunce -> sequence
#  loggger  -> logger
#  resposible -> responsible
#  qeueu    -> queue
#  microsecnds -> microseconds
#  positiion -> position
#  feilds    -> fields
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.930
# [PATCH] signal warning and uninitialised variable fix
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.931
# [PATCH] MPT Fusion build fix
# 
# Patch from Hugh Dickins <hugh@veritas.com>
# 
# 2.5.62's removal of scsi_set_pci_device broke the MPT Fusion build.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.932
# [PATCH] fix for uninitialized timer in drm_drv.h
# 
# Patch from Martin Josefsson <gandalf@wlug.westbo.se>
# 
# Here's a fix for an uninitialized timer in drm_drv.h, for some reason it
# initilizes the timer when the device is opened, not at init.  It moves
# the initilization for the waitqueue to init aswell.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.933
# [PATCH] export add_to_page_cache() and __pagevec_lru_add to
# 
# CIFS is using these.
# 
# Given that the readpages() address_space op is supposed to add the pages to
# pagecache, it makes sense to make these functions available to modules.
# 
# I can't say that I put a lot of though into the readpages API.  It was
# designed as just enough functionality to be able to stuff a bunch of
# readahead pages into a single BIO.  The only reason I made it an a_op at all
# was because we have toi enter the fs to pick up the ->get_block callback's
# address.
# 
# But a couple of filesystems seem to be making use of it now.  Reiser4 will
# need access at the do_page_cache_readahead() level too.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.934
# [PATCH] Move mk_pte_huge() into pgtable.h
# 
# Patch from Andi Kleen <ak@muc.de>
# 
# This simple patch allow me to symlink hugetlbpage.c for x86-64.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.935
# [PATCH] fix kirq for clustered apic mode
# 
# Patch from Dave Hansen <haveblue@us.ibm.com>
# 
# The new kirq patch assumes flat addressing APIC mode where apicid = (1
# << cpu).  This isn't true for clustered mode.
# 
#  - Change name/type of irq_balance_mask.  The type of apicid seems to
#    be int.
#  - Change instance of (1<<cpu) to cpu_to_logical_apicid()
#  - Don't use target_cpu_mask, use min_loaded, and convert the real way
# 
# Tested on Summit, and plain SMP.  Martin Bligh and I figured this out
# together, and he agrees.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.936
# [PATCH] Remove MAX_BLKDEV from nfsd
# 
# Patch from Andries.Brouwer@cwi.nl
# 
# Remove MAX_BLKDEV from nfsd.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.937
# [PATCH] Fix warnings for XFS
# 
# Patch from Stephen Hemminger <shemminger@osdl.org>
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.938
# [PATCH] Fix warnings for NTFS
# 
# Patch from Stephen Hemminger <shemminger@osdl.org>
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.939
# [PATCH] allow SMP kernel build without io_apic.c
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# I'm here again, starting another hopeless attempt to submmit
# visws subarch support for 2.5. This series of patches was tested
# by me and brave people from linux-visws-devel mailing list and
# our beloved workstations seem to work well under 2.5.xx.
# 
# This patch moves enable_NMI_through_LVT0() function from io_apic.c
# to apic.c to allow SMP kernel build without io_apic.c included.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.940
# [PATCH] export some functions from i8259.c
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# This trivial patch exports some functions from 8259.c file.
# Visws subarch needs them to handle interrupts from legacy devices
# connected to PIIX4 i8259s, which are in turn connected to SGI
# Cobalt APIC.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.941
# [PATCH] make startup_32 kernel entry point
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# This patch marks startup_32 (in head.S) as kernel entry point,
# visws kernel loader uses raw elf kernel images and entry point
# at stext causes jump to wrong address.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.942
# [PATCH] export boottime gdt descriptor
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# This simple patch exports boottime gdt descriptor from trampoline.S.
# Visws uses it to initialize bootup cpu before running the rest of head.S
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.943
# [PATCH] visws: boot changes
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# This simple patch adds some additional code into head.S.
# 
# On visws bootup cpu starts in protected mode (so we don't need
# setup.S), but setting up pagetables and gdt is required before
# running rest of head.S.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.944
# [PATCH] visws: move header file into asm/arch-visws
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# This trivial patch moves visws related header files into asm/mach-visws.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.945
# [PATCH] visws: add missing mach_apic.h file
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# This patch adds misiing mach_apic.h file.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.946
# [PATCH] visws: pci support
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# This patch contains update of pci support for visws.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.947
# [PATCH] visws: core
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# This patch contains core support for visws subarch.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.948
# [PATCH] visws: framebuffer driver update
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# This patch contains SGI visws framebuffer update. Patch makes it
# compile again and brings flatpanel monitor support back.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.949
# [PATCH] visws: sound update
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# This patch contains SGI visws OSS sound driver update.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.950
# [PATCH] visws: MAINTAINERS file update
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# Looks like I'm a maintainer of visws support now :))
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.951
# [PATCH] visws: i386/KConfig update
# 
# Patch from Andrey Panin <pazke@orbita1.ru>
# 
# And finally, attached patch enables visws subarch support
# in kernel config.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.952
# [PATCH] fix a visws compile warning
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.953
# [PATCH] consolidate and cleanup profiling code.
# 
# Patch from Nikita Danilov <Nikita@Namesys.COM>
# 
# this moves functions from identical per-architecture
# arch/*/kernel/profile.c into generic kernel/profile.c.  Also, identical
# {x86,parisc,ppc64,sparc64}_profile_hook()'s are all replaced by the
# single kernel/profile.c:profile_hook(), which is #defined to noop in
# include/linux/profile.h if CONFIG_PROFILING is not set.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.954
# [PATCH] more ia32 profiler cleanups
# 
# Make the prof_counter and prof_old_counter arrays use per-cpu data, and give
# them static scope.
# 
# Also fix a signedness bug in the voyager implementation (from James)
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.955
# [PATCH] TTY module refcounting fix
# 
# Patch from Max Krasnyansky <maxk@qualcomm.com>
# 
# This changeset adds module refcounting for TTY line disciplines.  I've sent
# the patch to LKM earlier.  No negative comments (actually most people didn't
# seem to care).  This is needed at least for Bluetooth and IrDA (Jean is ok
# with the patch).
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.956
# [PATCH] remove (start|end)_lazy_tlb()
# 
# Patch from William Lee Irwin III <wli@holomorphy.com>
# 
# Remove start_lazy_tlb() and end_lazy_tlb(), as they are unused.
# --------------------------------------------
# 03/02/18	akpm@digeo.com	1.957
# [PATCH] lib/idr.c 64-bit fixes
# 
# Various overflow problems compiling the lib/idr.c code for ppc64
# --------------------------------------------
# 03/02/18	miles@lsi.nec.co.jp	1.958
# [PATCH] Handle null OLD argument in nb85e_uart's nb85e_uart_set_termios function
# --------------------------------------------
# 03/02/18	miles@lsi.nec.co.jp	1.959
# [PATCH] Fix up some left-over sig->sighand issues on the v850
# --------------------------------------------
# 03/02/18	miles@lsi.nec.co.jp	1.960
# [PATCH] Add v850 version of `init_irq_proc' for sysctl
# --------------------------------------------
# 03/02/18	miles@lsi.nec.co.jp	1.961
# [PATCH] Set child process initial stack-pointers correctly on the v850
# 
# Previously the v850's copy_thread function didn't set the child's stack
# pointer at all, with the result that it accidentally worked for vfork
# (where the child has the same SP as the parent), but not for user
# threads; kernel threads also accidentally worked, for a different
# reason.
# --------------------------------------------
# 03/02/18	miles@lsi.nec.co.jp	1.962
# [PATCH] Remove unused compile-time configuration options on v850
# --------------------------------------------
# 03/02/18	miles@lsi.nec.co.jp	1.963
# [PATCH] Use .balign rather than .align for v850 asm funcs
# 
# Removes a bunch of unnecessary nops... :-)
# --------------------------------------------
# 03/02/18	miles@lsi.nec.co.jp	1.964
# [PATCH] v850 kernel entry fixes and cleanup
# 
# 1) Preserve the v850 system-call-number register when handling a signal;
#    otherwise system calls will not be correctly restarted afterwards
# 2) Correctly handle illegal insn exceptions, which need a special
#    instruction to return (not reti), and save PC/PSW to a different place
# 2) Remove some unnecessary register saving in the trap handler
# 3) Consolidate various places that use the register save/restore macros
# 4) Eliminate some unused compile-time configuration stuff
# 5) A bit of whitespace and other syntactic cleanup
# --------------------------------------------
# 03/02/18	miles@lsi.nec.co.jp	1.965
# [PATCH] Implement <asm/bug.h> for v850
# --------------------------------------------
# 03/02/18	miles@lsi.nec.co.jp	1.966
# [PATCH] Add a v850 config option to pass illegal insn traps to the kernel
# 
# On the v850 RTE-MA1-CB-MULTI platform, these are normally intercepted by
# the monitor for the use of an external debugger, but if you want to use
# a linux-resident debugger, the kernel has to see them.
# --------------------------------------------
# 03/02/18	miles@lsi.nec.co.jp	1.967
# [PATCH] Force v850 interrupt vector parts into their correct locations
# 
# Otherwise a if one them is partially empty, the following input section
# can end up in the wrong place.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.968
# [PATCH] init sighand in m68knommu init_task
# 
# Add initialization of init_sighand for m68knommu architectures.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.969
# [PATCH] add exception table support for m68knommu architecture
# 
# This patch adds exception table support for the m68knommu architecture.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.970
# [PATCH] m68knommu cacheflush.h cleanup
# 
# This patch overhauls the cache support routines for the m68knommu
# architecture. It removes depricated functions, and fixes those required
# to operate as per Documentation/cachetlb.txt.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.971
# [PATCH] fixup use of sighand in m68knommu signal.c
# 
# This patch fixes the use of sighand for the m68knommu architecture.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.972
# [PATCH] bounds check and no argv/envp support for binfmt_flat load
# 
# This patch to the MMUless flat loader does 2 important things:
# 
# 1. Allow for architectures that do not want argv and envp on
#    the initial process stack (v850 is an example of this)
# 2. Does some bounds checking on the zipped flat header when
#    processing it.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.973
# [PATCH] add extable.c to Makefile for m68knommu architecture
# 
# Add exception table support to Makefile build list for m68knommu.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.974
# [PATCH] fix m68knommu/ColdFire serial port hang
# 
# This patches fixes a serial port "hang" on the m68knommu ColdFire
# serial driver. It was erroneoulsy looking for a state bit that
# is never set.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.975
# [PATCH] add m68knommu serial console support into tty_io.c
# 
# This patch initializes the m68knommu specific serial drivers (68328serial.c,
# mcfserial.c and 68360serial.c) when used as consoles.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.976
# [PATCH] add missing m68knommu/68VZ328/ucdimm/config.c
# 
# This adds the missing config.c file for the m68knommu/68VZ328/ucdimm
# target.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.977
# [PATCH] reformat m68knommu 68360/uCquicc crt0_rom.S
# 
# This patch reformats the 68360 crt_rom.S file to make it consistent
# with the other m68knommu assembler files, and generally to good
# style standards :-)
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.978
# [PATCH] create common vector setup code for m68knommu/ColdFire
# 
# This patch creates a common set of vector code for the ColdFire
# sub-architecture of the m68knommu architecture. The basic setup
# code for all ColdFire CPU's is the same. Some more patches will
# follow this that remove theis common code from each of the
# ColdFire CPU configs.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.979
# [PATCH] reformat m68knommu 68328/pilot crt0_rom.S
# 
# This patch reformats the 68328/pilot crt_rom.S file to make it consistent
# with the other m68knommu assembler files, and generally to good style
# standards :-)
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.980
# [PATCH] create an architecture specific flat header for v850
# 
# This patch adds a v850 architecture specific flat file header.
# It supports the stack layout define needed by the flat format
# load binfmt_flat.c (for MMUless CPU's).
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.981
# [PATCH] include the architecture flat file header in common flat header
# 
# This patch adds support into the common flat.h header to include
# the architecture specific flat.h header. This is modelled on the
# same scheme as the elf include header file support.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.982
# [PATCH] inline unsued functions for MMUless configuration
# 
# This patch adds inline versions of init_emergency_isa_pool() and
# blk_queue_bounce() for MMUless builds. This patch was originally
# from Christoph Hellwig, as part of the MMUless merge.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.983
# [PATCH] reformat m68knommu 68360/uCquicc crt0_ram.S
# 
# This patch reformats the 68360 crt_ram.S file to make it consistent
# with the other m68knommu assembler files, and generally to good
# style standards :-)
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.984
# [PATCH] use local RODATA setup for m68knommu linker script
# 
# This patch removes the use of the common RODATA define in the m68knommu
# architecture. It cannot be used the same way for the m68knommu target.
# For starters just inserting it here is syntactically wrong. All the read
# only parts are grouped into a single "text" segment, and this is the root
# cause of the problem. So for the m68knommu arch it makes sense to not
# use the generic RODATA setup, but to list them locally.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.985
# [PATCH] clean up compiler warnings in m68knommu machdep.h
# 
# This patch includes seq_file.h in the m68knommu machdep.h header.
# Cleans up warnings caused by function prototypes.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.986
# [PATCH] remove duplicate memory size option in m68knommu Kconfig
# 
# This patch removes a duplicate menu option in the m68knommu Kconfig.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.987
# [PATCH] fix text and data sizing in MMUless task_nommu.c
# 
# This patch does a couple of things to the MMUless proc support:
# 
# 1. change current->sig to current->sighand
# 2. initialize vsize var in task_vsize() function
# 3. correctly set *text and *data values in task_vsize() function
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.988
# [PATCH] create an architecture specific flat header for m68knommu
# 
# Add a per-architecture flat.h flat format executable header. The idea is
# to support the different options required in a clean way. For starters
# we need to be able to configure the initial stack layout, and this
# differs for different CPU types.
# 
# This first patch adds the header for the m68knommu architecture.
# --------------------------------------------
# 03/02/18	gerg@snapgear.com	1.989
# [PATCH] add missing page_referenced() for MMUless configs
# 
# This patch adds the missing page_reference() macro for the no swap
# case. With no rmap this is trivially a call to TestClearPageReferenced().
# --------------------------------------------
# 03/02/18	Petri.Koistinen@iki.fi	1.990
# [PATCH] update README file to current realities.
# 
# Document "patch -p1" behaviour of modern patches, and remove make dep
# phase that isn't needed any more.
# --------------------------------------------
# 03/02/18	rth@kanga.twiddle.net	1.991
# Merge ssh://are/BK/axp-2.5
# into kanga.twiddle.net:/home/rth/linux/axp-2.5
# --------------------------------------------
# 03/02/18	sfr@canb.auug.org.au	1.990.1.1
# [COMPAT]: compat_sys_futex sparc64.
# --------------------------------------------
# 03/02/18	davem@nuts.ninka.net	1.990.1.2
# [SPARC]: Add timer_t and clockid_t.
# --------------------------------------------
# 03/02/19	rob@osinvestor.com	1.990.1.3
# [SPARC] Fix compilation of sunsu.c and sunzilog.c
# --------------------------------------------
# 03/02/19	paulus@samba.org	1.990.2.1
# PPC32: add system calls for POSIX timer stuff
# --------------------------------------------
# 03/02/19	paulus@samba.org	1.990.2.2
# PPC32: provide __ide_mm_insw etc.
# --------------------------------------------
# 03/02/19	paulus@samba.org	1.990.2.3
# PPC32: Add definition of ndelay()
# --------------------------------------------
# 03/02/19	hch@lab343.munich.sgi.com	1.990.3.1
# Merge http://linux.bkbits.net/linux-2.5
# into lab343.munich.sgi.com:/home/hch/repo/bkbits/linux-2.5
# --------------------------------------------
# 03/02/19	akpm@digeo.com	1.990.4.1
# [PATCH] posix-timers: fix callback address truncation
# 
# Casting a 64-bit address to int, then to unsigned long will truncate it.
# --------------------------------------------
# 03/02/19	tinglett@vnet.ibm.com	1.914.1.40
# ignore files for new zImage build
# --------------------------------------------
# 03/02/19	lord@sgi.com	1.990.3.2
# [XFS] cleanup delayed allocate write path a little and fix some
# small bugs in there.
# 
# SGI Modid: 2.5.x-xfs:slinx:138445a
# --------------------------------------------
# 03/02/19	lord@sgi.com	1.990.3.3
# [XFS] fix a couple of memory leaks found by stanford checker
# 
# SGI Modid: 2.5.x-xfs:slinx:138812a
# --------------------------------------------
# 03/02/19	hch@sgi.com	1.990.3.4
# [XFS] make pagebuf_delwri_queue static
# 
# SGI Modid: 2.5.x-xfs:slinx:138828a
# --------------------------------------------
# 03/02/19	nathans@sgi.com	1.990.3.5
# [XFS] Extra check on the mount path - ensure we don't attempt to mount XFS fs's
# with sector sizes smaller than those the device supports.  Tripped a BUG
# in pagebuf, should now be resolved.
# 
# SGI Modid: 2.5.x-xfs:slinx:139328a
# --------------------------------------------
# 03/02/19	kaos@sgi.com	1.990.3.6
# [XFS] XFS patches from 2.5.60-mm1
# 
# SGI Modid: 2.5.x-xfs:slinx:139330a
# --------------------------------------------
# 03/02/19	overby@sgi.com	1.990.3.7
# [XFS] fix one more set of transaction callback ordering issues,
# this was always there, but exposed by the last change in
# this area and made much more likely.
# 
# SGI Modid: 2.5.x-xfs:slinx:139655a
# --------------------------------------------
# 03/02/19	sandeen@sgi.com	1.990.3.8
# [XFS] Remove unused init_spinlock #define
# 
# SGI Modid: 2.5.x-xfs:slinx:139854a
# --------------------------------------------
# 03/02/19	rth@twiddle.net	1.990.4.2
# [PATCH] eliminate warnings in generated module files
# 
# The compiler.h fragment should describe the problem well enough.
# --------------------------------------------
# 03/02/19	ambx1@neo.rr.com	1.990.4.3
# Preparations and Cleanups
# 
# Required for the remaining patches in this series.
# --------------------------------------------
# 03/02/19	ambx1@neo.rr.com	1.990.4.4
# This patch contains an improved resource management algorithm.  It is 
# capable of resolving nearly any conflict between two or more PnP devices.
# It also contains better error reporting and a manual override capability.
# --------------------------------------------
# 03/02/19	ambx1@neo.rr.com	1.990.4.5
# Moves the resource parsing functions to a new location "support.c".  These
# resource parsing functions contain many improvements including the ability
# to set resources according to actual value rather than dependent functions.
# The interface changes will be able to take advantage of this.
# --------------------------------------------
# 03/02/19	ambx1@neo.rr.com	1.990.4.6
# Interface Updates
# 
# Includes the ability to report exactly where conflicts are occuring and 
# several set resource improvements.
# --------------------------------------------
# 03/02/19	ambx1@neo.rr.com	1.990.4.7
# ISAPnP Updates
# 
# Adds support for reading currently set resources.  Also a few other updates.
# --------------------------------------------
# 03/02/19	hch@sgi.com	1.990.3.9
# [XFS] insert dirty buffers at the tail of the inode queue
# 
# SGI Modid: 2.5.x-xfs:slinx:139992a
# --------------------------------------------
# 03/02/19	hch@sgi.com	1.990.3.10
# [XFS] Under heavy load, there are not enough hash buckets to deal with
# the number of metadata buffers. Use the same techniques as the
# regular linux buffer cache here.
# 
# use more hash buckets for holding xfs metadata, and use the same
# hash algorithm as the regular buffer cache.
# 
# SGI Modid: 2.5.x-xfs:slinx:139997a
# --------------------------------------------
# 03/02/19	tinglett@vnet.ibm.com	1.914.1.41
# Cset exclude: tinglett@vnet.ibm.com|ChangeSet|20030207200510|30566
# --------------------------------------------
# 03/02/19	ambx1@neo.rr.com	1.990.4.8
# PnPBIOS Updates
# 
# Fixes a very tricky GPF bug that caused crashes on a few buggy systems,
# especially laptops.  For those interested, PnPBIOS now reserves 
# segement 0x40 before any call.  Also it updates the driver to use the
# new parsing functions.
# --------------------------------------------
# 03/02/19	ambx1@neo.rr.com	1.990.4.9
# Trivial Card Service Fix
# 
# This was pointed out by Ruslan Zakirov.
# --------------------------------------------
# 03/02/19	ambx1@neo.rr.com	1.990.4.10
# Radio-Cadet PnP Update
# 
# Converts the Radio-Cadet driver to the new PnP API.
# --------------------------------------------
# 03/02/19	ambx1@neo.rr.com	1.990.4.11
# IDE PnP Update
# 
# Updates the IDE PnP driver to the new PnP API.
# --------------------------------------------
# 03/02/19	ambx1@neo.rr.com	1.990.4.12
# Trivial C99 Update
# 
# Patch from Art Haas.
# --------------------------------------------
# 03/02/19	ambx1@neo.rr.com	1.990.4.13
# PnP Bug Fixes
# --------------------------------------------
# 03/02/19	ambx1@neo.rr.com	1.990.4.14
# OSS Sound Blaster Update from Paul Laufer
# --------------------------------------------
# 03/02/19	hch@hera.kernel.org	1.990.3.11
# Merge
# --------------------------------------------
# 03/02/19	rth@kanga.twiddle.net	1.992
# [ALPHA] Implement ndelay.
# --------------------------------------------
# 03/02/19	rth@kanga.twiddle.net	1.993
# [ALPHA] Collection of warning fixes.
# --------------------------------------------
# 03/02/19	rth@kanga.twiddle.net	1.994
# [ALPHA] Turn on -Werror in alpha subdirectories.
# --------------------------------------------
# 03/02/19	rth@kanga.twiddle.net	1.995
# [ALPHA] Use more compiler builtins instead of inline assembly.
# --------------------------------------------
# 03/02/19	rth@kanga.twiddle.net	1.996
# Merge kanga.twiddle.net:/home/rth/linux/linus-2.5
# into kanga.twiddle.net:/home/rth/linux/axp-2.5
# --------------------------------------------
# 03/02/20	paulus@samba.org	1.990.2.4
# Merge samba.org:/home/paulus/kernel/linux-2.5
# into samba.org:/home/paulus/kernel/for-linus-ppc
# --------------------------------------------
# 03/02/19	yoshfuji@linux-ipv6.org	1.914.178.3
# [AF_KEY]: Add missing credit.
# --------------------------------------------
# 03/02/19	yoshfuji@linux-ipv6.org	1.914.178.4
# [NET]: Convert dst->{input,output}() fully to dst_{input,output}().
# --------------------------------------------
# 03/02/19	mk@linux-ipv6.org	1.914.178.5
# [IPSEC]: Add missing credit and include to xfrm_user ipv6 changes.
# --------------------------------------------
# 03/02/19	linux-bt.adm@hostme.bitkeeper.com	1.990.5.1
# Merge bk://linux.bkbits.net/linux-2.5
# into hostme.bitkeeper.com:/ua/repos/l/linux-bt/bt-2.5
# --------------------------------------------
# 03/02/19	davem@nuts.ninka.net	1.990.1.4
# [SOUND]: ac97_codec.c needs linux/pci.h
# --------------------------------------------
# 03/02/19	davem@nuts.ninka.net	1.990.1.5
# [SPARC]: Fixup asm/ide.h headers for Alans recent IDE merge.
# --------------------------------------------
# 03/02/19	davem@nuts.ninka.net	1.914.178.6
# [IPSEC]: Move xfrm6 policy code to net/ipv4/xfrm_policy.c
# --------------------------------------------
# 03/02/19	davem@nuts.ninka.net	1.914.178.7
# [IPSEC]: Export xfrm6 type registry interfaces.
# --------------------------------------------
# 03/02/19	davem@nuts.ninka.net	1.914.178.8
# [IPSEC]: Remove xfrm6 exports from ipv6_syms.c
# --------------------------------------------
# 03/02/20	anton@samba.org	1.990.6.1
# Merge samba.org:/scratch/anton/linux-2.5
# into samba.org:/scratch/anton/sfr
# --------------------------------------------
# 03/02/19	davem@kernel.bkbits.net	1.990.7.1
# Merge davem@nuts.ninka.net:/home/davem/src/BK/net-2.5
# into kernel.bkbits.net:/home/davem/net-2.5
# --------------------------------------------
# 03/02/19	davem@nuts.ninka.net	1.990.1.6
# [SPARC64]: oprofile/timer_int.c needs linux/profile.h
# --------------------------------------------
# 03/02/19	davem@kernel.bkbits.net	1.990.1.7
# Merge davem@nuts.ninka.net:/home/davem/src/BK/sparc-2.5
# into kernel.bkbits.net:/home/davem/sparc-2.5
# --------------------------------------------
# 03/02/19	zaitcev@redhat.com	1.990.8.1
# [SPARC]: Kconfig help update.
# --------------------------------------------
# 03/02/19	zaitcev@redhat.com	1.990.8.2
# [SPARC]: Add rtc_lock.
# --------------------------------------------
# 03/02/19	davem@kernel.bkbits.net	1.990.1.8
# Merge davem@nuts.ninka.net:/home/davem/src/BK/sparc-2.5
# into kernel.bkbits.net:/home/davem/sparc-2.5
# --------------------------------------------
# 03/02/19	torvalds@home.transmeta.com	1.990.1.9
# Merge bk://kernel.bkbits.net/davem/sparc-2.5
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/19	torvalds@home.transmeta.com	1.990.1.10
# Merge master.kernel.org:/home/hch/BK/xfs/linux-2.5
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/19	torvalds@home.transmeta.com	1.990.1.11
# Merge bk://cifs.bkbits.net/linux-2.5cifs
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/19	torvalds@home.transmeta.com	1.997
# Merge bk://are.twiddle.net/axp-2.5
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/19	hch@sgi.com	1.998
# [PATCH] i2c sanity
# 
# small updates to bring us nearer the lm_Sensors CVS (docs, comments,
# missing statics, named initializers).  I still need to review their
# actual code changes before submitting those..
# --------------------------------------------
# 03/02/19	hch@sgi.com	1.999
# [PATCH] get rid of some kdevname abuse
# 
# Use cdevname instead in the serial driver printk cut & pasted into about
# a dozend places.
# --------------------------------------------
# 03/02/19	hch@lst.de	1.1000
# [PATCH] remove some dead mtrr code
# 
# This patch removes the devfs interface code in mtrr that has been
# stubbed out by an ifdef forever.  It's one of the few remaining users
# of regular files on devfs so there's some urge for me to get rid of it :)
# --------------------------------------------
# 03/02/19	hch@sgi.com	1.1001
# [PATCH] kill EXPORT_NO_SYMBOLS
# 
# it's a noop in 2.5 now that the behvaiour of implicitly exporting
# all symbols is gone.
# --------------------------------------------
# 03/02/19	torvalds@home.transmeta.com	1.1002
# Add doublefault handling with a task gate.
# 
# This potentially helps debugging, since otherwise a double fault
# would generate a triple fault and then reboot the machine. Now
# instead it can print out a note about where the problem happened,
# unless all the kernel data structures are truly buggered.
# --------------------------------------------
# 03/02/19	maxk@qualcomm.com	1.990.5.2
# [Bluetooth] 
# Cleanup and fix __init and __exit functions.
# /proc/bluetooth initialization fixes.
# --------------------------------------------
# 03/02/19	maxk@qualcomm.com	1.990.5.3
# Merge bk://linux-bt.bkbits.net/marcel-2.5
# into qualcomm.com:/usr/src/linux-2.5
# --------------------------------------------
# 03/02/19	chas@locutus.cmf.nrl.navy.mil	1.1003
# [ATM]: use sock timestamp
# --------------------------------------------
# 03/02/19	hirofumi@mail.parknet.co.jp	1.1004
# [IPV4]: rt_cache_stat initialization fix.
# 
# This patch adds initialization for forgotten rt_cache_stat.
# However, kmalloc_percpu() may need things like kmalloc_percpu_zeroed().
# --------------------------------------------
# 03/02/19	sri@us.ibm.com	1.1005
# [IPV4/IPV6]: Fix to avoid overriding TCP/UDP with a new protocol of same type.
# 
# Registering a new protocol of type SOCK_STREAM with a protocol value other
# than IPPROTO_TCP will override TCP if the application passes 0 as the protocol
# to the socket() call.
# socket(AF_INET, SOCK_STREAM, 0)
# I guess many applications follow this syntax as they assume TCP is the default
# protocol for SOCK_STREAM type.
# The same holds true for SOCK_DGRAM type sockets assuing UDP as the default.
# 
# This is due to the insertion of a new inet_protosw entry into the inetsw list
# of a particular type at the head of the list. inet_create() uses the first
# entry in the list if a wild-card protocol is passed.
# 
# The following patch fixes the insertion of a new entry so that it is added
# after the last permanent entry in the list. This makes sure that the new 
# entries do not override any existing permanent entries.
# --------------------------------------------
# 03/02/19	ahaas@airmail.net	1.1006
# [PATCH] C99 initializer for net/ipv6/icmp.c
# --------------------------------------------
# 03/02/19	ahaas@airmail.net	1.1007
# [PATCH] C99 initializer for net/rose/sysctl_net_rose.c
# --------------------------------------------
# 03/02/19	ahaas@airmail.net	1.1008
# [PATCH] C99 initializer for net/netrom/sysctl_net_netrom.c
# --------------------------------------------
# 03/02/19	ahaas@airmail.net	1.1009
# [PATCH] C99 initializer for net/rxrpc/sysctl.c
# --------------------------------------------
# 03/02/19	davem@nuts.ninka.net	1.1002.1.1
# [SPARC64]: Be like Alpha and turn on -Werror in sparc64 subdirectories.
# --------------------------------------------
# 03/02/20	levon@movementarian.org	1.1002.2.1
# [PATCH] oprofile author needs to learn C
# 
# Manifested as X profile appearing as /dev/mem ...
# --------------------------------------------
# 03/02/20	akpm@digeo.com	1.1002.2.2
# [PATCH] Keep interrupts enabled in exit path
# 
# We are leaving local interrupts disabled coming out of exit_notify().
# 
# But we are about to call wait_task_inactive() which spins, waiting for
# another CPU to end a task.  If that CPU has issued smp_call_function() to
# this CPU, deadlock.
# 
# So the patch enables interrupts again before returning from exit_notify().
# 
# Also, exit_notify() returns with preemption disabled, so there is no
# need to perform another preempt_disable() in do_exit().
# --------------------------------------------
# 03/02/20	akpm@digeo.com	1.1002.2.3
# [PATCH] Don't call mmdrop under a spinlock
# 
# We're calling mmdrop() under spin_lock_irq(&rq->lock).  But mmdrop
# calls vfree(), which calls smp_call_function().
# 
# It is not legal to call smp_call_function() with irq's off.  Because
# another CPU may be running smp_call_function() against _this_ CPU, which
# deadlocks.
# 
# So the patch arranges for mmdrop() to not be called under
# spin_lock_irq(&rq->lock).
# --------------------------------------------
# 03/02/20	haveblue@us.ibm.com	1.1002.2.4
# [PATCH] make io_apic.c use named initializers
# 
# Bill Irwin was talking about hw_interrupt_type.set_affinity and kirq.
# When I went looking, I failed to find this initialization.
# 
# Here are some nice, easy-to-find, named initializers.
# --------------------------------------------
# 03/02/20	greg@kroah.com	1.1002.3.1
# [PATCH] PCI: remove large stack usage in pci_do_scan_bus()
# --------------------------------------------
# 03/02/20	greg@kroah.com	1.1002.3.2
# [PATCH] PCI i386: remove large stack usage in pci_sanity_check()
# --------------------------------------------
# 03/02/20	greg@kroah.com	1.1002.3.3
# [PATCH] PCI i386: remove large stack usage in pcibios_fixup_peer_bridges()
# --------------------------------------------
# 03/02/21	paulus@samba.org	1.1002.2.5
# Merge samba.org:/home/paulus/kernel/linux-2.5
# into samba.org:/home/paulus/kernel/for-linus-ppc
# --------------------------------------------
# 03/02/20	louis.zhuang@linux.co.intel.com	1.1002.3.4
# [PATCH] PCI: list code cleanup
# 
# Cleans up the list handling in a few places within the pci core.
# --------------------------------------------
# 03/02/20	gregkh@kernel.bkbits.net	1.1002.4.1
# Merge
# --------------------------------------------
# 03/02/21	akpm@digeo.com	1.990.6.2
# ppc64: Someone removed NR_syscalls from <linux/sys.h>
# --------------------------------------------
# 03/02/21	akpm@digeo.com	1.990.6.3
# ppc64: fix the build for posix timer changes
# --------------------------------------------
# 03/02/21	anton@samba.org	1.990.6.4
# ppc64: fix compile warning
# --------------------------------------------
# 03/02/20	torvalds@home.transmeta.com	1.1002.5.1
# Fix x86 "switch_to()" to properly set the previous task information,
# which is needed to keep track of process usage counts correctly and
# efficiently.
# --------------------------------------------
# 03/02/20	bde@bwlink.com	1.1002.1.2
# [SPARC64]: Fix ocndition code handling in do_rt_sigreturn.
# --------------------------------------------
# 03/02/20	chas@cmf.nrl.navy.mil	1.1010
# [ATM]: Add MAINTAINERS entry.
# --------------------------------------------
# 03/02/21	anton@samba.org	1.1002.6.1
# Merge samba.org:/scratch/anton/linux-2.5
# into samba.org:/scratch/anton/sfr
# --------------------------------------------
# 03/02/20	torvalds@home.transmeta.com	1.1002.5.2
# Fix "make clean" to remove scripts/elfconfig.h
# --------------------------------------------
# 03/02/21	paulus@samba.org	1.1002.2.6
# Merge samba.org:/home/paulus/kernel/linux-2.5
# into samba.org:/home/paulus/kernel/for-linus-ppc
# --------------------------------------------
# 03/02/21	jejb@raven.il.steeleye.com	1.1002.7.1
# Merge raven.il.steeleye.com:/home/jejb/BK/scsi-error-2.5
# into raven.il.steeleye.com:/home/jejb/BK/scsi-error-new-2.5
# --------------------------------------------
# 03/02/21	andmike@us.ibm.com	1.1002.7.2
# [PATCH] scsi_error update take 2
# 
# This is an update of a previous patch I posted.
# http://marc.theaimsgroup.com/?l=linux-scsi&m=104495114103628&w=2
# 
# This patch is against scsi-misc-2.5
# 
# The updates from the last patch include:
# 	- Names changes:
# 		eh_cmd_list => eh_cmd_q
# 		eh_list => eh_entry
# 
# 	- Move shost->in_recovery = 0
# 
# 	- Switch from scsi_retry_command to scsi_queue_insert for retry
# 	  to solve fast completions / serial start of retries.
# 
# 	- Use list_splice_init in scsi_unjam_host.
# --------------------------------------------
# 03/02/21	hch@lst.de	1.1002.5.3
# [PATCH] handles possible failures in scsi initialization
# 
# .. and unwind properly to avoid leaks
# --------------------------------------------
# 03/02/21	hch@lst.de	1.1002.5.4
# [PATCH] ]PATCH] two new device list entries
# 
# The NEC one is from the PC98 folks, the Sun one from feral's isp driver
# --------------------------------------------
# 03/02/21	hch@lst.de	1.1002.5.5
# [PATCH] wd7000 updates
# 
# Move the host template to the actual source file and get rid of wd7000.h
# --------------------------------------------
# 03/02/21	hch@lst.de	1.1002.5.6
# [PATCH] remove an escaped __MOD_DEC_USE_COUNT
# 
# we should be using module_put really, __MOD_DEC_USE_COUNT will die soon
# --------------------------------------------
# 03/02/21	hch@lst.de	1.1002.5.7
# [PATCH] eata_pio updates
# 
# (1) don't include eata_dma_proc.h - it's gone and we don't need it
# (2) remove eata_pio_proc.c - it's #included in the main source file,
#     so the functions can be there aswell
# (3) move host template away from eata_pio.h
# 
# 
# ===== drivers/scsi/eata_pio.c 1.4 vs edited =====
# --------------------------------------------
# 03/02/21	dougg@torque.net	1.1002.5.8
# [PATCH] scsi_mid_low_api.txt
# 
# Attached is an update for this document following on from
# the changes that Christoph made around bk2 (changing
# scsi_set_pci_device() to scsi_set_device() ).
# --------------------------------------------
# 03/02/21	jejb@raven.il.steeleye.com	1.1002.5.9
# Merge raven.il.steeleye.com:/home/jejb/BK/scsi-error-2.5
# into raven.il.steeleye.com:/home/jejb/BK/scsi-misc-2.5
# --------------------------------------------
# 03/02/21	pam.delaney@lsil.com	1.1002.8.1
# [PATCH] Fusion Driver 2.05.00.03 against 2.5.62bk3
# 
# Please accept this large patch against 2.5.62bk4 to update the
# Fusion-MPT driver from 2.03.01.01 to 2.05.00.03.
# 
# This version contains full 2.5 kernel support (add, configuration &
# removal of disks, new module hooks), performance enhancements, removal
# of obsolete code that is 2.4 (or earlier) specific and removal of blank
# spaces at end of lines.  Tested overnight on 2.5.62bk3 and ran some
# tests against bk4 this morning on both machines.  Things appear to be
# fine - have not tested the two failure conditions today.
# 
# The driver has been tested on two different platforms:
# 
# - P4 4-processor
#    o boot controller
#    o built into kernel
#    o disk add, configure, remove
#    o bus, target reset
#    o device offline cases
#    o cross channel I/O stress tests w/ Fibre and SCSI
# 
#  - Athlon uniprocessor, IDE boot
#    o Ran a test that repeatedly loads the driver, mounts disks, runs a
#      short I/O test (20mins) then unload the driver components in a
#      different order
# 
# Failures:
#    o Unable to boot if boot controller is built as a module - pivot_root
#      fails (Happens if IDE or SCSI boot)
# 
#    o Problems when formatting large SCSI disks.  On P4 w/ 2.5.60, there
#      were no difficulties formatting a 36GB disk.  On Athlon, mkfs.ext2
#      would never send a write command to the driver (verified w/ SCSI
#      trace and driver debug).  Reads completed successfully.  mkfs.ext2
#      would not exit and is shown as a running process.
# 
#      Smaller partitions were formatted correctly.  W/ 2.5.62 failures on
#      P4 and Athlon.
# 
#      Same error with other drivers. 100% reproducible.
# --------------------------------------------
# 03/02/21	torvalds@home.transmeta.com	1.1002.8.2
# We don't need to wait for task in-activity in release_task() any more,
# since we now properly reference-count the allocations and thus can't
# be freeing the thread structures from underneath the task running on
# another CPU.
# 
# Move "free_uid(p->user)" and "security_task_free()" to __put_task_struct(),
# so that we're guaranteed to always have a user structure pointer.
# --------------------------------------------
# 03/02/21	jgarzik@pobox.com	1.1002.5.10
# [PATCH] report luns default
# 
# dledford is my cube-mate, and always recommends that I enable this,
# so...
# 
# ===== drivers/scsi/Kconfig 1.14 vs edited =====
# --------------------------------------------
# 03/02/21	hch@lst.de	1.1002.5.11
# [PATCH] fix that devfs mess
# --------------------------------------------
# 03/02/21	hch@sgi.com	1.1002.8.3
# [PATCH] try_module_get(THIS_MODULE) is bogus
# 
# In most cases the fix is to add an struct module * member to the operations
# vector instead and manipulate the refcounts in the callers context.
# 
# For the ALSA cases it was completly superflous (when will people get it that
# using an exported symbol will make it's module unloadable?..)
# --------------------------------------------
# 03/02/21	hch@sgi.com	1.1002.8.4
# [PATCH] fix module refcounting of pcmcia socket drivers
# --------------------------------------------
# 03/02/21	jejb@raven.il.steeleye.com	1.1002.5.12
# Add back SCSI subsystem initialisation prints
# --------------------------------------------
# 03/02/21	stelian@popies.net	1.1002.8.5
# [PATCH] sonypi and input subsystem
# 
# This makes the sonypi driver forward the VAIO jog-dial events directly
# to the input subsystem as mouse wheel events.  This way one is not
# required anymore to have an external daemon polling /dev/sonypi if
# interested only in jogdial events.
# --------------------------------------------
# 03/02/21	stelian@popies.net	1.1002.8.6
# [PATCH] meye suspend/resume capabilities
# 
# This adds suspend/resume capabilities to the meye driver.
# --------------------------------------------
# 03/02/21	stelian@popies.net	1.1002.8.7
# [PATCH] use correct gcc flags when compiling for Crusoe
# 
# This makes use of 'check_gcc' facility when compiling for a Crusoe
# processor in order to choose the correct -falign or -malign compiler
# flags.
# --------------------------------------------
# 03/02/21	torvalds@penguin.transmeta.com	1.1002.9.1
# Merge bk://ppc.bkbits.net/for-linus-ppc
# into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
# --------------------------------------------
# 03/02/21	torvalds@penguin.transmeta.com	1.1002.9.2
# Merge bk://linux-pnp.bkbits.net/linus-2.5
# into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
# --------------------------------------------
# 03/02/21	torvalds@penguin.transmeta.com	1.1002.9.3
# Merge bk://kernel.bkbits.net/gregkh/linux/pci-2.5
# into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
# --------------------------------------------
# 03/02/21	akpm@digeo.com	1.1002.9.4
# [PATCH] pnp compile fix
# 
# fix two tpyos
# --------------------------------------------
# 03/02/21	bgerst@didntduck.org	1.1002.9.5
# [PATCH] Use mempool_alloc/free_slab
# 
# Convert fs/bio.c and fs/jfs/jfs_metapage.c to use the mempool_alloc_slab
# and mempool_free_slab helper functions.
# --------------------------------------------
# 03/02/21	bgerst@didntduck.org	1.1002.9.6
# [PATCH] Clean up list head usage in sysrq.c
# 
# Use list_for_each_entry() instead of open code.
# --------------------------------------------
# 03/02/21	hch@lst.de	1.1002.5.13
# drop scsi_register_blocked_host()
# --------------------------------------------
# 03/02/21	hch@lst.de	1.1002.5.14
# [PATCH] move over exposing host attributes from sg/procfs to sysfs
# 
# This patch moves over printing of the various struct Scsi_Host
# attributes from procfs functions in the sg driver to sysfs.
# 
# Not only is this the much more logical place for them, but with some
# more work on the pcmcia drivers this will allow us to make
# scsi_host_get_next() private to the midlayer for implementing
# refcounting and cleaning up locking in that area.
# --------------------------------------------
# 03/02/21	hch@lst.de	1.1002.5.15
# [PATCH] Coding Style police for scsi_error.c
# --------------------------------------------
# 03/02/22	paulus@samba.org	1.1002.2.7
# PPC32: Make switch_to return the previous task in the `last' argument
# --------------------------------------------
# 03/02/22	paulus@samba.org	1.1002.2.8
# Merge samba.org:/home/paulus/kernel/linux-2.5
# into samba.org:/home/paulus/kernel/for-linus-ppc
# --------------------------------------------
# 03/02/21	torvalds@home.transmeta.com	1.1002.9.7
# Merge bk://linux-bt.bkbits.net/bt-2.5
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/21	bgerst@didntduck.org	1.1002.9.8
# [PATCH] Trival patch to i386 enter_lazy_tlb()
# 
# Moves the #ifdef into the function to improve readability.
# --------------------------------------------
# 03/02/21	bgerst@didntduck.org	1.1002.9.9
# [PATCH] Remove checkhelp.pl and header.tk
# 
# Changes in the config system have obsoleted these files.
# --------------------------------------------
# 03/02/22	anton@samba.org	1.1002.10.1
# Merge samba.org:/scratch/anton/linux-2.5
# into samba.org:/scratch/anton/sfr
# --------------------------------------------
# 03/02/21	torvalds@home.transmeta.com	1.1002.2.9
# Merge bk://ppc.bkbits.net/for-linus-ppc
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/21	bgerst@didntduck.org	1.1002.2.10
# [PATCH] remove old double fault handler
# 
# Removes the now unused trap handler for double faults.  Also removes the
# never used handler for fpu not available.
# --------------------------------------------
# 03/02/21	bgerst@didntduck.org	1.1002.2.11
# [PATCH] Unused variable warning in ac97_codec.c
# 
# Kill unused variable.
# --------------------------------------------
# 03/02/21	bgerst@didntduck.org	1.1002.2.12
# [PATCH] Better test for GCC alignment options
# 
# Do the test for -falign-xxx vs. -malign-xxx only once.
# --------------------------------------------
# 03/02/22	anton@samba.org	1.1002.10.2
# ppc64: update for recent changes that require switch_to to return prev
# --------------------------------------------
# 03/02/21	jakub@redhat.com	1.1002.1.3
# [SPARC64]: Fix typo in sparc64_get_context (G7 register is saved wrongly).
# --------------------------------------------
# 03/02/21	bwa@us.ibm.com	1.1011
# [SCTP/IPV6]: Move sockaddr storage and in6addr_{any,loopback} to generic places.
# --------------------------------------------
# 03/02/22	anton@samba.org	1.1002.2.13
# Merge samba.org:/scratch/anton/linux-2.5
# into samba.org:/scratch/anton/sfr
# --------------------------------------------
# 03/02/22	anton@samba.org	1.1002.2.14
# ppc64: add some bluetooth ioctls and clean up some warnings
# --------------------------------------------
# 03/02/22	davem@nuts.ninka.net	1.1002.1.4
# [SPARC64]: Implement STICK synchronization using ia64 port algorithms.
# --------------------------------------------
# 03/02/22	anton@samba.org	1.1002.2.15
# ppc64: Add posix timer syscalls
# --------------------------------------------
# 03/02/22	anton@samba.org	1.1002.2.16
# Merge ppc64@brule.rchland.ibm.com:/home/tinglett/bk/for-linus-ppc64
# into samba.org:/scratch/anton/linux-2.5_ppc64_tmp
# --------------------------------------------
# 03/02/22	anton@samba.org	1.1002.2.17
# ppc64: zero all registers in ELF_PLAT_INIT now we dont in start_thread
# --------------------------------------------
# 03/02/22	anton@samba.org	1.1002.2.18
# ppc64: quieten new boot wrapper to match old 2.5 one.
# --------------------------------------------
# 03/02/22	anton@samba.org	1.1002.2.19
# ppc64: defconfig update
# --------------------------------------------
# 03/02/22	davem@kernel.bkbits.net	1.1002.1.5
# Merge davem@nuts.ninka.net:/home/davem/src/BK/sparc-2.5
# into kernel.bkbits.net:/home/davem/sparc-2.5
# --------------------------------------------
# 03/02/22	davem@kernel.bkbits.net	1.1012
# Merge davem@nuts.ninka.net:/home/davem/src/BK/net-2.5
# into kernel.bkbits.net:/home/davem/net-2.5
# --------------------------------------------
# 03/02/22	jejb@malley.(none)	1.1002.5.16
# Remove dead code from 53c700
# --------------------------------------------
# 03/02/22	jejb@malley.(none)	1.1002.5.17
# Update 53c700 error handling
# --------------------------------------------
# 03/02/22	jejb@malley.(none)	1.1002.5.18
# Correct uninitialised timer in scsi_error.c
# --------------------------------------------
# 03/02/22	jejb@malley.(none)	1.1002.5.19
# update sim710.c for new eisa sysfs registration returns
# --------------------------------------------
# 03/02/22	jejb@raven.il.steeleye.com	1.1002.11.1
# Merge raven.il.steeleye.com:/home/jejb/BK/scsi-misc-2.5
# into raven.il.steeleye.com:/home/jejb/BK/scsi-for-linus-2.5
# --------------------------------------------
# 03/02/22	torvalds@home.transmeta.com	1.1013
# Merge bk://kernel.bkbits.net/davem/net-2.5
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/22	torvalds@home.transmeta.com	1.1014
# Merge http://ppc.bkbits.net/for-linus-ppc64
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/22	torvalds@home.transmeta.com	1.1015
# Merge http://linux-scsi.bkbits.net/scsi-for-linus-2.5
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/22	bgerst@didntduck.org	1.1016
# [PATCH] Fix up slabinfo code
# 
# Move printing the header to s_start, removing the need for the special
# pointer value.
# --------------------------------------------
# 03/02/22	bunk@fs.tum.de	1.1017
# [PATCH] remove an unneeded #if from net/ipv6/af_inet6.c
# 
# The patch below removes an unneeded #if from net/ipv6/af_inet6.c:
# - kernel 2.0 is too ancient to check for
# - the MODULE_* macros have empty definitions #if !MODULE
# --------------------------------------------
# 03/02/22	rmk@arm.linux.org.uk	1.1018
# [PATCH] Alternative tty fasync fix
# 
# Instead of detecting when filp->private_data becomes NULL in
# do_tty_hangup and check_tty_count, we remove the file descriptor
# from the list of descriptors associated with the tty.  We use the
# same method that dentry_open() uses.
# 
# (It also cleans that up to use a "file_kill()" instead of using a dummy
# "kill_list()" that leaves pointers to stale stack entries that are never
# used)
# 
# In addition, we change the for() loops into real list_for_each()
# or list_for_each_entry loops as appropriate.
# --------------------------------------------
# 03/02/22	torvalds@home.transmeta.com	1.1019
# Fix up incorrect __exit marking for SCSI functions that are called from
# non-exit code.
# --------------------------------------------
# 03/02/22	akpm@digeo.com	1.1020
# [PATCH] make drivers/pnp/interface.c compile
# 
# Older compilers require that automatic variable declarations appear at the
# start of a block.
# --------------------------------------------
# 03/02/22	ak@muc.de	1.1021
# [PATCH] x86-64 update for 2.5.62-bk4
# 
# This still has a few problems; e.g. posix-timers.c seems to be miscompiled
# by many x86-64 compilers when compiled with -O1. But overall it is better
# than before.
# 
#  - Disable numa again that was enabled by mistake
#  - Fix CPU detection in early boot. Force SSE when needed.
#  - Hack for nested NMIs.
#  - Fix typo in vsyscall code that lead to broken time reporting
#  - Merge with 2.5.62-bk4 (new switch_to, printk cleanups, new timer calls etc.)
#  - Fix bug in strace - don't assume syscall_trace doesn't clobber %rcx
#  - Fix gs load workaround
#  - Fix return value of ioperm (found by new LTP test)
#  - Remove some unecessary boot output
#  - Remove some obsolete code in setup.c
#  - Report more in /proc/cpuinfo, fix extended cpu family computation
#  - Fix thread_info access from interrupt/exception stacks - this
#    fixes many problems that especially showed on SMP (lost reschedule
#    interrupts etc.)
#  - Fix UP compilation
#  - Symlink hugetlbpage.c from i386
#  - Fix buggy lazy fpu handling
# --------------------------------------------
# 03/02/22	ak@muc.de	1.1022
# [PATCH] Fix some 64bit warnings
# 
# Fix some annoying warnings that happen on x86-64.
# 
#  - Predeclare pt_regs in binfmts.h.  For some reason it isn't included
#    implicitely there.
#  - use unsigned long, not long for interrupt flags in posix-timers.c
# --------------------------------------------
# 03/02/22	ak@muc.de	1.1023
# [PATCH] Allow xtime_lock declaration in arch specific code for x86-64
# 
# x86-64 vsyscalls require mapping the sequence number used by
# gettimeofday in a magic way, so that userland can access it via
# vsyscalls for user space time-of-day access.
# 
# Instead of putting the magic into generic code I just allowed to move it
# into architecture specific files.
# --------------------------------------------
# 03/02/22	ambx1@neo.rr.com	1.1024
# Large Stack Usage Fix
# 
# Reduces the stack memory usage in the following PnP Functions:
# pnp_printf
# pnp_set_current_resources
# pnp_manual_config_dev
# pnp_activate_dev
# --------------------------------------------
# 03/02/22	ambx1@neo.rr.com	1.1025
# Resource Management Performance Fix
# 
# Fixes a typo in pnp_check_*_conflicts functions.  Without this fix the
# resource algorithm will work but will take longer to assign resources.
# 
# Also contains some minor reordering in pnp_activate_dev.
# --------------------------------------------
# 03/02/22	rth@kanga.twiddle.net	1.1002.12.1
# [ALPHA] Fix typo in __kernel_cmpbge.
# --------------------------------------------
# 03/02/22	sam@ravnborg.org	1.1002.12.2
# [PATCH] Alpha CFLAGS fix
# 
# Hi Richard.
# 
# I noticed you have set -Werror in all alpha architecture
# specific makefiles - good initiative. I wish we could do that in general.
# 
# But the correct way to alter CFLAGS in kbuild makefiles is to use
# EXTRA_CFLAGS.
# The following patch fixes this.
# You could argue that this is a stylistic issue, but in this way
# you follow Documentation/kbuild/makefiles.txt
# 
# I stumbled over:
# EXTRA_AFLAGS := $(CFLAGS)
# I could not realise the purpose with this assignment, and I noticed
# that it did not include -Werror, becuse you did hat assignment in
# the following line.
# Wanted to inform you about it but I see no problem. It is just that
# I did not understand it.
# 
# In math-emu I see this:
# EXTRA_CFLAGS := -Iinclude/math-emu -w
# Grepping the src I see no reason to have the -Iinclude/math-emu
# Relevant files are prefixed with math-emu (soft-fp, single, double)
# I did not fix it, because I cannot compile alpha.
# 
# 	Sam (the Makefile nitpicker)
# 
# ===== arch/alpha/kernel/Makefile 1.24 vs edited =====
# --------------------------------------------
# 03/02/22	rth@kanga.twiddle.net	1.1002.12.3
# [ALPHA] More CFLAGS a-la Sam.
# --------------------------------------------
# 03/02/22	rth@kanga.twiddle.net	1.1002.12.4
# [ALPHA] Fix switch_to semantics wrt LAST.
# --------------------------------------------
# 03/02/22	rth@kanga.twiddle.net	1.1023.1.1
# Merge kanga.twiddle.net:/home/rth/linux/linus-2.5
# into kanga.twiddle.net:/home/rth/linux/axp-2.5
# --------------------------------------------
# 03/02/23	torvalds@home.transmeta.com	1.1026
# Merge bk://are.twiddle.net/axp-2.5
# into home.transmeta.com:/home/torvalds/v2.5/linux
# --------------------------------------------
# 03/02/23	rmk@arm.linux.org.uk	1.1027
# [PATCH] kernel/pm.c requires <linux/init.h>
# --------------------------------------------
# 03/02/23	rmk@arm.linux.org.uk	1.1028
# [PATCH] Remove dummy cb_config() and cb_release()
# 
# cb_config() and cb_release() are just simple dummy functions that are
# only used in the internals of the PCMCIA code.  We inline them where
# used.
# --------------------------------------------
# 03/02/23	rmk@arm.linux.org.uk	1.1029
# [PATCH] Remove unused "dev" argument from cb_setup_cis_mem
# 
# cb_setup_cis_mem doesn't reference the pci device.  Remove this unused
# argument.
# --------------------------------------------
# 03/02/23	rmk@arm.linux.org.uk	1.1030
# [PATCH] Remove "fn" argument from read_cb_mem()
# 
# read_cb_mem is only ever called with its "fn" argument set to zero.
# We therefore do not need to pass it.
# --------------------------------------------
# 03/02/23	rmk@arm.linux.org.uk	1.1031
# [PATCH] Remove pci_{read,write}[bwl]
# 
# cardbus.c uses its own names for our PCI config space functions.
# Make it use our names.
# --------------------------------------------
# 03/02/23	rmk@arm.linux.org.uk	1.1032
# [PATCH] Remove stack allocation of struct pci_dev
# 
# cb_alloc() allocated a pci_dev on the stack to access PCI space.  This
# is unnecessary since we have pci_bus_*_config_* functions.  Use these
# functions instead.
# --------------------------------------------
# 03/02/23	rmk@arm.linux.org.uk	1.1033
# [PATCH] Always re-read vendor for each function
# 
# We should probably always read the vendor ID from each function
# rather than assuming that it is identical to function 0.
# --------------------------------------------
# 03/02/23	ak@muc.de	1.1034
# [PATCH] Fix x86-64 loose ends
# 
#  - Make MTRR driver compatible with 2.4/x86-64 again.  This fixes an
#    endless loop in the XFree86 4.3pre server.
#  - Fix the boot code that rejected earlier: rewrote early CPU detection
#    and SSE is forced now
#  - Always force inlining in vsyscalls
# --------------------------------------------
# 03/02/23	linux@brodo.de	1.1035
# [PATCH] cpufreq: move Kconfig entries (Marc-Christian Petersen)
# 
# Move x86 CPU_FREQ config choices to extra file & menu. (Marc-Christian Petersen)
# --------------------------------------------
# 03/02/23	linux@brodo.de	1.1036
# [PATCH] cpufreq: x86 driver updates (speedstep, longrun, p4-clockmod)
# 
#  - switch the Intel x86 speedstep/Pentium 4/Xeon drivers and the
#    Transmeta Crusoe Longrun driver to use the advanced cpufreq_driver
#    registration process
#  - cleanups
#  - spelling fixes (Petri Koistinen) - thanks!
# --------------------------------------------
# 03/02/23	linux@brodo.de	1.1037
# [PATCH] pcmcia: add socket_offset for multiple pci_sockets, correct suspend&resume
# 
#  - suspend & remove for pci_socket was broken -- thanks to Paul
#    Mackerras for noting this
#  - to correctly initialize multiple pci_socket devices, a sock_offset is
#    needed.
#  - s_info doesn't need to be an array.
# --------------------------------------------
# 03/02/23	rusty@rustcorp.com.au	1.1038
# [PATCH] Enable signals for usermode helpers
# 
# Stelian Pop reported that all signals are blocked in processes
# execed from the kernel as usermode helpers.
# --------------------------------------------
#
diff -Nru a/CREDITS b/CREDITS
--- a/CREDITS	Sun Feb 23 22:25:25 2003
+++ b/CREDITS	Sun Feb 23 22:25:25 2003
@@ -2746,6 +2746,14 @@
 E: wsalamon@nai.com
 D: portions of the Linux Security Module (LSM) framework and security modules
 
+N: Duncan Sands
+E: duncan.sands@wanadoo.fr
+W: http://topo.math.u-psud.fr/~sands
+D: Alcatel SpeedTouch USB driver
+S: 69 rue Dunois
+S: 75013 Paris
+S: France
+
 N: Robert Sanders
 E: gt8134b@prism.gatech.edu
 D: Dosemu
diff -Nru a/Documentation/DocBook/kernel-hacking.tmpl b/Documentation/DocBook/kernel-hacking.tmpl
--- a/Documentation/DocBook/kernel-hacking.tmpl	Sun Feb 23 22:25:24 2003
+++ b/Documentation/DocBook/kernel-hacking.tmpl	Sun Feb 23 22:25:24 2003
@@ -993,25 +993,6 @@
    </para>
   </sect1>
 
-  <sect1 id="sym-exportnosymbols">
-   <title><symbol>EXPORT_NO_SYMBOLS</symbol>
-    <filename class=headerfile>include/linux/module.h</filename></title>
-
-   <para>
-    If a module exports no symbols then you can specify
-    <programlisting>
-EXPORT_NO_SYMBOLS;
-    </programlisting>
-    anywhere in the module.
-    In kernel 2.4 and earlier, if a module contains neither
-    <function>EXPORT_SYMBOL()</function> nor
-    <symbol>EXPORT_NO_SYMBOLS</symbol> then the module defaults to
-    exporting all non-static global symbols.
-    In kernel 2.5 onwards you must explicitly specify whether a module
-    exports symbols or not.
-   </para>
-  </sect1>
-
   <sect1 id="sym-exportsymbols-gpl">
    <title><function>EXPORT_SYMBOL_GPL()</function>
     <filename class=headerfile>include/linux/module.h</filename></title>
diff -Nru a/Documentation/DocBook/videobook.tmpl b/Documentation/DocBook/videobook.tmpl
--- a/Documentation/DocBook/videobook.tmpl	Sun Feb 23 22:25:27 2003
+++ b/Documentation/DocBook/videobook.tmpl	Sun Feb 23 22:25:27 2003
@@ -739,8 +739,6 @@
 MODULE_PARM(io, "i");
 MODULE_PARM_DESC(io, "I/O address of the card.");
 
-EXPORT_NO_SYMBOLS;
-
 int init_module(void)
 {
         if(io==-1)
diff -Nru a/Documentation/i2c/i2c-protocol b/Documentation/i2c/i2c-protocol
--- a/Documentation/i2c/i2c-protocol	Sun Feb 23 22:25:26 2003
+++ b/Documentation/i2c/i2c-protocol	Sun Feb 23 22:25:26 2003
@@ -52,10 +52,10 @@
 We have found some I2C devices that needs the following modifications:
 
   Flag I2C_M_NOSTART: 
-    In a combined transaction, no 'S Addr' is generated at some point.
-    For example, setting I2C_M_NOSTART on the second partial message
+    In a combined transaction, no 'S Addr Wr/Rd [A]' is generated at some
+    point. For example, setting I2C_M_NOSTART on the second partial message
     generates something like:
-      S Addr Rd [A] [Data] NA Wr [A] Data [A] P
+      S Addr Rd [A] [Data] NA Data [A] P
     If you set the I2C_M_NOSTART variable for the first partial message,
     we do not generate Addr, but we do generate the startbit S. This will
     probably confuse all other clients on your bus, so don't try this.
@@ -65,4 +65,12 @@
     need to emit an Rd instead of a Wr, or vice versa, you set this
     flag. For example:
       S Addr Rd [A] Data [A] Data [A] ... [A] Data [A] P
-                      
+
+  Flags I2C_M_IGNORE_NAK
+    Normally message is interrupted immediately if there is [NA] from the
+    client. Setting this flag treats any [NA] as [A], and all of
+    message is sent.
+    These messages may still fail to SCL lo->hi timeout.
+
+  Flags I2C_M_NO_RD_ACK
+    In a read message, master A/NA bit is skipped.
diff -Nru a/Documentation/i2c/smbus-protocol b/Documentation/i2c/smbus-protocol
--- a/Documentation/i2c/smbus-protocol	Sun Feb 23 22:25:26 2003
+++ b/Documentation/i2c/smbus-protocol	Sun Feb 23 22:25:26 2003
@@ -61,7 +61,7 @@
 This is the reverse of Read Byte: it sends a single byte to a device.
 See Read Byte for more information.
 
-S Addr Wr [A] Data NA P
+S Addr Wr [A] Data [A] P
 
 
 SMBus Read Byte Data
diff -Nru a/Documentation/i2c/summary b/Documentation/i2c/summary
--- a/Documentation/i2c/summary	Sun Feb 23 22:25:25 2003
+++ b/Documentation/i2c/summary	Sun Feb 23 22:25:25 2003
@@ -4,7 +4,7 @@
 =============
 
 I2C (pronounce: I squared C) is a protocol developed by Philips. It is a 
-slow two-wire protocol (10-100 kHz), but it suffices for many types of 
+slow two-wire protocol (10-400 kHz), but it suffices for many types of 
 devices.
 
 SMBus (System Management Bus) is a subset of the I2C protocol. Many
@@ -43,15 +43,15 @@
 
 Included Bus Drivers
 ====================
-Note that not only stable drivers are patched into the kernel by 'mkpatch'.
+Note that only stable drivers are patched into the kernel by 'mkpatch'.
 
 
 Base modules
 ------------
 
-i2c-core: The basic I2C code, including the /proc interface
-i2c-dev:  The /dev interface
-i2c-proc: The /proc interface for device (client) drivers
+i2c-core: The basic I2C code, including the /proc/bus/i2c* interface
+i2c-dev:  The /dev/i2c-* interface
+i2c-proc: The /proc/sys/dev/sensors interface for device (client) drivers
 
 Algorithm drivers
 -----------------
@@ -59,7 +59,7 @@
 i2c-algo-8xx:    An algorithm for CPM's I2C device in Motorola 8xx processors (NOT BUILT BY DEFAULT)
 i2c-algo-bit:    A bit-banging algorithm
 i2c-algo-pcf:    A PCF 8584 style algorithm
-i2c-algo-ibmocp: An algorithm for the I2C device in IBM 4xx processors (NOT BUILT BY DEFAULT)
+i2c-algo-ibm_ocp: An algorithm for the I2C device in IBM 4xx processors (NOT BUILT BY DEFAULT)
 
 Adapter drivers
 ---------------
@@ -68,7 +68,7 @@
 i2c-elv:         ELV parallel port adapter (uses i2c-algo-bit)
 i2c-pcf-epp:     PCF8584 on a EPP parallel port (uses i2c-algo-pcf) (NOT mkpatched)
 i2c-philips-par: Philips style parallel port adapter (uses i2c-algo-bit)
-i2c-adap_ibmocp:      IBM 4xx processor I2C device (uses i2c-algo-ibmocp) (NOT BUILT BY DEFAULT)
+i2c-adap-ibm_ocp: IBM 4xx processor I2C device (uses i2c-algo-ibm_ocp) (NOT BUILT BY DEFAULT)
 i2c-pport:       Primitive parallel port adapter (uses i2c-algo-bit)
 i2c-rpx:         RPX board Motorola 8xx I2C device (uses i2c-algo-8xx) (NOT BUILT BY DEFAULT)
 i2c-velleman:    Velleman K9000 parallel port adapter (uses i2c-algo-bit)
diff -Nru a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
--- a/Documentation/i2c/writing-clients	Sun Feb 23 22:25:22 2003
+++ b/Documentation/i2c/writing-clients	Sun Feb 23 22:25:22 2003
@@ -448,9 +448,9 @@
     /* Note that we reserve some space for foo_data too. If you don't
        need it, remove it. We do it here to help to lessen memory
        fragmentation. */
-    if (! (new_client = kmalloc(sizeof(struct i2c_client)) + 
+    if (! (new_client = kmalloc(sizeof(struct i2c_client) + 
                                 sizeof(struct foo_data),
-                                GFP_KERNEL)) {
+                                GFP_KERNEL))) {
       err = -ENOMEM;
       goto ERROR0;
     }
diff -Nru a/Documentation/networking/8139too.txt b/Documentation/networking/8139too.txt
--- a/Documentation/networking/8139too.txt	Sun Feb 23 22:25:25 2003
+++ b/Documentation/networking/8139too.txt	Sun Feb 23 22:25:25 2003
@@ -93,6 +93,8 @@
 ---------------
 AOpen ALN-325C
 AT-2500TX 10/100 PCI Fast Ethernet Network Adapter Card
+Cnet CNF401 'SinglePoint' 10/100 Base-TX
+Genius GF 100TXR4 Fast Ethernet 10/100M PCI Network Card
 KTI KF-230TX
 KTI KF-230TX/2
 Lantech FastNet TX
diff -Nru a/Documentation/networking/alias.txt b/Documentation/networking/alias.txt
--- a/Documentation/networking/alias.txt	Sun Feb 23 22:25:24 2003
+++ b/Documentation/networking/alias.txt	Sun Feb 23 22:25:24 2003
@@ -2,7 +2,7 @@
 IP-Aliasing:
 ============
 
-IP-aliases are additional IP-adresses/masks hooked up to a base 
+IP-aliases are additional IP-addresses/masks hooked up to a base 
 interface by adding a colon and a string when running ifconfig. 
 This string is usually numeric, but this is not a must.
 
diff -Nru a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
--- a/Documentation/networking/bonding.txt	Sun Feb 23 22:25:22 2003
+++ b/Documentation/networking/bonding.txt	Sun Feb 23 22:25:22 2003
@@ -258,7 +258,7 @@
         Specifies the ip addresses to use when arp_interval is > 0. These are
         the targets of the ARP request sent to determine the health of the link
         to the targets. Specify these values in ddd.ddd.ddd.ddd format.
-        Multiple ip adresses must be separated by a comma. At least one ip
+        Multiple ip addresses must be separated by a comma. At least one ip
         address needs to be given for ARP monitoring to work. The maximum number
         of targets that can be specified is set at 16.
 
diff -Nru a/Documentation/pnp.txt b/Documentation/pnp.txt
--- a/Documentation/pnp.txt	Sun Feb 23 22:25:22 2003
+++ b/Documentation/pnp.txt	Sun Feb 23 22:25:22 2003
@@ -233,7 +233,7 @@
 The Old Way
 ...........
 
-a series of compatability functions have been created to make it easy to convert 
+a series of compatibility functions have been created to make it easy to convert 
 
 ISAPNP drivers.  They should serve as a temporary solution only.
 
diff -Nru a/Documentation/rpc-cache.txt b/Documentation/rpc-cache.txt
--- a/Documentation/rpc-cache.txt	Sun Feb 23 22:25:22 2003
+++ b/Documentation/rpc-cache.txt	Sun Feb 23 22:25:22 2003
@@ -146,7 +146,7 @@
 Note: If a cache has no active readers on the channel, and has had not
 active readers for more than 60 seconds, further requests will not be
 added to the channel but instead all looks that do not find a valid
-entry will fail.  This is partly for backward compatability: The
+entry will fail.  This is partly for backward compatibility: The
 previous nfs exports table was deemed to be authoritative and a
 failed lookup meant a definite 'no'.
 
diff -Nru a/Documentation/s390/Debugging390.txt b/Documentation/s390/Debugging390.txt
--- a/Documentation/s390/Debugging390.txt	Sun Feb 23 22:25:22 2003
+++ b/Documentation/s390/Debugging390.txt	Sun Feb 23 22:25:22 2003
@@ -97,7 +97,7 @@
 6       6     Input/Output interrupt Mask
 
 7       7     External interrupt Mask used primarily for interprocessor signalling & 
-	      clock interupts.
+	      clock interrupts.
 
 8-11  8-11    PSW Key used for complex memory protection mechanism not used under linux
 
@@ -2423,7 +2423,7 @@
 There is a new device layer for channel devices, some
 drivers e.g. lcs are registered with this layer.
 If the device uses the channel device layer you'll be
-able to find what interupts it uses & the current state 
+able to find what interrupts it uses & the current state 
 of the device.
 See the manpage chandev.8 &type cat /proc/chandev for more info.
 
diff -Nru a/Documentation/s390/cds.txt b/Documentation/s390/cds.txt
--- a/Documentation/s390/cds.txt	Sun Feb 23 22:25:26 2003
+++ b/Documentation/s390/cds.txt	Sun Feb 23 22:25:26 2003
@@ -286,7 +286,7 @@
 
 struct ccw1 {
       __u8  cmd_code;/* command code */
-      __u8  flags;   /* flags, like IDA adressing, etc. */
+      __u8  flags;   /* flags, like IDA addressing, etc. */
       __u16 count;   /* byte count */
       __u32 cda;     /* data address */
 } __attribute__ ((packed,aligned(8)));
diff -Nru a/Documentation/scsi/ChangeLog.sym53c8xx_2 b/Documentation/scsi/ChangeLog.sym53c8xx_2
--- a/Documentation/scsi/ChangeLog.sym53c8xx_2	Sun Feb 23 22:25:24 2003
+++ b/Documentation/scsi/ChangeLog.sym53c8xx_2	Sun Feb 23 22:25:24 2003
@@ -102,7 +102,7 @@
 Sun Sep 9 18:00 2001 Gerard Roudier 
 	* version sym-2.1.12-20010909
 	- Change my email address.
-	- Add infrastructure for the forthcoming 64 bit DMA adressing support.
+	- Add infrastructure for the forthcoming 64 bit DMA addressing support.
 	  (Based on PCI 64 bit patch from David S. Miller)
 	- Donnot use anymore vm_offset_t type.
 
diff -Nru a/Documentation/scsi/scsi_mid_low_api.txt b/Documentation/scsi/scsi_mid_low_api.txt
--- a/Documentation/scsi/scsi_mid_low_api.txt	Sun Feb 23 22:25:25 2003
+++ b/Documentation/scsi/scsi_mid_low_api.txt	Sun Feb 23 22:25:25 2003
@@ -22,13 +22,28 @@
 a SCSI host and a PCI device is common but not required (e.g. with
 ISA or MCA adapters).]
 
+This version of the document roughly matches linux kernel version 2.5.63 .
+
+Documentation
+=============
+There is a SCSI documentation directory within the kernel source tree.
+That directory is typically /usr/src/linux/Documentation/scsi . Most
+documents are in plain (i.e. ASCII) text. This file can be found in that
+directory, named scsi_mid_low_api.txt . Many LLDs are documented there
+(e.g. aic7xxx.txt). The SCSI mid-level is briefly described in scsi.txt
+(with a url to a document describing the SCSI subsystem in the lk 2.4
+series). Two upper level drivers have documents in that directory:
+st.txt (SCSI tape driver) and scsi-generic.txt .
+
+Some documentation (or urls) for LLDs may be in the C source code or
+in the same directory. For example to find a url about the USB mass
+storage driver see the /usr/src/linux/drivers/usb/storage directory.
+
 The Linux kernel source Documentation/DocBook/scsidrivers.tmpl file
 refers to this file. With the appropriate DocBook toolset, this permits
 users to generate html, ps and pdf renderings of information within this
 file (e.g. the interface functions).
 
-This version of the document roughly matches lk 2.5.50 .
-
 Driver structure
 ================
 Traditionally a LLD for the SCSI subsystem has been at least two files in
@@ -100,12 +115,11 @@
 since the effected disk can be "cleaned up" the next time it is seen.
 
 During LLD initialization the driver should register itself with the
-appropriate IO bus that it expects to find HBA(s) (e.g. the PCI bus). This
-can probably be done via sysfs (formerly known as driverfs). Any driver
-parameters (especially those that are writeable after the driver is
-loaded) could also be registered with sysfs at this point. At the end of
-driver initialization the SCSI mid level is typically not aware of its
-presence.
+appropriate IO bus on which it expects to find HBA(s) (e.g. the PCI bus).
+This can probably be done via sysfs. Any driver parameters (especially
+those that are writeable after the driver is loaded) could also be
+registered with sysfs at this point. At the end of driver initialization
+the SCSI mid level is typically not aware of its presence.
 
 At some later time, the LLD becomes aware of a HBA and what follows
 is a typical sequence of calls between the LLD and the mid level.
@@ -149,7 +163,7 @@
 (a pointer is returned by scsi_register() ) and struct scsi_device
 instances (a pointer is passed as the parameter to slave_alloc() and
 slave_configure() ). Both classes of instances are "owned" by the 
-mid-level. struct scsi_devices instances are freed after slave_destroy().
+mid-level. struct scsi_device instances are freed after slave_destroy().
 struct Scsi_Host instances are freed after scsi_unregister().
 
 
@@ -249,6 +263,8 @@
 /**
  * scsi_add_host - perform sysfs registration and SCSI bus scan.
  * @shost:   pointer to scsi host instance
+ * @dev:     pointer to struct device host instance of class type scsi
+ *           (or related)
  *
  *      Returns 0 on success, negative errno of failure (e.g. -ENOMEM)
  *
@@ -256,7 +272,24 @@
  *	successful call to scsi_register().
  *	Defined in drivers/scsi/hosts.c
  **/
-int scsi_add_host(struct Scsi_Host *shost)
+int scsi_add_host(struct Scsi_Host *shost, struct device * dev)
+
+
+/**
+ * scsi_add_timer - (re-)start timer on a SCSI command.
+ * @scmd:    pointer to scsi command instance
+ * @timeout: duration of timeout in "jiffies"
+ * @complete: pointer to function to call if timeout expires
+ *
+ *      Returns nothing
+ *
+ *	Notes: All commands issued by upper levels already have a timeout
+ *	associated with them. A LLD can use this function to change
+ *	the existing timeout value.
+ *	Defined in drivers/scsi/scsi_error.c
+ **/
+void scsi_add_timer(Scsi_Cmnd *scmd, int timeout, void (*complete)
+                    (Scsi_Cmnd *))
 
 
 /**
@@ -322,6 +355,21 @@
 
 
 /**
+ * scsi_delete_timer - cancel timer on a SCSI command.
+ * @scmd:    pointer to scsi command instance
+ *
+ *      Returns 1 if able to cancel timer else 0 (i.e. too late or already
+ *	cancelled).
+ *
+ *	Notes: All commands issued by upper levels already have a timeout
+ *	associated with them. A LLD can use this function to cancel the
+ *	timer.
+ *	Defined in drivers/scsi/scsi_error.c
+ **/
+int scsi_delete_timer(Scsi_Cmnd *scmd)
+
+
+/**
  * scsi_partsize - parse partition table into cylinders, heads + sectors
  * @buf: pointer to partition table
  * @capacity: size of (total) disk in 512 byte sectors
@@ -404,15 +452,15 @@
 
 
 /**
- * scsi_set_pci_device - place PCI device reference in host structure
+ * scsi_set_device - place device reference in host structure
  * @shost: a pointer to a scsi host instance
- * @pdev: pointer to PCI device instance to assign
+ * @pdev: pointer to device instance to assign
  *
  *	Returns nothing
  *
  *      Notes: Defined in drivers/scsi/hosts.h .
  **/
-void scsi_set_pci_device(struct Scsi_Host * shost, struct pci_dev * pdev)
+void scsi_set_device(struct Scsi_Host * shost, struct device * dev)
 
 
 /**
@@ -430,6 +478,26 @@
 
 
 /**
+ * scsi_track_queue_full - track successive QUEUE_FULL events on given
+ *			device to determine if and when there is a need
+ *			to adjust the queue depth on the device.
+ * @SDptr: pointer to SCSI device instance
+ * @depth: Current number of outstanding SCSI commands on this device,
+ *	   not counting the one returned as QUEUE_FULL.
+ *
+ *      Returns 0  - no change needed
+ *		>0 - adjust queue depth to this new depth
+ *		-1 - drop back to untagged operation using host->cmd_per_lun
+ *		     as the untagged command depth
+ *
+ *      Notes: LLDs may call this at any time and we will do "The Right
+ *		Thing"; interrupt context safe. 
+ *		Defined in drivers/scsi/scsi.c .
+ **/
+int scsi_track_queue_full(Scsi_Device *SDptr, int depth)
+
+
+/**
  * scsi_unblock_requests - allow further commands to be queued to given host
  *
  * @SHpnt: pointer to host to unblock commands on
@@ -1008,4 +1076,4 @@
 
 Douglas Gilbert
 dgilbert@interlog.com
-29th November 2002
+21st February 2003
diff -Nru a/Documentation/sonypi.txt b/Documentation/sonypi.txt
--- a/Documentation/sonypi.txt	Sun Feb 23 22:25:21 2003
+++ b/Documentation/sonypi.txt	Sun Feb 23 22:25:21 2003
@@ -1,6 +1,6 @@
 Sony Programmable I/O Control Device Driver Readme
 --------------------------------------------------
-	Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
+	Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
 	Copyright (C) 2001-2002 Alcôve <www.alcove.com>
 	Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au>
 	Copyright (C) 2001 Junichi Morita <jun1m@mars.dti.ne.jp>
@@ -44,7 +44,7 @@
 to /etc/modules.conf file, when the driver is compiled as a module or by
 adding the following to the kernel command line (in your bootloader):
 
-	sonypi=minor[,verbose[,fnkeyinit[,camera[,compat[,mask]]]]]
+	sonypi=minor[,verbose[,fnkeyinit[,camera[,compat[,mask[,useinput]]]]]]
 
 where:
 
@@ -96,6 +96,11 @@
 				SONYPI_THUMBPHRASE_MASK 	0x0200
 				SONYPI_MEYE_MASK		0x0400
 				SONYPI_MEMORYSTICK_MASK		0x0800
+
+	useinput:	if set (which is the default) jogdial events are
+			forwarded to the input subsystem as mouse wheel
+			events.
+			
 
 Module use:
 -----------
diff -Nru a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl	Sun Feb 23 22:25:23 2003
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl	Sun Feb 23 22:25:23 2003
@@ -1377,8 +1377,6 @@
 
   module_init(alsa_card_mychip_init)
   module_exit(alsa_card_mychip_exit)
-
-  EXPORT_NO_SYMBOLS; /* for old kernels only */
 ]]>
           </programlisting>
         </example>
diff -Nru a/Documentation/sound/oss/PSS-updates b/Documentation/sound/oss/PSS-updates
--- a/Documentation/sound/oss/PSS-updates	Sun Feb 23 22:25:27 2003
+++ b/Documentation/sound/oss/PSS-updates	Sun Feb 23 22:25:27 2003
@@ -10,7 +10,7 @@
 
 	This parameter is basically a flag.  A 0 will leave the joystick port 
 disabled, while a non-zero value would enable the joystick port.  The default 
-setting is pss_enable_joystick=0 as this keeps this driver fully compatable 
+setting is pss_enable_joystick=0 as this keeps this driver fully compatible 
 with systems that were using previous versions of this driver.  If you wish to 
 enable the joystick port you will have to add pss_enable_joystick=1 as an 
 argument to the driver.  To actually use the joystick port you will then have 
@@ -31,7 +31,7 @@
 assigned to the CDROM port when you loaded your pss sound driver.  (ex. 
 modprobe pss pss_cdrom_port=0x340 && modprobe aztcd aztcd=0x340)  The default 
 setting of this parameter leaves the CDROM port disabled to maintain full 
-compatability with systems using previous versions of this driver.
+compatibility with systems using previous versions of this driver.
 
 	Other options have also been added for the added convenience and utility 
 of the user.  These options are only available if this driver is loaded as a 
@@ -49,7 +49,7 @@
 mpu401 && rmmod sound && rmmod soundcore" and retain the full functionality of 
 his CDROM and/or joystick port(s) while gaining back the memory previously used 
 by the sound drivers.  This default setting of this parameter is 0 to retain 
-full behavioral compatability with previous versions of this driver.
+full behavioral compatibility with previous versions of this driver.
 
 pss_keep_settings
 
@@ -60,7 +60,7 @@
 emulations by default on the driver's unloading (as it probably should), so 
 specifying it now will ensure that all future versions of this driver will 
 continue to work as expected.  The default value of this parameter is 1 to 
-retain full behavioral compatability with previous versions of this driver.
+retain full behavioral compatibility with previous versions of this driver.
 
 pss_firmware
 
diff -Nru a/Documentation/sysrq.txt b/Documentation/sysrq.txt
--- a/Documentation/sysrq.txt	Sun Feb 23 22:25:24 2003
+++ b/Documentation/sysrq.txt	Sun Feb 23 22:25:24 2003
@@ -164,7 +164,7 @@
 
 If for some reason you feel the need to call the handle_sysrq function from
 within a function called by handle_sysrq, you must be aware that you are in
-a lock (you are also in an interupt handler, which means don't sleep!), so
+a lock (you are also in an interrupt handler, which means don't sleep!), so
 you must call __handle_sysrq_nolock instead.
 
 *  I have more questions, who can I ask?
diff -Nru a/Documentation/video4linux/meye.txt b/Documentation/video4linux/meye.txt
--- a/Documentation/video4linux/meye.txt	Sun Feb 23 22:25:25 2003
+++ b/Documentation/video4linux/meye.txt	Sun Feb 23 22:25:25 2003
@@ -1,6 +1,6 @@
 Vaio Picturebook Motion Eye Camera Driver Readme
 ------------------------------------------------
-	Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
+	Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
 	Copyright (C) 2001-2002 Alcôve <www.alcove.com>
 	Copyright (C) 2000 Andrew Tridgell <tridge@samba.org>
 
diff -Nru a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt
--- a/Documentation/vm/hugetlbpage.txt	Sun Feb 23 22:25:22 2003
+++ b/Documentation/vm/hugetlbpage.txt	Sun Feb 23 22:25:22 2003
@@ -66,7 +66,7 @@
 
 /proc/sys/vm_nr_hugepages indicates the current number of configured hugetlb
 pages in the kernel.  Super user privileges are required for modification of
-this value.  The allocation of hugetlb pages is posible only if there are
+this value.  The allocation of hugetlb pages is possible only if there are
 enough physically contiguous free pages in system OR if there are enough
 hugetlb pages free that can be transfered back to regular memory pool.
 
diff -Nru a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS	Sun Feb 23 22:25:25 2003
+++ b/MAINTAINERS	Sun Feb 23 22:25:25 2003
@@ -215,6 +215,14 @@
 L:	linux-scsi@vger.kernel.org
 S:	Maintained
 
+ALCATEL SPEEDTOUCH USB DRIVER
+P:	Duncan Sands
+M:	duncan.sands@wanadoo.fr
+L:	linux-usb-users@lists.sourceforge.net
+L:	linux-usb-devel@lists.sourceforge.net
+W:	http://www.linux-usb.org/SpeedTouch/
+S:	Maintained
+
 ALPHA PORT
 P:	Richard Henderson
 M:	rth@twiddle.net
@@ -266,6 +274,13 @@
 L:	linux-net@vger.kernel.org
 S:	Maintained
 
+ATM
+P:	Chas Williams
+M:	chas@cmf.nrl.navy.mil
+L:	linux-atm-general@lists.sourceforge.net
+W:	http://linux-atm.sourceforge.net
+S:	Maintained
+
 AX.25 NETWORK LAYER
 P:	Ralf Baechle
 M:	ralf@linux-mips.org
@@ -308,6 +323,15 @@
 W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
+BONDING DRIVER
+P:   Chad Tindel
+M:   ctindel@users.sourceforge.net
+P:   Jay Vosburgh
+M:   fubar@us.ibm.com
+L:   bonding-devel@lists.sourceforge.net
+W:   http://sourceforge.net/projects/bonding/
+S:   Supported
+
 BTTV VIDEO4LINUX DRIVER
 P:	Gerd Knorr
 M:	kraxel@bytesex.org
@@ -1565,11 +1589,11 @@
 S:	Supported
 
 SGI VISUAL WORKSTATION 320 AND 540
-P:	Bent Hagemark
-M:	bh@sgi.com
-P:	Ingo Molnar
-M:	mingo@redhat.com
-S:	Maintained
+P:	Andrey Panin
+M:	pazke@orbita1.ru
+L:	linux-visws@lists.sf.net
+W:	http://linux-visws.sf.net
+S:	Maintained for 2.5.
 
 SIS 5513 IDE CONTROLLER DRIVER
 P:	Lionel Bouton
diff -Nru a/README b/README
--- a/README	Sun Feb 23 22:25:26 2003
+++ b/README	Sun Feb 23 22:25:26 2003
@@ -67,12 +67,12 @@
  - You can also upgrade between 2.5.xx releases by patching.  Patches are
    distributed in the traditional gzip and the new bzip2 format.  To
    install by patching, get all the newer patch files, enter the
-   directory in which you unpacked the kernel source and execute:
+   top level directory of the kernel source (linux-2.5.xx) and execute:
 
-		gzip -cd patchXX.gz | patch -p0
+		gzip -cd ../patch-2.5.xx.gz | patch -p1
 
    or
-		bzip2 -dc patchXX.bz2 | patch -p0
+		bzip2 -dc ../patch-2.5.xx.bz2 | patch -p1
 
    (repeat xx for all versions bigger than the version of your current
    source tree, _in_order_) and you should be ok.  You may want to remove
@@ -148,8 +148,6 @@
 
  - Check the top Makefile for further site-dependent configuration
    (default SVGA mode etc). 
-
- - Finally, do a "make dep" to set up all the dependencies correctly. 
 
 COMPILING the kernel:
 
diff -Nru a/arch/alpha/Kconfig b/arch/alpha/Kconfig
--- a/arch/alpha/Kconfig	Sun Feb 23 22:25:25 2003
+++ b/arch/alpha/Kconfig	Sun Feb 23 22:25:25 2003
@@ -935,6 +935,7 @@
 
 source "net/bluetooth/Kconfig"
 
+source "arch/alpha/oprofile/Kconfig"
 
 menu "Kernel hacking"
 
diff -Nru a/arch/alpha/Makefile b/arch/alpha/Makefile
--- a/arch/alpha/Makefile	Sun Feb 23 22:25:25 2003
+++ b/arch/alpha/Makefile	Sun Feb 23 22:25:25 2003
@@ -92,9 +92,10 @@
 
 head-y := arch/alpha/kernel/head.o
 
-core-y			+= arch/alpha/kernel/ arch/alpha/mm/
-core-$(CONFIG_MATHEMU)  += arch/alpha/math-emu/
-libs-y			+= arch/alpha/lib/
+core-y				+= arch/alpha/kernel/ arch/alpha/mm/
+core-$(CONFIG_MATHEMU)		+= arch/alpha/math-emu/
+drivers-$(CONFIG_OPROFILE)	+= arch/alpha/oprofile/
+libs-y				+= arch/alpha/lib/
 
 # export what is needed by arch/alpha/boot/Makefile
 LIBS_Y := $(patsubst %/, %/lib.a, $(libs-y))
diff -Nru a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile
--- a/arch/alpha/kernel/Makefile	Sun Feb 23 22:25:24 2003
+++ b/arch/alpha/kernel/Makefile	Sun Feb 23 22:25:24 2003
@@ -3,8 +3,8 @@
 #
 
 EXTRA_TARGETS	:= head.o
-
 EXTRA_AFLAGS	:= $(CFLAGS)
+EXTRA_CFLAGS	:= -Werror -Wno-sign-compare
 
 obj-y    := entry.o traps.o process.o init_task.o osf_sys.o irq.o \
 	    irq_alpha.o signal.o setup.o ptrace.o time.o semaphore.o \
diff -Nru a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c
--- a/arch/alpha/kernel/alpha_ksyms.c	Sun Feb 23 22:25:21 2003
+++ b/arch/alpha/kernel/alpha_ksyms.c	Sun Feb 23 22:25:21 2003
@@ -119,10 +119,6 @@
 EXPORT_SYMBOL(copy_page);
 EXPORT_SYMBOL(clear_page);
 
-EXPORT_SYMBOL(__delay);
-EXPORT_SYMBOL(__udelay);
-EXPORT_SYMBOL(udelay);
-
 EXPORT_SYMBOL(__direct_map_base);
 EXPORT_SYMBOL(__direct_map_size);
 
diff -Nru a/arch/alpha/kernel/core_irongate.c b/arch/alpha/kernel/core_irongate.c
--- a/arch/alpha/kernel/core_irongate.c	Sun Feb 23 22:25:25 2003
+++ b/arch/alpha/kernel/core_irongate.c	Sun Feb 23 22:25:25 2003
@@ -236,14 +236,15 @@
 			unsigned long size;
 
 			size = initrd_end - initrd_start;
-			free_bootmem(__pa(initrd_start), PAGE_ALIGN(size));
+			free_bootmem_node(NODE_DATA(0), __pa(initrd_start),
+					  PAGE_ALIGN(size));
 			if (!move_initrd(pci_mem))
 				printk("irongate_init_arch: initrd too big "
 				       "(%ldK)\ndisabling initrd\n",
 				       size / 1024);
 		}
 #endif
-		reserve_bootmem(pci_mem, memtop - pci_mem);
+		reserve_bootmem_node(NODE_DATA(0), pci_mem, memtop - pci_mem);
 		printk("irongate_init_arch: temporarily reserving "
 			"region %08lx-%08lx for PCI\n", pci_mem, memtop - 1);
 	}
diff -Nru a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
--- a/arch/alpha/kernel/entry.S	Sun Feb 23 22:25:21 2003
+++ b/arch/alpha/kernel/entry.S	Sun Feb 23 22:25:21 2003
@@ -582,6 +582,7 @@
 	lda	$8, 0x3fff
 	bsr	$1, undo_switch_stack
 	bic	$sp, $8, $8
+	mov	$17, $0
 	ret
 .end alpha_switch_to
 
diff -Nru a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c
--- a/arch/alpha/kernel/irq_alpha.c	Sun Feb 23 22:25:22 2003
+++ b/arch/alpha/kernel/irq_alpha.c	Sun Feb 23 22:25:22 2003
@@ -74,7 +74,7 @@
 		alpha_mv.device_interrupt(vector, regs);
 		return;
 	case 4:
-		perf_irq(vector, regs);
+		perf_irq(la_ptr, regs);
 		return;
 	default:
 		printk(KERN_CRIT "Hardware intr %ld %lx? Huh?\n",
diff -Nru a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c
--- a/arch/alpha/kernel/ptrace.c	Sun Feb 23 22:25:26 2003
+++ b/arch/alpha/kernel/ptrace.c	Sun Feb 23 22:25:26 2003
@@ -13,6 +13,7 @@
 #include <linux/ptrace.h>
 #include <linux/user.h>
 #include <linux/slab.h>
+#include <linux/security.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -255,6 +256,8 @@
 	      struct pt_regs *regs)
 {
 	struct task_struct *child;
+	unsigned long tmp;
+	size_t copied;
 	long ret;
 
 	lock_kernel();
@@ -265,6 +268,9 @@
 		/* are we already being traced? */
 		if (current->ptrace & PT_PTRACED)
 			goto out_notsk;
+		ret = security_ptrace(current->parent, current);
+		if (ret)
+			goto out_notsk;
 		/* set the ptrace bit in the process ptrace flags. */
 		current->ptrace |= PT_PTRACED;
 		ret = 0;
@@ -272,6 +278,7 @@
 	}
 	if (pid == 1)		/* you may not mess with init */
 		goto out_notsk;
+
 	ret = -ESRCH;
 	read_lock(&tasklist_lock);
 	child = find_task_by_pid(pid);
@@ -280,77 +287,65 @@
 	read_unlock(&tasklist_lock);
 	if (!child)
 		goto out_notsk;
+
 	if (request == PTRACE_ATTACH) {
 		ret = ptrace_attach(child);
 		goto out;
 	}
-	ret = -ESRCH;
-	if (!(child->ptrace & PT_PTRACED)) {
-		DBG(DBG_MEM, ("child not traced\n"));
-		goto out;
-	}
-	if (child->state != TASK_STOPPED) {
-		DBG(DBG_MEM, ("child process not stopped\n"));
-		if (request != PTRACE_KILL)
-			goto out;
-	}
-	if (child->parent != current) {
-		DBG(DBG_MEM, ("child not parent of this process\n"));
+
+	ret = ptrace_check_attach(child, request == PTRACE_KILL);
+	if (ret < 0)
 		goto out;
-	}
 
 	switch (request) {
 	/* When I and D space are separate, these will need to be fixed.  */
 	case PTRACE_PEEKTEXT: /* read word at location addr. */
-	case PTRACE_PEEKDATA: {
-		unsigned long tmp;
-		int copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
+	case PTRACE_PEEKDATA:
+		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
 		ret = -EIO;
 		if (copied != sizeof(tmp))
-			goto out;
+			break;
 		
 		regs->r0 = 0;	/* special return: no errors */
 		ret = tmp;
-		goto out;
-	}
+		break;
 
 	/* Read register number ADDR. */
 	case PTRACE_PEEKUSR:
 		regs->r0 = 0;	/* special return: no errors */
 		ret = get_reg(child, addr);
 		DBG(DBG_MEM, ("peek $%ld->%#lx\n", addr, ret));
-		goto out;
+		break;
 
 	/* When I and D space are separate, this will have to be fixed.  */
 	case PTRACE_POKETEXT: /* write the word at location addr. */
-	case PTRACE_POKEDATA: {
-		unsigned long tmp = data;
-		int copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 1);
+	case PTRACE_POKEDATA:
+		tmp = data;
+		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 1);
 		ret = (copied == sizeof(tmp)) ? 0 : -EIO;
-		goto out;
-	}
+		break;
 
 	case PTRACE_POKEUSR: /* write the specified register */
 		DBG(DBG_MEM, ("poke $%ld<-%#lx\n", addr, data));
 		ret = put_reg(child, addr, data);
-		goto out;
+		break;
 
-	case PTRACE_SYSCALL: /* continue and stop at next
-				(return from) syscall */
+	case PTRACE_SYSCALL:
+		/* continue and stop at next (return from) syscall */
 	case PTRACE_CONT:    /* restart after signal. */
 		ret = -EIO;
 		if ((unsigned long) data > _NSIG)
-			goto out;
+			break;
 		if (request == PTRACE_SYSCALL)
 			set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
 		else
 			clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
 		child->exit_code = data;
-		wake_up_process(child);
 		/* make sure single-step breakpoint is gone. */
 		ptrace_cancel_bpt(child);
-		ret = data;
-		goto out;
+		wake_up_process(child);
+		ret = 0;
+		break;
 
 	/*
 	 * Make the child exit.  Best I can do is send it a sigkill.
@@ -358,19 +353,19 @@
 	 * exit.
 	 */
 	case PTRACE_KILL:
-		if (child->state != TASK_ZOMBIE) {
-			wake_up_process(child);
-			child->exit_code = SIGKILL;
-		}
+		ret = 0;
+		if (child->state == TASK_ZOMBIE)
+			break;
+		child->exit_code = SIGKILL;
 		/* make sure single-step breakpoint is gone. */
 		ptrace_cancel_bpt(child);
-		ret = 0;
+		wake_up_process(child);
 		goto out;
 
 	case PTRACE_SINGLESTEP:  /* execute single instruction. */
 		ret = -EIO;
 		if ((unsigned long) data > _NSIG)
-			goto out;
+			break;
 		/* Mark single stepping.  */
 		child->thread_info->bpt_nsaved = -1;
 		clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
diff -Nru a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c
--- a/arch/alpha/kernel/sys_sable.c	Sun Feb 23 22:25:21 2003
+++ b/arch/alpha/kernel/sys_sable.c	Sun Feb 23 22:25:21 2003
@@ -268,7 +268,7 @@
 		{ 32+3,  32+3,  32+3,  32+3,  32+3},  /* IdSel 7,  slot 1 */
 		{ 32+4,  32+4,  32+4,  32+4,  32+4},  /* IdSel 8,  slot 2 */
         };
-	const long min_idsel = 0, max_idsel = 8, irqs_per_slot = 5;
+	long min_idsel = 0, max_idsel = 8, irqs_per_slot = 5;
 	return COMMON_TABLE_LOOKUP;
 }
 
diff -Nru a/arch/alpha/kernel/sys_wildfire.c b/arch/alpha/kernel/sys_wildfire.c
--- a/arch/alpha/kernel/sys_wildfire.c	Sun Feb 23 22:25:23 2003
+++ b/arch/alpha/kernel/sys_wildfire.c	Sun Feb 23 22:25:23 2003
@@ -314,7 +314,7 @@
 		{ 56,    56,    56+1, 56+2, 56+3}, /* IdSel 6 PCI 1 slot 6 */
 		{ 60,    60,    60+1, 60+2, 60+3}, /* IdSel 7 PCI 1 slot 7 */
 	};
-	const long min_idsel = 0, max_idsel = 7, irqs_per_slot = 5;
+	long min_idsel = 0, max_idsel = 7, irqs_per_slot = 5;
 
 	struct pci_controller *hose = dev->sysdata;
 	int irq = COMMON_TABLE_LOOKUP;
diff -Nru a/arch/alpha/lib/Makefile b/arch/alpha/lib/Makefile
--- a/arch/alpha/lib/Makefile	Sun Feb 23 22:25:26 2003
+++ b/arch/alpha/lib/Makefile	Sun Feb 23 22:25:26 2003
@@ -3,6 +3,8 @@
 #
 
 EXTRA_AFLAGS := $(CFLAGS)
+EXTRA_CFLAGS := -Werror
+
 L_TARGET := lib.a
 
 # Many of these routines have implementations tuned for ev6.
diff -Nru a/arch/alpha/lib/ev6-memcpy.S b/arch/alpha/lib/ev6-memcpy.S
--- a/arch/alpha/lib/ev6-memcpy.S	Sun Feb 23 22:25:22 2003
+++ b/arch/alpha/lib/ev6-memcpy.S	Sun Feb 23 22:25:22 2003
@@ -243,6 +243,6 @@
 
 	.end memcpy
 
-/* For backwards module compatability.  */
+/* For backwards module compatibility.  */
 __memcpy = memcpy
 .globl __memcpy
diff -Nru a/arch/alpha/lib/udelay.c b/arch/alpha/lib/udelay.c
--- a/arch/alpha/lib/udelay.c	Sun Feb 23 22:25:25 2003
+++ b/arch/alpha/lib/udelay.c	Sun Feb 23 22:25:25 2003
@@ -1,15 +1,16 @@
-#include <linux/config.h>
-#include <linux/sched.h> /* for udelay's use of smp_processor_id */
-#include <asm/param.h>
-#include <asm/smp.h>
-#include <linux/delay.h>
-
 /*
  * Copyright (C) 1993, 2000 Linus Torvalds
  *
  * Delay routines, using a pre-computed "loops_per_jiffy" value.
  */
 
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/sched.h> /* for udelay's use of smp_processor_id */
+#include <asm/param.h>
+#include <asm/smp.h>
+#include <linux/delay.h>
+
 /*
  * Use only for very small delays (< 1 msec). 
  *
@@ -18,7 +19,8 @@
  * a 1GHz box, that's about 2 seconds.
  */
 
-void __delay(int loops)
+void
+__delay(int loops)
 {
 	int tmp;
 	__asm__ __volatile__(
@@ -30,18 +32,24 @@
 		: "=&r" (tmp), "=r" (loops) : "1"(loops));
 }
 
-void __udelay(unsigned long usecs, unsigned long lpj)
+#ifdef CONFIG_SMP
+#define LPJ	 cpu_data[smp_processor_id()].loops_per_jiffy
+#else
+#define LPJ	 loops_per_jiffy
+#endif
+
+void
+udelay(unsigned long usecs)
 {
-	usecs *= (((unsigned long)HZ << 32) / 1000000) * lpj;
+	usecs *= (((unsigned long)HZ << 32) / 1000000) * LPJ;
 	__delay((long)usecs >> 32);
 }
+EXPORT_SYMBOL(udelay);
 
-void udelay(unsigned long usecs)
+void
+ndelay(unsigned long nsecs)
 {
-#ifdef CONFIG_SMP
-	__udelay(usecs, cpu_data[smp_processor_id()].loops_per_jiffy);
-#else
-	__udelay(usecs, loops_per_jiffy);
-#endif
+	nsecs *= (((unsigned long)HZ << 32) / 1000000000) * LPJ;
+	__delay((long)nsecs >> 32);
 }
-
+EXPORT_SYMBOL(ndelay);
diff -Nru a/arch/alpha/math-emu/Makefile b/arch/alpha/math-emu/Makefile
--- a/arch/alpha/math-emu/Makefile	Sun Feb 23 22:25:24 2003
+++ b/arch/alpha/math-emu/Makefile	Sun Feb 23 22:25:24 2003
@@ -2,6 +2,6 @@
 # Makefile for the FPU instruction emulation.
 #
 
-CFLAGS += -Iinclude/math-emu -w
+EXTRA_CFLAGS := -w
 
 obj-$(CONFIG_MATHEMU) += math.o qrnnd.o
diff -Nru a/arch/alpha/mm/Makefile b/arch/alpha/mm/Makefile
--- a/arch/alpha/mm/Makefile	Sun Feb 23 22:25:27 2003
+++ b/arch/alpha/mm/Makefile	Sun Feb 23 22:25:27 2003
@@ -2,6 +2,8 @@
 # Makefile for the linux alpha-specific parts of the memory manager.
 #
 
+EXTRA_CFLAGS := -Werror
+
 obj-y	:= init.o fault.o extable.o remap.o
 
 obj-$(CONFIG_DISCONTIGMEM) += numa.o
diff -Nru a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
--- a/arch/alpha/mm/numa.c	Sun Feb 23 22:25:21 2003
+++ b/arch/alpha/mm/numa.c	Sun Feb 23 22:25:21 2003
@@ -279,7 +279,8 @@
 				       initrd_end,
 				       phys_to_virt(PFN_PHYS(max_low_pfn)));
 		} else {
-			reserve_bootmem_node(NODE_DATA(KVADDR_TO_NID(initrd_start)),
+			nid = NODE_DATA(kvaddr_to_nid(initrd_start));
+			reserve_bootmem_node(nid,
 					     virt_to_phys((void *)initrd_start),
 					     INITRD_SIZE);
 		}
@@ -349,8 +350,8 @@
 	initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;
 
 	printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, "
-		"%luk data, %luk init)\n",
-	       nr_free_pages() << (PAGE_SHIFT-10),
+	       "%luk data, %luk init)\n",
+	       (unsigned long)nr_free_pages() << (PAGE_SHIFT-10),
 	       num_physpages << (PAGE_SHIFT-10),
 	       codesize >> 10,
 	       reservedpages << (PAGE_SHIFT-10),
diff -Nru a/arch/alpha/oprofile/Kconfig b/arch/alpha/oprofile/Kconfig
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/alpha/oprofile/Kconfig	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,23 @@
+
+menu "Profiling support"
+	depends on EXPERIMENTAL
+
+config PROFILING
+	bool "Profiling support (EXPERIMENTAL)"
+	help
+	  Say Y here to enable the extended profiling support mechanisms used
+	  by profilers such as OProfile.
+	  
+
+config OPROFILE
+	tristate "OProfile system profiling (EXPERIMENTAL)"
+	depends on PROFILING
+	help
+	  OProfile is a profiling system capable of profiling the
+	  whole system, include the kernel, kernel modules, libraries,
+	  and applications.
+
+	  If unsure, say N.
+
+endmenu
+
diff -Nru a/arch/alpha/oprofile/Makefile b/arch/alpha/oprofile/Makefile
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/alpha/oprofile/Makefile	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,18 @@
+EXTRA_CFLAGS := -Werror -Wno-sign-compare
+
+obj-$(CONFIG_OPROFILE) += oprofile.o
+
+DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
+		oprof.o cpu_buffer.o buffer_sync.o \
+		event_buffer.o oprofile_files.o \
+		oprofilefs.o oprofile_stats.o )
+
+oprofile-y				:= $(DRIVER_OBJS) common.o
+oprofile-$(CONFIG_ALPHA_GENERIC)	+= op_model_ev4.o \
+					   op_model_ev5.o \
+					   op_model_ev6.o \
+					   op_model_ev67.o
+oprofile-$(CONFIG_ALPHA_EV4)		+= op_model_ev4.o
+oprofile-$(CONFIG_ALPHA_EV5)		+= op_model_ev5.o
+oprofile-$(CONFIG_ALPHA_EV6)		+= op_model_ev6.o \
+					   op_model_ev67.o
diff -Nru a/arch/alpha/oprofile/common.c b/arch/alpha/oprofile/common.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/alpha/oprofile/common.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,188 @@
+/**
+ * @file arch/alpha/oprofile/common.c
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author Richard Henderson <rth@twiddle.net>
+ */
+
+#include <linux/oprofile.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/errno.h>
+#include <asm/ptrace.h>
+#include <asm/system.h>
+
+#include "op_impl.h"
+
+extern struct op_axp_model op_model_ev4 __attribute__((weak));
+extern struct op_axp_model op_model_ev5 __attribute__((weak));
+extern struct op_axp_model op_model_pca56 __attribute__((weak));
+extern struct op_axp_model op_model_ev6 __attribute__((weak));
+extern struct op_axp_model op_model_ev67 __attribute__((weak));
+
+static struct op_axp_model *model;
+
+extern void (*perf_irq)(unsigned long, struct pt_regs *);
+static void (*save_perf_irq)(unsigned long, struct pt_regs *);
+
+static struct op_counter_config ctr[20];
+static struct op_system_config sys;
+static struct op_register_config reg;
+
+/* Called from do_entInt to handle the performance monitor interrupt.  */
+
+static void
+op_handle_interrupt(unsigned long which, struct pt_regs *regs)
+{
+	model->handle_interrupt(which, regs, ctr);
+
+	/* If the user has selected an interrupt frequency that is
+	   not exactly the width of the counter, write a new value
+	   into the counter such that it'll overflow after N more
+	   events.  */
+	if ((reg.need_reset >> which) & 1)
+		model->reset_ctr(&reg, which);
+}
+ 
+static int
+op_axp_setup(void)
+{
+	unsigned long i, e;
+
+	/* Install our interrupt handler into the existing hook.  */
+	save_perf_irq = perf_irq;
+	perf_irq = op_handle_interrupt;
+
+	/* Compute the mask of enabled counters.  */
+	for (i = e = 0; i < model->num_counters; ++i)
+		if (ctr[0].enabled)
+			e |= 1 << i;
+	reg.enable = e;
+
+	/* Pre-compute the values to stuff in the hardware registers.  */
+	model->reg_setup(&reg, ctr, &sys);
+
+	/* Configure the registers on all cpus.  */
+	smp_call_function(model->cpu_setup, &reg, 0, 1);
+	model->cpu_setup(&reg);
+	return 0;
+}
+
+static void
+op_axp_shutdown(void)
+{
+	/* Remove our interrupt handler.  We may be removing this module.  */
+	perf_irq = save_perf_irq;
+}
+
+static void
+op_axp_cpu_start(void *dummy)
+{
+	wrperfmon(1, reg.enable);
+}
+
+static int
+op_axp_start(void)
+{
+	smp_call_function(op_axp_cpu_start, NULL, 0, 1);
+	op_axp_cpu_start(NULL);
+	return 0;
+}
+
+static inline void
+op_axp_cpu_stop(void *dummy)
+{
+	/* Disable performance monitoring for all counters.  */
+	wrperfmon(0, -1);
+}
+
+static void
+op_axp_stop(void)
+{
+	smp_call_function(op_axp_cpu_stop, NULL, 0, 1);
+	op_axp_cpu_stop(NULL);
+}
+
+static int
+op_axp_create_files(struct super_block * sb, struct dentry * root)
+{
+	int i;
+
+	for (i = 0; i < model->num_counters; ++i) {
+		struct dentry *dir;
+		char buf[3];
+
+		snprintf(buf, sizeof buf, "%d", i);
+		dir = oprofilefs_mkdir(sb, root, buf);
+
+		oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled);
+                oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event);
+		oprofilefs_create_ulong(sb, dir, "count", &ctr[i].count);
+		/* Dummies.  */
+		oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel);
+		oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user);
+		oprofilefs_create_ulong(sb, dir, "unit_mask", &ctr[i].unit_mask);
+	}
+
+	if (model->can_set_proc_mode) {
+		oprofilefs_create_ulong(sb, root, "enable_pal",
+					&sys.enable_pal);
+		oprofilefs_create_ulong(sb, root, "enable_kernel",
+					&sys.enable_kernel);
+		oprofilefs_create_ulong(sb, root, "enable_user",
+					&sys.enable_user);
+	}
+
+	return 0;
+}
+
+static struct oprofile_operations oprof_axp_ops = {
+	.create_files	= op_axp_create_files,
+	.setup		= op_axp_setup,
+	.shutdown	= op_axp_shutdown,
+	.start		= op_axp_start,
+	.stop		= op_axp_stop,
+	.cpu_type	= NULL		/* To be filled in below.  */
+};
+
+int __init
+oprofile_arch_init(struct oprofile_operations **ops)
+{
+	struct op_axp_model *lmodel = NULL;
+
+	switch (implver()) {
+	case IMPLVER_EV4:
+		lmodel = &op_model_ev4;
+		break;
+	case IMPLVER_EV5:
+		/* 21164PC has a slightly different set of events.
+		   Recognize the chip by the presence of the MAX insns.  */
+		if (!amask(AMASK_MAX))
+			lmodel = &op_model_pca56;
+		else
+			lmodel = &op_model_ev5;
+		break;
+	case IMPLVER_EV6:
+		/* 21264A supports ProfileMe.
+		   Recognize the chip by the presence of the CIX insns.  */
+		if (!amask(AMASK_CIX))
+			lmodel = &op_model_ev67;
+		else
+			lmodel = &op_model_ev6;
+		break;
+	}
+
+	if (!lmodel)
+		return ENODEV;
+	model = lmodel;
+
+	oprof_axp_ops.cpu_type = lmodel->cpu_type;
+	*ops = &oprof_axp_ops;
+
+	printk(KERN_INFO "oprofile: using %s performance monitoring.\n",
+	       lmodel->cpu_type);
+
+	return 0;
+}
diff -Nru a/arch/alpha/oprofile/op_impl.h b/arch/alpha/oprofile/op_impl.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/alpha/oprofile/op_impl.h	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,55 @@
+/**
+ * @file arch/alpha/oprofile/op_impl.h
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author Richard Henderson <rth@twiddle.net>
+ */
+
+#ifndef OP_IMPL_H
+#define OP_IMPL_H 1
+
+/* Per-counter configuration as set via oprofilefs.  */
+struct op_counter_config {
+	unsigned long enabled;
+	unsigned long event;
+	unsigned long count;
+	/* Dummies because I am too lazy to hack the userspace tools.  */
+	unsigned long kernel;
+	unsigned long user;
+	unsigned long unit_mask;
+};
+
+/* System-wide configuration as set via oprofilefs.  */
+struct op_system_config {
+	unsigned long enable_pal;
+	unsigned long enable_kernel;
+	unsigned long enable_user;
+};
+
+/* Cached values for the various performance monitoring registers.  */
+struct op_register_config {
+	unsigned long enable;
+	unsigned long mux_select;
+	unsigned long proc_mode;
+	unsigned long freq;
+	unsigned long reset_values;
+	unsigned long need_reset;
+};
+
+/* Per-architecture configury and hooks.  */
+struct op_axp_model {
+	void (*reg_setup) (struct op_register_config *,
+			   struct op_counter_config *,
+			   struct op_system_config *);
+	void (*cpu_setup) (void *);
+	void (*reset_ctr) (struct op_register_config *, unsigned long);
+	void (*handle_interrupt) (unsigned long, struct pt_regs *,
+				  struct op_counter_config *);
+	char *cpu_type;
+	unsigned char num_counters;
+	unsigned char can_set_proc_mode;
+};
+
+#endif
diff -Nru a/arch/alpha/oprofile/op_model_ev4.c b/arch/alpha/oprofile/op_model_ev4.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/alpha/oprofile/op_model_ev4.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,117 @@
+/**
+ * @file arch/alpha/oprofile/op_model_ev4.c
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author Richard Henderson <rth@twiddle.net>
+ */
+
+#include <linux/oprofile.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <asm/ptrace.h>
+#include <asm/system.h>
+
+#include "op_impl.h"
+
+
+/* Compute all of the registers in preparation for enabling profiling.  */
+
+static void
+ev4_reg_setup(struct op_register_config *reg,
+	      struct op_counter_config *ctr,
+	      struct op_system_config *sys)
+{
+	unsigned long ctl = 0, count, hilo;
+
+	/* Select desired events.  We've mapped the event numbers
+	   such that they fit directly into the event selection fields.
+
+	   Note that there is no "off" setting.  In both cases we select
+	   the EXTERNAL event source, hoping that it'll be the lowest
+	   frequency, and set the frequency counter to LOW.  The interrupts
+	   for these "disabled" counter overflows are ignored by the
+	   interrupt handler.
+
+	   This is most irritating, becuase the hardware *can* enable and
+	   disable the interrupts for these counters independently, but the
+	   wrperfmon interface doesn't allow it.  */
+
+	ctl |= (ctr[0].enabled ? ctr[0].event << 8 : 14 << 8);
+	ctl |= (ctr[1].enabled ? (ctr[1].event - 16) << 32 : 7ul << 32);
+
+	/* EV4 can not read or write its counter registers.  The only
+	   thing one can do at all is see if you overflow and get an
+	   interrupt.  We can set the width of the counters, to some
+	   extent.  Take the interrupt count selected by the user,
+	   map it onto one of the possible values, and write it back.  */
+
+	count = ctr[0].count;
+	if (count <= 4096)
+		count = 4096, hilo = 1;
+	else
+		count = 65536, hilo = 0;
+	ctr[0].count = count;
+	ctl |= (ctr[0].enabled && hilo) << 3;
+
+	count = ctr[1].count;
+	if (count <= 256)
+		count = 256, hilo = 1;
+	else
+		count = 4096, hilo = 0;
+	ctr[1].count = count;
+	ctl |= (ctr[1].enabled && hilo);
+
+	reg->mux_select = ctl;
+
+	/* Select performance monitoring options.  */
+	/* ??? Need to come up with some mechanism to trace only
+	   selected processes.  EV4 does not have a mechanism to
+	   select kernel or user mode only.  For now, enable always.  */
+	reg->proc_mode = 0;
+
+	/* Frequency is folded into mux_select for EV4.  */
+	reg->freq = 0;
+
+	/* See above regarding no writes.  */
+	reg->reset_values = 0;
+	reg->need_reset = 0;
+
+}
+
+/* Program all of the registers in preparation for enabling profiling.  */
+
+static void
+ev4_cpu_setup(void *x)
+{
+	struct op_register_config *reg = x;
+
+	wrperfmon(2, reg->mux_select);
+	wrperfmon(3, reg->proc_mode);
+}
+
+static void
+ev4_handle_interrupt(unsigned long which, struct pt_regs *regs,
+		     struct op_counter_config *ctr)
+{
+	/* EV4 can't properly disable counters individually.
+	   Discard "disabled" events now.  */
+	if (!ctr[which].enabled)
+		return;
+
+	/* Record the sample.  */
+	oprofile_add_sample(regs->pc, !user_mode(regs),
+			    which, smp_processor_id());
+}
+
+
+struct op_axp_model op_model_ev4 = {
+	.reg_setup		= ev4_reg_setup,
+	.cpu_setup		= ev4_cpu_setup,
+	.reset_ctr		= NULL,
+	.handle_interrupt	= ev4_handle_interrupt,
+	.cpu_type		= "alpha/ev4",
+	.num_counters		= 2,
+	.can_set_proc_mode	= 0,
+};
diff -Nru a/arch/alpha/oprofile/op_model_ev5.c b/arch/alpha/oprofile/op_model_ev5.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/alpha/oprofile/op_model_ev5.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,212 @@
+/**
+ * @file arch/alpha/oprofile/op_model_ev5.c
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author Richard Henderson <rth@twiddle.net>
+ */
+
+#include <linux/oprofile.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <asm/ptrace.h>
+#include <asm/system.h>
+
+#include "op_impl.h"
+
+
+/* Compute all of the registers in preparation for enabling profiling.
+
+   The 21164 (EV5) and 21164PC (PCA65) vary in the bit placement and
+   meaning of the "CBOX" events.  Given that we don't care about meaning
+   at this point, arrange for the difference in bit placement to be
+   handled by common code.  */
+
+static void
+common_reg_setup(struct op_register_config *reg,
+		 struct op_counter_config *ctr,
+		 struct op_system_config *sys,
+		 int cbox1_ofs, int cbox2_ofs)
+{
+	int i, ctl, reset, need_reset;
+
+	/* Select desired events.  The event numbers are selected such
+	   that they map directly into the event selection fields:
+
+		PCSEL0:	0, 1
+		PCSEL1:	24-39
+		 CBOX1: 40-47
+		PCSEL2: 48-63
+		 CBOX2: 64-71
+
+	   There are two special cases, in that CYCLES can be measured
+	   on PCSEL[02], and SCACHE_WRITE can be measured on CBOX[12].
+	   These event numbers are canonicalizes to their first appearance.  */
+
+	ctl = 0;
+	for (i = 0; i < 3; ++i) {
+		unsigned long event = ctr[i].event;
+		if (!ctr[i].enabled)
+			continue;
+
+		/* Remap the duplicate events, as described above.  */
+		if (i == 2) {
+			if (event == 0)
+				event = 12+48;
+			else if (event == 2+41)
+				event = 4+65;
+		}
+
+		/* Convert the event numbers onto mux_select bit mask.  */
+		if (event < 2)
+			ctl |= event << 31;
+		else if (event < 24)
+			/* error */;
+		else if (event < 40)
+			ctl |= (event - 24) << 4;
+		else if (event < 48)
+			ctl |= (event - 40) << cbox1_ofs | 15 << 4;
+		else if (event < 64)
+			ctl |= event - 48;
+		else if (event < 72)
+			ctl |= (event - 64) << cbox2_ofs | 15;
+	}
+	reg->mux_select = ctl;
+
+	/* Select processor mode.  */
+	/* ??? Need to come up with some mechanism to trace only selected
+	   processes.  For now select from pal, kernel and user mode.  */
+	ctl = 0;
+	ctl |= !sys->enable_pal << 9;
+	ctl |= !sys->enable_kernel << 8;
+	ctl |= !sys->enable_user << 30;
+	reg->proc_mode = ctl;
+
+	/* Select interrupt frequencies.  Take the interrupt count selected
+	   by the user, and map it onto one of the possible counter widths.
+	   If the user value is in between, compute a value to which the
+	   counter is reset at each interrupt.  */
+
+	ctl = reset = need_reset = 0;
+	for (i = 0; i < 3; ++i) {
+		unsigned long max, hilo, count = ctr[i].count;
+		if (!ctr[i].enabled)
+			continue;
+
+		if (count <= 256)
+			count = 256, hilo = 3, max = 256;
+		else {
+			max = (i == 2 ? 16384 : 65536);
+			hilo = 2;
+			if (count > max)
+				count = max;
+		}
+		ctr[i].count = count;
+
+		ctl |= hilo << (8 - i*2);
+		reset |= (max - count) << (48 - 16*i);
+		if (count != max)
+			need_reset |= 1 << i;
+	}
+	reg->freq = ctl;
+	reg->reset_values = reset;
+	reg->need_reset = need_reset;
+}
+
+static void
+ev5_reg_setup(struct op_register_config *reg,
+	      struct op_counter_config *ctr,
+	      struct op_system_config *sys)
+{
+	common_reg_setup(reg, ctr, sys, 19, 22);
+}
+
+static void
+pca56_reg_setup(struct op_register_config *reg,
+	        struct op_counter_config *ctr,
+	        struct op_system_config *sys)
+{
+	common_reg_setup(reg, ctr, sys, 8, 11);
+}
+
+/* Program all of the registers in preparation for enabling profiling.  */
+
+static void
+ev5_cpu_setup (void *x)
+{
+	struct op_register_config *reg = x;
+
+	wrperfmon(2, reg->mux_select);
+	wrperfmon(3, reg->proc_mode);
+	wrperfmon(4, reg->freq);
+	wrperfmon(6, reg->reset_values);
+}
+
+/* CTR is a counter for which the user has requested an interrupt count
+   in between one of the widths selectable in hardware.  Reset the count
+   for CTR to the value stored in REG->RESET_VALUES.
+
+   For EV5, this means disabling profiling, reading the current values,
+   masking in the value for the desired register, writing, then turning
+   profiling back on.
+
+   This can be streamlined if profiling is only enabled for user mode.
+   In that case we know that the counters are not currently incrementing
+   (due to being in kernel mode).  */
+
+static void
+ev5_reset_ctr(struct op_register_config *reg, unsigned long ctr)
+{
+	unsigned long values, mask, not_pk, reset_values;
+
+	mask = (ctr == 0 ? 0xfffful << 48
+	        : ctr == 1 ? 0xfffful << 32
+		: 0x3fff << 16);
+
+	not_pk = 1 << 9 | 1 << 8;
+
+	reset_values = reg->reset_values;
+
+	if ((reg->proc_mode & not_pk) == not_pk) {
+		values = wrperfmon(5, 0);
+		values = (reset_values & mask) | (values & ~mask & -2);
+		wrperfmon(6, values);
+	} else {
+		wrperfmon(0, -1);
+		values = wrperfmon(5, 0);
+		values = (reset_values & mask) | (values & ~mask & -2);
+		wrperfmon(6, values);
+		wrperfmon(1, reg->enable);
+	}
+}
+
+static void
+ev5_handle_interrupt(unsigned long which, struct pt_regs *regs,
+		     struct op_counter_config *ctr)
+{
+	/* Record the sample.  */
+	oprofile_add_sample(regs->pc, !user_mode(regs),
+			    which, smp_processor_id());
+}
+
+
+struct op_axp_model op_model_ev5 = {
+	.reg_setup		= ev5_reg_setup,
+	.cpu_setup		= ev5_cpu_setup,
+	.reset_ctr		= ev5_reset_ctr,
+	.handle_interrupt	= ev5_handle_interrupt,
+	.cpu_type		= "alpha/ev5",
+	.num_counters		= 3,
+	.can_set_proc_mode	= 1,
+};
+
+struct op_axp_model op_model_pca56 = {
+	.reg_setup		= pca56_reg_setup,
+	.cpu_setup		= ev5_cpu_setup,
+	.reset_ctr		= ev5_reset_ctr,
+	.handle_interrupt	= ev5_handle_interrupt,
+	.cpu_type		= "alpha/pca56",
+	.num_counters		= 3,
+	.can_set_proc_mode	= 1,
+};
diff -Nru a/arch/alpha/oprofile/op_model_ev6.c b/arch/alpha/oprofile/op_model_ev6.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/alpha/oprofile/op_model_ev6.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,104 @@
+/**
+ * @file arch/alpha/oprofile/op_model_ev6.c
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author Richard Henderson <rth@twiddle.net>
+ */
+
+#include <linux/oprofile.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <asm/ptrace.h>
+#include <asm/system.h>
+
+#include "op_impl.h"
+
+
+/* Compute all of the registers in preparation for enabling profiling.  */
+
+static void
+ev6_reg_setup(struct op_register_config *reg,
+	      struct op_counter_config *ctr,
+	      struct op_system_config *sys)
+{
+	unsigned long ctl, reset, need_reset, i;
+
+	/* Select desired events.  We've mapped the event numbers
+	   such that they fit directly into the event selection fields.  */
+	ctl = 0;
+	if (ctr[0].enabled && ctr[0].event)
+		ctl |= (ctr[0].event & 1) << 4;
+	if (ctr[1].enabled)
+		ctl |= (ctr[1].event - 2) & 15;
+	reg->mux_select = ctl;
+
+	/* Select logging options.  */
+	/* ??? Need to come up with some mechanism to trace only
+	   selected processes.  EV6 does not have a mechanism to
+	   select kernel or user mode only.  For now, enable always.  */
+	reg->proc_mode = 0;
+
+	/* EV6 cannot change the width of the counters as with the
+	   other implementations.  But fortunately, we can write to
+	   the counters and set the value such that it will overflow
+	   at the right time.  */
+	reset = need_reset = 0;
+	for (i = 0; i < 2; ++i) {
+		unsigned long count = ctr[i].count;
+		if (!ctr[i].enabled)
+			continue;
+
+		if (count > 0x100000)
+			count = 0x100000;
+		ctr[i].count = count;
+		reset |= (0x100000 - count) << (i ? 6 : 28);
+		if (count != 0x100000)
+			need_reset |= 1 << i;
+	}
+	reg->reset_values = reset;
+	reg->need_reset = need_reset;
+}
+
+/* Program all of the registers in preparation for enabling profiling.  */
+
+static void
+ev6_cpu_setup (void *x)
+{
+	struct op_register_config *reg = x;
+
+	wrperfmon(2, reg->mux_select);
+	wrperfmon(3, reg->proc_mode);
+	wrperfmon(6, reg->reset_values | 3);
+}
+
+/* CTR is a counter for which the user has requested an interrupt count
+   in between one of the widths selectable in hardware.  Reset the count
+   for CTR to the value stored in REG->RESET_VALUES.  */
+
+static void
+ev6_reset_ctr(struct op_register_config *reg, unsigned long ctr)
+{
+	wrperfmon(6, reg->reset_values | (1 << ctr));
+}
+
+static void
+ev6_handle_interrupt(unsigned long which, struct pt_regs *regs,
+		     struct op_counter_config *ctr)
+{
+	/* Record the sample.  */
+	oprofile_add_sample(regs->pc, !user_mode(regs),
+			    which, smp_processor_id());
+}
+
+
+struct op_axp_model op_model_ev6 = {
+	.reg_setup		= ev6_reg_setup,
+	.cpu_setup		= ev6_cpu_setup,
+	.reset_ctr		= ev6_reset_ctr,
+	.handle_interrupt	= ev6_handle_interrupt,
+	.cpu_type		= "alpha/ev6",
+	.num_counters		= 2,
+	.can_set_proc_mode	= 0,
+};
diff -Nru a/arch/alpha/oprofile/op_model_ev67.c b/arch/alpha/oprofile/op_model_ev67.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/alpha/oprofile/op_model_ev67.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,265 @@
+/**
+ * @file arch/alpha/oprofile/op_model_ev67.c
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author Richard Henderson <rth@twiddle.net>
+ * @author Falk Hueffner <falk@debian.org>
+ */
+
+#include <linux/oprofile.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <asm/ptrace.h>
+#include <asm/system.h>
+
+#include "op_impl.h"
+
+
+/* Compute all of the registers in preparation for enabling profiling.  */
+
+static void
+ev67_reg_setup(struct op_register_config *reg,
+	       struct op_counter_config *ctr,
+	       struct op_system_config *sys)
+{
+	unsigned long ctl, reset, need_reset, i;
+
+	/* Select desired events.  */
+	ctl = 1UL << 4;		/* Enable ProfileMe mode. */
+
+	/* The event numbers are chosen so we can use them directly if
+	   PCTR1 is enabled.  */
+	if (ctr[1].enabled) {
+		ctl |= (ctr[1].event & 3) << 2;
+	} else {
+		if (ctr[0].event == 0) /* cycles */
+			ctl |= 1UL << 2;
+	}
+	reg->mux_select = ctl;
+
+	/* Select logging options.  */
+	/* ??? Need to come up with some mechanism to trace only
+	   selected processes.  EV67 does not have a mechanism to
+	   select kernel or user mode only.  For now, enable always.  */
+	reg->proc_mode = 0;
+
+	/* EV67 cannot change the width of the counters as with the
+	   other implementations.  But fortunately, we can write to
+	   the counters and set the value such that it will overflow
+	   at the right time.  */
+	reset = need_reset = 0;
+	for (i = 0; i < 2; ++i) {
+		unsigned long count = ctr[i].count;
+		if (!ctr[i].enabled)
+			continue;
+
+		if (count > 0x100000)
+			count = 0x100000;
+		ctr[i].count = count;
+		reset |= (0x100000 - count) << (i ? 6 : 28);
+		if (count != 0x100000)
+			need_reset |= 1 << i;
+	}
+	reg->reset_values = reset;
+	reg->need_reset = need_reset;
+}
+
+/* Program all of the registers in preparation for enabling profiling.  */
+
+static void
+ev67_cpu_setup (void *x)
+{
+	struct op_register_config *reg = x;
+
+	wrperfmon(2, reg->mux_select);
+	wrperfmon(3, reg->proc_mode);
+	wrperfmon(6, reg->reset_values | 3);
+}
+
+/* CTR is a counter for which the user has requested an interrupt count
+   in between one of the widths selectable in hardware.  Reset the count
+   for CTR to the value stored in REG->RESET_VALUES.  */
+
+static void
+ev67_reset_ctr(struct op_register_config *reg, unsigned long ctr)
+{
+	wrperfmon(6, reg->reset_values | (1 << ctr));
+}
+
+/* ProfileMe conditions which will show up as counters. We can also
+   detect the following, but it seems unlikely that anybody is
+   interested in counting them:
+    * Reset
+    * MT_FPCR (write to floating point control register)
+    * Arithmetic trap
+    * Dstream Fault
+    * Machine Check (ECC fault, etc.)
+    * OPCDEC (illegal opcode)
+    * Floating point disabled
+    * Differentiate between DTB single/double misses and 3 or 4 level
+      page tables
+    * Istream access violation
+    * Interrupt
+    * Icache Parity Error.
+    * Instruction killed (nop, trapb)
+
+   Unfortunately, there seems to be no way to detect Dcache and Bcache
+   misses; the latter could be approximated by making the counter
+   count Bcache misses, but that is not precise.
+
+   We model this as 20 counters:
+    * PCTR0
+    * PCTR1
+    * 9 ProfileMe events, induced by PCTR0
+    * 9 ProfileMe events, induced by PCTR1
+*/
+
+enum profileme_counters {
+	PM_STALLED,		/* Stalled for at least one cycle
+				   between the fetch and map stages  */
+	PM_TAKEN,		/* Conditional branch taken */
+	PM_MISPREDICT,		/* Branch caused mispredict trap */
+	PM_ITB_MISS,		/* ITB miss */
+	PM_DTB_MISS,		/* DTB miss */
+	PM_REPLAY,		/* Replay trap */
+	PM_LOAD_STORE,		/* Load-store order trap */
+	PM_ICACHE_MISS,		/* Icache miss */
+	PM_UNALIGNED,		/* Unaligned Load/Store */
+	PM_NUM_COUNTERS
+};
+
+static inline void
+op_add_pm(unsigned long pc, int kern, unsigned long counter,
+	  struct op_counter_config *ctr, unsigned long event)
+{
+	unsigned long fake_counter = 2 + event;
+	if (counter == 1)
+		fake_counter += PM_NUM_COUNTERS;
+	if (ctr[fake_counter].enabled)
+		oprofile_add_sample(pc, kern, fake_counter,
+				    smp_processor_id());
+}
+
+static void
+ev67_handle_interrupt(unsigned long which, struct pt_regs *regs,
+		      struct op_counter_config *ctr)
+{
+	unsigned long pmpc, pctr_ctl;
+	int kern = !user_mode(regs);
+	int mispredict = 0;
+	union {
+		unsigned long v;
+		struct {
+			unsigned reserved:	30; /*  0-29 */
+			unsigned overcount:	 3; /* 30-32 */
+			unsigned icache_miss:	 1; /*    33 */
+			unsigned trap_type:	 4; /* 34-37 */
+			unsigned load_store:	 1; /*    38 */
+			unsigned trap:		 1; /*    39 */
+			unsigned mispredict:	 1; /*    40 */
+		} fields;
+	} i_stat;
+
+	enum trap_types {
+		TRAP_REPLAY,
+		TRAP_INVALID0,
+		TRAP_DTB_DOUBLE_MISS_3,
+		TRAP_DTB_DOUBLE_MISS_4,
+		TRAP_FP_DISABLED,
+		TRAP_UNALIGNED,
+		TRAP_DTB_SINGLE_MISS,
+		TRAP_DSTREAM_FAULT,
+		TRAP_OPCDEC,
+		TRAP_INVALID1,
+		TRAP_MACHINE_CHECK,
+		TRAP_INVALID2,
+		TRAP_ARITHMETIC,
+		TRAP_INVALID3,
+		TRAP_MT_FPCR,
+		TRAP_RESET
+	};
+
+	pmpc = wrperfmon(9, 0);
+	/* ??? Don't know how to handle physical-mode PALcode address.  */
+	if (pmpc & 1)
+		return;
+	pmpc &= ~2;		/* clear reserved bit */
+
+	i_stat.v = wrperfmon(8, 0);
+	if (i_stat.fields.trap) {
+		switch (i_stat.fields.trap_type) {
+		case TRAP_INVALID1:
+		case TRAP_INVALID2:
+		case TRAP_INVALID3:
+			/* Pipeline redirection ocurred. PMPC points
+			   to PALcode. Recognize ITB miss by PALcode
+			   offset address, and get actual PC from
+			   EXC_ADDR.  */
+			oprofile_add_sample(regs->pc, kern, which,
+					    smp_processor_id());
+			if ((pmpc & ((1 << 15) - 1)) ==  581)
+				op_add_pm(regs->pc, kern, which,
+					  ctr, PM_ITB_MISS);
+			/* Most other bit and counter values will be
+			   those for the first instruction in the
+			   fault handler, so we're done.  */
+			return;
+		case TRAP_REPLAY:
+			op_add_pm(pmpc, kern, which, ctr,
+				  (i_stat.fields.load_store
+				   ? PM_LOAD_STORE : PM_REPLAY));
+			break;
+		case TRAP_DTB_DOUBLE_MISS_3:
+		case TRAP_DTB_DOUBLE_MISS_4:
+		case TRAP_DTB_SINGLE_MISS:
+			op_add_pm(pmpc, kern, which, ctr, PM_DTB_MISS);
+			break;
+		case TRAP_UNALIGNED:
+			op_add_pm(pmpc, kern, which, ctr, PM_UNALIGNED);
+			break;
+		case TRAP_INVALID0:
+		case TRAP_FP_DISABLED:
+		case TRAP_DSTREAM_FAULT:
+		case TRAP_OPCDEC:
+		case TRAP_MACHINE_CHECK:
+		case TRAP_ARITHMETIC:
+		case TRAP_MT_FPCR:
+		case TRAP_RESET:
+			break;
+		}
+
+		/* ??? JSR/JMP/RET/COR or HW_JSR/HW_JMP/HW_RET/HW_COR
+		   mispredicts do not set this bit but can be
+		   recognized by the presence of one of these
+		   instructions at the PMPC location with bit 39
+		   set.  */
+		if (i_stat.fields.mispredict) {
+			mispredict = 1;
+			op_add_pm(pmpc, kern, which, ctr, PM_MISPREDICT);
+		}
+	}
+
+	oprofile_add_sample(pmpc, kern, which, smp_processor_id());
+
+	pctr_ctl = wrperfmon(5, 0);
+	if (pctr_ctl & (1UL << 27))
+		op_add_pm(pmpc, kern, which, ctr, PM_STALLED);
+
+	/* Unfortunately, TAK is undefined on mispredicted branches.
+	   ??? It is also undefined for non-cbranch insns, should
+	   check that.  */
+	if (!mispredict && pctr_ctl & (1UL << 0))
+		op_add_pm(pmpc, kern, which, ctr, PM_TAKEN);
+}
+
+struct op_axp_model op_model_ev67 = {
+	.reg_setup		= ev67_reg_setup,
+	.cpu_setup		= ev67_cpu_setup,
+	.reset_ctr		= ev67_reset_ctr,
+	.handle_interrupt	= ev67_handle_interrupt,
+	.cpu_type		= "alpha/ev67",
+	.num_counters		= 20,
+	.can_set_proc_mode	= 0,
+};
diff -Nru a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
--- a/arch/arm/mm/alignment.c	Sun Feb 23 22:25:22 2003
+++ b/arch/arm/mm/alignment.c	Sun Feb 23 22:25:22 2003
@@ -400,7 +400,7 @@
 	 * For alignment faults on the ARM922T/ARM920T the MMU  makes
 	 * the FSR (and hence addr) equal to the updated base address
 	 * of the multiple access rather than the restored value.
-	 * Switch this messsage off if we've got a ARM92[02], otherwise
+	 * Switch this message off if we've got a ARM92[02], otherwise
 	 * [ls]dm alignment faults are noisy!
 	 */
 #if !(defined CONFIG_CPU_ARM922T)  && !(defined CONFIG_CPU_ARM920T)
diff -Nru a/arch/cris/boot/compressed/misc.c b/arch/cris/boot/compressed/misc.c
--- a/arch/cris/boot/compressed/misc.c	Sun Feb 23 22:25:26 2003
+++ b/arch/cris/boot/compressed/misc.c	Sun Feb 23 22:25:26 2003
@@ -13,7 +13,7 @@
  */
 
 /* where the piggybacked kernel image expects itself to live.
- * it is the same adress we use when we network load an uncompressed
+ * it is the same address we use when we network load an uncompressed
  * image into DRAM, and it is the address the kernel is linked to live
  * at by etrax100.ld.
  */
diff -Nru a/arch/cris/drivers/eeprom.c b/arch/cris/drivers/eeprom.c
--- a/arch/cris/drivers/eeprom.c	Sun Feb 23 22:25:23 2003
+++ b/arch/cris/drivers/eeprom.c	Sun Feb 23 22:25:23 2003
@@ -802,7 +802,7 @@
   return 1;
 }
 
-/* Reads from current adress. */
+/* Reads from current address. */
 
 static int read_from_eeprom(char * buf, int count)
 {
diff -Nru a/arch/cris/drivers/serial.c b/arch/cris/drivers/serial.c
--- a/arch/cris/drivers/serial.c	Sun Feb 23 22:25:25 2003
+++ b/arch/cris/drivers/serial.c	Sun Feb 23 22:25:25 2003
@@ -1904,7 +1904,7 @@
 		}
 
 #ifdef SERIAL_DEBUG_INTR
-		printk("** OK, disabling ser_interupts\n");
+		printk("** OK, disabling ser_interrupts\n");
 #endif
 		e100_disable_serial_data_irq(info);
 
diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig
--- a/arch/i386/Kconfig	Sun Feb 23 22:25:22 2003
+++ b/arch/i386/Kconfig	Sun Feb 23 22:25:22 2003
@@ -83,18 +83,16 @@
 
 	  If you don't have such a system, you should say N here.
 
-# Visual Workstation support is utterly broken.
-# If you want to see it working mail an VW540 to hch@infradead.org 8)
-#config X86_VISWS
-#	bool "SGI 320/540 (Visual Workstation)"
-#	help
-#	  The SGI Visual Workstation series is an IA32-based workstation
-#	  based on SGI systems chips with some legacy PC hardware attached.
-#
-#	  Say Y here to create a kernel to run on the SGI 320 or 540.
-#
-#	  A kernel compiled for the Visual Workstation will not run on PCs
-#	  and vice versa. See <file:Documentation/sgi-visws.txt> for details.
+config X86_VISWS
+	bool "SGI 320/540 (Visual Workstation)"
+	help
+	  The SGI Visual Workstation series is an IA32-based workstation
+	  based on SGI systems chips with some legacy PC hardware attached.
+
+	  Say Y here to create a kernel to run on the SGI 320 or 540.
+
+	  A kernel compiled for the Visual Workstation will not run on PCs
+	  and vice versa. See <file:Documentation/sgi-visws.txt> for details.
 
 endchoice
 
@@ -433,7 +431,7 @@
 
 config X86_UP_APIC
 	bool "Local APIC support on uniprocessors" if !SMP
-	depends on !X86_VOYAGER
+	depends on !(X86_VISWS || X86_VOYAGER)
 	---help---
 	  A local APIC (Advanced Programmable Interrupt Controller) is an
 	  integrated interrupt controller in the CPU. If you have a single-CPU
@@ -956,158 +954,7 @@
 	  a work-around for a number of buggy BIOSes. Switch this option on if
 	  your computer crashes instead of powering off properly.
 
-config CPU_FREQ
-	bool "CPU Frequency scaling"
-	help
-	  Clock scaling allows you to change the clock speed of CPUs on the
-	  fly. This is a nice method to save battery power on notebooks,
-	  because the lower the clock speed, the less power the CPU consumes.
-
-	  For more information, take a look at linux/Documentation/cpufreq or
-	  at <http://www.brodo.de/cpufreq/>
-
-	  If in doubt, say N.
-
-config CPU_FREQ_PROC_INTF
-	tristate "/proc/cpufreq interface (DEPRECATED)"
-	depends on CPU_FREQ && PROC_FS
-	help
-	  This enables the /proc/cpufreq interface for controlling
-	  CPUFreq. Please note that it is recommended to use the sysfs
-	  interface instead (which is built automatically). 
-	  
-	  For details, take a look at linux/Documentation/cpufreq. 
-	  
-	  If in doubt, say N.
-
-config CPU_FREQ_24_API
-	bool "/proc/sys/cpu/ interface (2.4. / OLD)"
-	depends on CPU_FREQ
-	help
-	  This enables the /proc/sys/cpu/ sysctl interface for controlling
-	  CPUFreq, as known from the 2.4.-kernel patches for CPUFreq. 2.5
-	  uses a sysfs interface instead. Please note that some drivers do 
-	  not work well with the 2.4. /proc/sys/cpu sysctl interface,
-	  so if in doubt, say N here.
-
-	  For details, take a look at linux/Documentation/cpufreq. 
-
-	  If in doubt, say N.
-
-config CPU_FREQ_TABLE
-       tristate "CPU frequency table helpers"
-       depends on CPU_FREQ
-       default y
-       help
-         Many CPUFreq drivers use these helpers, so only say N here if
-	 the CPUFreq driver of your choice doesn't need these helpers.
-
-	 If in doubt, say Y.
-
-config X86_ACPI_CPUFREQ
-	tristate "ACPI Processor P-States driver"
-	depends on CPU_FREQ_TABLE && ACPI_PROCESSOR
-	help
-	  This driver adds a CPUFreq driver which utilizes the ACPI
-	  Processor Performance States.
-
-	  For details, take a look at linux/Documentation/cpufreq. 
-
-	  If in doubt, say N.
-
-config X86_POWERNOW_K6
-	tristate "AMD Mobile K6-2/K6-3 PowerNow!"
-	depends on CPU_FREQ_TABLE
-	help
-	  This adds the CPUFreq driver for mobile AMD K6-2+ and mobile
-	  AMD K6-3+ processors.
-
-	  For details, take a look at linux/Documentation/cpufreq. 
-
-	  If in doubt, say N.
-
-config X86_POWERNOW_K7
-	tristate "AMD Mobile Athlon/Duron PowerNow!"
-	depends on CPU_FREQ_TABLE
-	help
-	  This adds the CPUFreq driver for mobile AMD K7 mobile processors.
-
-	  For details, take a look at linux/Documentation/cpufreq. 
-
-	  If in doubt, say N.
-
-config ELAN_CPUFREQ
-	tristate "AMD Elan"
-	depends on CPU_FREQ_TABLE && MELAN
-	---help---
-	  This adds the CPUFreq driver for AMD Elan SC400 and SC410
-	  processors.
-
-	  You need to specify the processor maximum speed as boot
-	  parameter: elanfreq=maxspeed (in kHz) or as module
-	  parameter "max_freq".
-
-	  For details, take a look at linux/Documentation/cpufreq. 
-
-	  If in doubt, say N.
-
-config X86_LONGHAUL
-	tristate "VIA Cyrix III Longhaul"
-	depends on CPU_FREQ
-	help
-	  This adds the CPUFreq driver for VIA Samuel/CyrixIII, 
-	  VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T 
-	  processors.
-
-	  For details, take a look at linux/Documentation/cpufreq. 
-
-	  If in doubt, say N.
-
-config X86_SPEEDSTEP
-	tristate "Intel Speedstep"
-	depends on CPU_FREQ_TABLE
-	help
-	  This adds the CPUFreq driver for certain mobile Intel Pentium III
-	  (Coppermine), all mobile Intel Pentium III-M (Tulatin) and all
-	  mobile Intel Pentium 4 P4-Ms.
-
-	  For details, take a look at linux/Documentation/cpufreq. 
-
-	  If in doubt, say N.
-
-config X86_P4_CLOCKMOD
-	tristate "Intel Pentium 4 clock modulation"
-	depends on CPU_FREQ_TABLE
-	help
-	  This adds the CPUFreq driver for Intel Pentium 4 / XEON
-	  processors.
-
-	  For details, take a look at linux/Documentation/cpufreq. 
-
-	  If in doubt, say N.
-
-config X86_LONGRUN
-	tristate "Transmeta LongRun"
-	depends on CPU_FREQ
-	help
-	  This adds the CPUFreq driver for Transmeta Crusoe processors which
-	  support LongRun.
-
-	  For details, take a look at linux/Documentation/cpufreq. 
-
-	  If in doubt, say N.
-
-config X86_GX_SUSPMOD
-	tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation"
-	depends on CPU_FREQ
-	help
-	 This add the CPUFreq driver for NatSemi Geode processors which
-	 support suspend modulation.
-
-	 For details, take a look at linux/Documentation/cpufreq.
-
-	 If in doubt, say N.
-
+source "arch/i386/kernel/cpu/cpufreq/Kconfig"
 
 endmenu
 
@@ -1180,7 +1027,7 @@
 
 config PCI_DIRECT
 	bool
-	depends on !X86_VISWS && PCI && (PCI_GODIRECT || PCI_GOANY)
+ 	depends on PCI && ((PCI_GODIRECT || PCI_GOANY) || X86_VISWS)
 	default y
 
 config SCx200
@@ -1673,7 +1520,7 @@
 
 config X86_MPPARSE
 	bool
-	depends on X86_LOCAL_APIC
+	depends on X86_LOCAL_APIC && !X86_VISWS
 	default y
 
 endmenu
@@ -1691,15 +1538,15 @@
 
 config X86_HT
 	bool
-	depends on SMP && !X86_VOYAGER
+	depends on SMP && !(X86_VISWS || X86_VOYAGER)
 	default y
 
 config X86_BIOS_REBOOT
 	bool
-	depends on !X86_VOYAGER
+	depends on !(X86_VISWS || X86_VOYAGER)
 	default y
 
 config X86_TRAMPOLINE
 	bool
-	depends on SMP
+	depends on SMP || X86_VISWS
 	default y
diff -Nru a/arch/i386/Makefile b/arch/i386/Makefile
--- a/arch/i386/Makefile	Sun Feb 23 22:25:23 2003
+++ b/arch/i386/Makefile	Sun Feb 23 22:25:23 2003
@@ -17,7 +17,7 @@
 
 LDFLAGS		:= -m elf_i386
 OBJCOPYFLAGS	:= -O binary -R .note -R .comment -S
-LDFLAGS_vmlinux := -e stext
+LDFLAGS_vmlinux :=
 LDFLAGS_BLOB	:= --format binary --oformat elf32-i386
 
 CFLAGS += -pipe
@@ -27,6 +27,8 @@
 # prevent gcc from keeping the stack 16 byte aligned
 CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)
 
+align := $(subst -functions=0,,$(call check_gcc,-falign-functions=0,-malign-functions=0))
+
 cflags-$(CONFIG_M386)		+= -march=i386
 cflags-$(CONFIG_M486)		+= -march=i486
 cflags-$(CONFIG_M586)		+= -march=i586
@@ -37,15 +39,13 @@
 cflags-$(CONFIG_MPENTIUMIII)	+= $(call check_gcc,-march=pentium3,-march=i686)
 cflags-$(CONFIG_MPENTIUM4)	+= $(call check_gcc,-march=pentium4,-march=i686)
 cflags-$(CONFIG_MK6)		+= $(call check_gcc,-march=k6,-march=i586)
-cflags-$(CONFIG_MK7)		+= $(call check_gcc,-march=athlon,-march=i686 -malign-functions=4)
-cflags-$(CONFIG_MK8)		+= $(call check_gcc,-march=k8,$(call check_gcc,-march=athlon,-march=i686 -malign-functions=4))
-cflags-$(CONFIG_MCRUSOE)	+= -march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
+cflags-$(CONFIG_MK7)		+= $(call check_gcc,-march=athlon,-march=i686 $(align)-functions=4)
+cflags-$(CONFIG_MK8)		+= $(call check_gcc,-march=k8,$(call check_gcc,-march=athlon,-march=i686 $(align)-functions=4))
+cflags-$(CONFIG_MCRUSOE)	+= -march=i686 $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0
 cflags-$(CONFIG_MWINCHIPC6)	+= $(call check_gcc,-march=winchip-c6,-march=i586)
 cflags-$(CONFIG_MWINCHIP2)	+= $(call check_gcc,-march=winchip2,-march=i586)
 cflags-$(CONFIG_MWINCHIP3D)	+= -march=i586
-cflags-$(CONFIG_MCYRIXIII)	+= $(call check_gcc,-march=c3,-march=i486)
-# The alignment flags change with gcc 3.2
-cflags-$(CONFIG_MCYRIXIII)	+= $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
+cflags-$(CONFIG_MCYRIXIII)	+= $(call check_gcc,-march=c3,-march=i486) $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0
 cflags-$(CONFIG_MVIAC3_2)	+= $(call check_gcc,-march=c3-2,-march=i686)
 
 CFLAGS += $(cflags-y)
diff -Nru a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
--- a/arch/i386/kernel/Makefile	Sun Feb 23 22:25:22 2003
+++ b/arch/i386/kernel/Makefile	Sun Feb 23 22:25:22 2003
@@ -6,7 +6,8 @@
 
 obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
 		ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \
-		pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o
+		pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \
+		doublefault.o
 
 obj-y				+= cpu/
 obj-y				+= timers/
@@ -24,7 +25,6 @@
 obj-$(CONFIG_X86_IO_APIC)	+= io_apic.o
 obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend.o suspend_asm.o
 obj-$(CONFIG_X86_NUMAQ)		+= numaq.o
-obj-$(CONFIG_PROFILING)		+= profile.o
 obj-$(CONFIG_EDD)             	+= edd.o
 obj-$(CONFIG_MODULES)		+= module.o
 obj-y				+= sysenter.o
diff -Nru a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
--- a/arch/i386/kernel/apic.c	Sun Feb 23 22:25:27 2003
+++ b/arch/i386/kernel/apic.c	Sun Feb 23 22:25:27 2003
@@ -50,9 +50,21 @@
 /* Using APIC to generate smp_local_timer_interrupt? */
 int using_apic_timer = 0;
 
-int prof_multiplier[NR_CPUS] = { 1, };
-int prof_old_multiplier[NR_CPUS] = { 1, };
-DEFINE_PER_CPU(int, prof_counter) = 1;
+static DEFINE_PER_CPU(int, prof_multiplier) = 1;
+static DEFINE_PER_CPU(int, prof_old_multiplier) = 1;
+static DEFINE_PER_CPU(int, prof_counter) = 1;
+
+void enable_NMI_through_LVT0 (void * dummy)
+{
+	unsigned int v, ver;
+
+	ver = apic_read(APIC_LVR);
+	ver = GET_APIC_VERSION(ver);
+	v = APIC_DM_NMI;			/* unmask and set to NMI */
+	if (!APIC_INTEGRATED(ver))		/* 82489DX */
+		v |= APIC_LVT_LEVEL_TRIGGER;
+	apic_write_around(APIC_LVT0, v);
+}
 
 int get_maxlvt(void)
 {
@@ -974,7 +986,7 @@
 	 * accordingly.
 	 */
 	for (i = 0; i < NR_CPUS; ++i)
-		prof_multiplier[i] = multiplier;
+		per_cpu(prof_multiplier, i) = multiplier;
 
 	return 0;
 }
@@ -1006,12 +1018,14 @@
 		 *
 		 * Interrupts are already masked off at this point.
 		 */
-		per_cpu(prof_counter, cpu) = prof_multiplier[cpu];
-		if (per_cpu(prof_counter, cpu) != prof_old_multiplier[cpu]) {
+		per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu);
+		if (per_cpu(prof_counter, cpu) !=
+					per_cpu(prof_old_multiplier, cpu)) {
 			__setup_APIC_LVTT(
 					calibration_result/
 					per_cpu(prof_counter, cpu));
-			prof_old_multiplier[cpu] = per_cpu(prof_counter, cpu);
+			per_cpu(prof_old_multiplier, cpu) =
+						per_cpu(prof_counter, cpu);
 		}
 
 #ifdef CONFIG_SMP
diff -Nru a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
--- a/arch/i386/kernel/cpu/common.c	Sun Feb 23 22:25:21 2003
+++ b/arch/i386/kernel/cpu/common.c	Sun Feb 23 22:25:21 2003
@@ -490,6 +490,10 @@
 	load_TR_desc();
 	load_LDT(&init_mm.context);
 
+	/* Set up doublefault TSS pointer in the GDT */
+	__set_tss_desc(cpu, GDT_ENTRY_DOUBLEFAULT_TSS, &doublefault_tss);
+	cpu_gdt_table[cpu][GDT_ENTRY_DOUBLEFAULT_TSS].b &= 0xfffffdff;
+
 	/* Clear %fs and %gs. */
 	asm volatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs");
 
diff -Nru a/arch/i386/kernel/cpu/cpufreq/Kconfig b/arch/i386/kernel/cpu/cpufreq/Kconfig
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/i386/kernel/cpu/cpufreq/Kconfig	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,152 @@
+#
+# CPU Frequency scaling
+#
+
+menu "CPU Frequency scaling"
+
+config CPU_FREQ
+	bool "CPU Frequency scaling"
+	help
+	  Clock scaling allows you to change the clock speed of CPUs on the
+	  fly. This is a nice method to save battery power on notebooks,
+	  because the lower the clock speed, the less power the CPU consumes.
+
+	  For more information, take a look at linux/Documentation/cpufreq or
+	  at <http://www.brodo.de/cpufreq/>
+
+	  If in doubt, say N.
+
+source "drivers/cpufreq/Kconfig"
+
+config CPU_FREQ_24_API
+	bool "/proc/sys/cpu/ interface (2.4. / OLD)"
+	depends on CPU_FREQ
+	help
+	  This enables the /proc/sys/cpu/ sysctl interface for controlling
+	  CPUFreq, as known from the 2.4.-kernel patches for CPUFreq. 2.5
+	  uses a sysfs interface instead. Please note that some drivers do 
+	  not work well with the 2.4. /proc/sys/cpu sysctl interface,
+	  so if in doubt, say N here.
+
+	  For details, take a look at linux/Documentation/cpufreq. 
+
+	  If in doubt, say N.
+
+config CPU_FREQ_TABLE
+       tristate "CPU frequency table helpers"
+       depends on CPU_FREQ
+       default y
+       help
+         Many CPUFreq drivers use these helpers, so only say N here if
+	 the CPUFreq driver of your choice doesn't need these helpers.
+
+	 If in doubt, say Y.
+
+comment "CPUFreq processor drivers"
+       depends on CPU_FREQ
+
+config X86_ACPI_CPUFREQ
+	tristate "ACPI Processor P-States driver"
+	depends on CPU_FREQ_TABLE && ACPI_PROCESSOR
+	help
+	  This driver adds a CPUFreq driver which utilizes the ACPI
+	  Processor Performance States.
+
+	  For details, take a look at linux/Documentation/cpufreq. 
+
+	  If in doubt, say N.
+
+config ELAN_CPUFREQ
+	tristate "AMD Elan"
+	depends on CPU_FREQ_TABLE && MELAN
+	---help---
+	  This adds the CPUFreq driver for AMD Elan SC400 and SC410
+	  processors.
+
+	  You need to specify the processor maximum speed as boot
+	  parameter: elanfreq=maxspeed (in kHz) or as module
+	  parameter "max_freq".
+
+	  For details, take a look at linux/Documentation/cpufreq. 
+
+	  If in doubt, say N.
+
+config X86_POWERNOW_K6
+	tristate "AMD Mobile K6-2/K6-3 PowerNow!"
+	depends on CPU_FREQ_TABLE
+	help
+	  This adds the CPUFreq driver for mobile AMD K6-2+ and mobile
+	  AMD K6-3+ processors.
+
+	  For details, take a look at linux/Documentation/cpufreq. 
+
+	  If in doubt, say N.
+
+config X86_POWERNOW_K7
+	tristate "AMD Mobile Athlon/Duron PowerNow!"
+	depends on CPU_FREQ_TABLE
+	help
+	  This adds the CPUFreq driver for mobile AMD K7 mobile processors.
+
+	  For details, take a look at linux/Documentation/cpufreq. 
+
+	  If in doubt, say N.
+
+config X86_GX_SUSPMOD
+	tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation"
+	depends on CPU_FREQ
+	help
+	 This add the CPUFreq driver for NatSemi Geode processors which
+	 support suspend modulation.
+
+	 For details, take a look at linux/Documentation/cpufreq.
+
+	 If in doubt, say N.
+
+config X86_SPEEDSTEP
+	tristate "Intel Speedstep"
+	depends on CPU_FREQ_TABLE
+	help
+	  This adds the CPUFreq driver for certain mobile Intel Pentium III
+	  (Coppermine), all mobile Intel Pentium III-M (Tulatin) and all
+	  mobile Intel Pentium 4 P4-Ms.
+
+	  For details, take a look at linux/Documentation/cpufreq. 
+
+	  If in doubt, say N.
+
+config X86_P4_CLOCKMOD
+	tristate "Intel Pentium 4 clock modulation"
+	depends on CPU_FREQ_TABLE
+	help
+	  This adds the CPUFreq driver for Intel Pentium 4 / XEON
+	  processors.
+
+	  For details, take a look at linux/Documentation/cpufreq. 
+
+	  If in doubt, say N.
+
+config X86_LONGRUN
+	tristate "Transmeta LongRun"
+	depends on CPU_FREQ
+	help
+	  This adds the CPUFreq driver for Transmeta Crusoe processors which
+	  support LongRun.
+
+	  For details, take a look at linux/Documentation/cpufreq. 
+
+	  If in doubt, say N.
+
+config X86_LONGHAUL
+	tristate "VIA Cyrix III Longhaul"
+	depends on CPU_FREQ
+	help
+	  This adds the CPUFreq driver for VIA Samuel/CyrixIII, 
+	  VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T 
+	  processors.
+
+	  For details, take a look at linux/Documentation/cpufreq. 
+
+	  If in doubt, say N.
+
+endmenu
diff -Nru a/arch/i386/kernel/cpu/cpufreq/longrun.c b/arch/i386/kernel/cpu/cpufreq/longrun.c
--- a/arch/i386/kernel/cpu/cpufreq/longrun.c	Sun Feb 23 22:25:25 2003
+++ b/arch/i386/kernel/cpu/cpufreq/longrun.c	Sun Feb 23 22:25:25 2003
@@ -1,7 +1,7 @@
 /*
- *  $Id: longrun.c,v 1.14 2002/10/31 21:17:40 db Exp $
+ *  $Id: longrun.c,v 1.22 2003/02/10 17:31:50 db Exp $
  *
- * (C) 2002  Dominik Brodowski <linux@brodo.de>
+ * (C) 2002 - 2003  Dominik Brodowski <linux@brodo.de>
  *
  *  Licensed under the terms of the GNU GPL License version 2.
  *
@@ -18,7 +18,7 @@
 #include <asm/processor.h>
 #include <asm/timex.h>
 
-static struct cpufreq_driver	*longrun_driver;
+static struct cpufreq_driver	longrun_driver;
 
 /**
  * longrun_{low,high}_freq is needed for the conversion of cpufreq kHz 
@@ -39,9 +39,6 @@
 {
 	u32 msr_lo, msr_hi;
 
-	if (!longrun_driver)
-		return;
-
 	rdmsr(MSR_TMTA_LONGRUN_FLAGS, msr_lo, msr_hi);
 	if (msr_lo & 0x01)
 		policy->policy = CPUFREQ_POLICY_PERFORMANCE;
@@ -72,7 +69,7 @@
 	u32 msr_lo, msr_hi;
 	u32 pctg_lo, pctg_hi;
 
-	if (!longrun_driver || !policy)
+	if (!policy)
 		return -EINVAL;
 
 	pctg_lo = (policy->min - longrun_low_freq) / 
@@ -117,13 +114,16 @@
  */
 static int longrun_verify_policy(struct cpufreq_policy *policy)
 {
-	if (!policy || !longrun_driver)
+	if (!policy)
 		return -EINVAL;
 
 	policy->cpu = 0;
 	cpufreq_verify_within_limits(policy, 
-		longrun_driver->policy[0].cpuinfo.min_freq, 
-		longrun_driver->policy[0].cpuinfo.max_freq);
+		policy->cpuinfo.min_freq, 
+		policy->cpuinfo.max_freq);
+
+	if (policy->policy == CPUFREQ_POLICY_GOVERNOR)
+		policy->policy = longrun_driver.policy[0].policy;
 
 	return 0;
 }
@@ -221,59 +221,59 @@
 }
 
 
-/**
- * longrun_init - initializes the Transmeta Crusoe LongRun CPUFreq driver
- *
- * Initializes the LongRun support.
- */
-static int __init longrun_init(void)
+static int longrun_cpu_init(struct cpufreq_policy *policy)
 {
-	int                     result;
-	struct cpufreq_driver   *driver;
+	int                     result = 0;
 	struct cpuinfo_x86 *c = cpu_data;
 
+	/* capability check */
+	if (policy->cpu != 0)
+		return -ENODEV;
 	if (c->x86_vendor != X86_VENDOR_TRANSMETA || 
 	    !cpu_has(c, X86_FEATURE_LONGRUN))
-		return 0;
+		return -ENODEV;
 
-	/* initialization of main "cpufreq" code*/
-	driver = kmalloc(sizeof(struct cpufreq_driver) + 
-			 NR_CPUS * sizeof(struct cpufreq_policy), GFP_KERNEL);
-	if (!driver)
-		return -ENOMEM;
-	memset(driver, 0, sizeof(struct cpufreq_driver) +
-			NR_CPUS * sizeof(struct cpufreq_policy));
-
-	driver->policy = (struct cpufreq_policy *) (driver + 1);
-
-	if (longrun_determine_freqs(&longrun_low_freq, &longrun_high_freq)) {
-		kfree(driver);
-		return -EIO;
-	}
-	driver->policy[0].cpuinfo.min_freq = longrun_low_freq;
-	driver->policy[0].cpuinfo.max_freq = longrun_high_freq;
-	driver->policy[0].cpuinfo.transition_latency = CPUFREQ_ETERNAL;
+	/* detect low and high frequency */
+	result = longrun_determine_freqs(&longrun_low_freq, &longrun_high_freq);
+	if (result)
+		return result;
+
+	/* cpuinfo and default policy values */
+	policy->cpuinfo.min_freq = longrun_low_freq;
+	policy->cpuinfo.max_freq = longrun_high_freq;
+	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
+	longrun_get_policy(policy);
+	
+#ifdef CONFIG_CPU_FREQ_24_API
+	longrun_driver.cpu_cur_freq[policy->cpu] = longrun_low_freq; /* dummy value */
+#endif
 
-	strncpy(driver->name, "longrun", CPUFREQ_NAME_LEN);
+	return 0;
+}
 
-	longrun_get_policy(&driver->policy[0]);
 
-#ifdef CONFIG_CPU_FREQ_24_API
-	driver->cpu_cur_freq[0] = longrun_high_freq; /* dummy value */
-#endif
+static struct cpufreq_driver longrun_driver = {
+	.verify 	= longrun_verify_policy,
+	.setpolicy 	= longrun_set_policy,
+	.init		= longrun_cpu_init,
+	.name		= "longrun",
+};
 
-	driver->verify         = &longrun_verify_policy;
-	driver->setpolicy      = &longrun_set_policy;
 
-	longrun_driver = driver;
+/**
+ * longrun_init - initializes the Transmeta Crusoe LongRun CPUFreq driver
+ *
+ * Initializes the LongRun support.
+ */
+static int __init longrun_init(void)
+{
+	struct cpuinfo_x86 *c = cpu_data;
 
-	result = cpufreq_register(driver);
-	if (result) {
-		longrun_driver = NULL;
-		kfree(driver);
-	}
+	if (c->x86_vendor != X86_VENDOR_TRANSMETA || 
+	    !cpu_has(c, X86_FEATURE_LONGRUN))
+		return -ENODEV;
 
-	return result;
+	return cpufreq_register_driver(&longrun_driver);
 }
 
 
@@ -282,15 +282,13 @@
  */
 static void __exit longrun_exit(void)
 {
-	if (longrun_driver) {
-		cpufreq_unregister();
-		kfree(longrun_driver);
-	}
+	cpufreq_unregister_driver(&longrun_driver);
 }
 
 
 MODULE_AUTHOR ("Dominik Brodowski <linux@brodo.de>");
 MODULE_DESCRIPTION ("LongRun driver for Transmeta Crusoe processors.");
 MODULE_LICENSE ("GPL");
+
 module_init(longrun_init);
 module_exit(longrun_exit);
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	Sun Feb 23 22:25:26 2003
+++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c	Sun Feb 23 22:25:26 2003
@@ -1,5 +1,6 @@
 /*
  *	Pentium 4/Xeon CPU on demand clock modulation/speed scaling
+ *	(C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
  *	(C) 2002 Zwane Mwaikambo <zwane@commfireservices.com>
  *	(C) 2002 Arjan van de Ven <arjanv@redhat.com>
  *	(C) 2002 Tora T. Engstad
@@ -45,11 +46,10 @@
 #define DC_ENTRIES	8
 
 
-static int has_N44_O17_errata;
+static int has_N44_O17_errata[NR_CPUS];
 static int stock_freq;
-MODULE_PARM(stock_freq, "i");
 
-static struct cpufreq_driver *cpufreq_p4_driver;
+static struct cpufreq_driver p4clockmod_driver;
 
 
 static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
@@ -107,17 +107,17 @@
 
 	rdmsr(MSR_IA32_THERM_STATUS, l, h);
 	if (l & 0x01)
-		printk(KERN_DEBUG PFX "CPU#%d currently thermal throttled\n", cpu);
+//		printk(KERN_DEBUG PFX "CPU#%d currently thermal throttled\n", cpu);
 
-	if (has_N44_O17_errata && (newstate == DC_25PT || newstate == DC_DFLT))
+	if (has_N44_O17_errata[cpu] && (newstate == DC_25PT || newstate == DC_DFLT))
 		newstate = DC_38PT;
 
 	rdmsr(MSR_IA32_THERM_CONTROL, l, h);
 	if (newstate == DC_DISABLE) {
-		printk(KERN_INFO PFX "CPU#%d disabling modulation\n", cpu);
+//		printk(KERN_INFO PFX "CPU#%d disabling modulation\n", cpu);
 		wrmsr(MSR_IA32_THERM_CONTROL, l & ~(1<<4), h);
 	} else {
-		printk(KERN_INFO PFX "CPU#%d setting duty cycle to %d%%\n", cpu, ((125 * newstate) / 10));
+//		printk(KERN_INFO PFX "CPU#%d setting duty cycle to %d%%\n", cpu, ((125 * newstate) / 10));
 		/* bits 63 - 5	: reserved 
 		 * bit  4	: enable/disable
 		 * bits 3-1	: duty cycle
@@ -155,14 +155,16 @@
 };
 
 
-static int cpufreq_p4_setpolicy(struct cpufreq_policy *policy)
+static int cpufreq_p4_target(struct cpufreq_policy *policy,
+			     unsigned int target_freq,
+			     unsigned int relation)
 {
 	unsigned int    newstate = DC_RESV;
 
-	if (cpufreq_frequency_table_setpolicy(policy, &p4clockmod_table[0], &newstate))
+	if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], target_freq, relation, &newstate))
 		return -EINVAL;
 
-	cpufreq_p4_setdc(policy->cpu, newstate);
+	cpufreq_p4_setdc(policy->cpu, p4clockmod_table[newstate].index);
 
 	return 0;
 }
@@ -174,39 +176,30 @@
 }
 
 
-static int __init cpufreq_p4_init(void)
-{	
-	struct cpuinfo_x86 *c = cpu_data;
-	int cpuid;
-	int ret;
-	struct cpufreq_driver *driver;
+static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
+{
+	struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
+	int cpuid = 0;
 	unsigned int i;
 
-	/*
-	 * THERM_CONTROL is architectural for IA32 now, so 
-	 * we can rely on the capability checks
-	 */
+	/* capability check */
 	if (c->x86_vendor != X86_VENDOR_INTEL)
 		return -ENODEV;
-
 	if (!test_bit(X86_FEATURE_ACPI, c->x86_capability) ||
-		!test_bit(X86_FEATURE_ACC, c->x86_capability))
+	    !test_bit(X86_FEATURE_ACC, c->x86_capability))
 		return -ENODEV;
-
-	/* Errata workarounds */
+	
+	/* Errata workaround */
 	cpuid = (c->x86 << 8) | (c->x86_model << 4) | c->x86_mask;
 	switch (cpuid) {
-		case 0x0f07:
-		case 0x0f0a:
-		case 0x0f11:
-		case 0x0f12:
-			has_N44_O17_errata = 1;
-		default:
-			break;
+	case 0x0f07:
+	case 0x0f0a:
+	case 0x0f11:
+	case 0x0f12:
+		has_N44_O17_errata[policy->cpu] = 1;
 	}
-
-	printk(KERN_INFO PFX "P4/Xeon(TM) CPU On-Demand Clock Modulation available\n");
-
+	
+	/* get frequency */
 	if (!stock_freq) {
 		if (cpu_khz)
 			stock_freq = cpu_khz;
@@ -216,70 +209,68 @@
 		}
 	}
 
-	driver = kmalloc(sizeof(struct cpufreq_driver) +
-			 NR_CPUS * sizeof(struct cpufreq_policy), GFP_KERNEL);
-	if (!driver)
-		return -ENOMEM;
-	memset(driver, 0, sizeof(struct cpufreq_driver) +
-			NR_CPUS * sizeof(struct cpufreq_policy));
-
-	driver->policy = (struct cpufreq_policy *) (driver + 1);
-
 	/* table init */
 	for (i=1; (p4clockmod_table[i].frequency != CPUFREQ_TABLE_END); i++) {
-		if ((i<2) && (has_N44_O17_errata))
+		if ((i<2) && (has_N44_O17_errata[policy->cpu]))
 			p4clockmod_table[i].frequency = CPUFREQ_ENTRY_INVALID;
 		else
 			p4clockmod_table[i].frequency = (stock_freq * i)/8;
 	}
 	
-
+	/* cpuinfo and default policy values */
+	policy->policy = CPUFREQ_POLICY_PERFORMANCE;
+	policy->cpuinfo.transition_latency = 1000;
 #ifdef CONFIG_CPU_FREQ_24_API
-	for (i=0;i<NR_CPUS;i++) {
-		driver->cpu_cur_freq[i] = stock_freq;
-	}
+	p4clockmod_driver.cpu_cur_freq[policy->cpu] = stock_freq;
 #endif
 
-	driver->verify        = &cpufreq_p4_verify;
-	driver->setpolicy     = &cpufreq_p4_setpolicy;
-	strncpy(driver->name, "p4-clockmod", CPUFREQ_NAME_LEN);
-
-	for (i=0;i<NR_CPUS;i++) {
-		driver->policy[i].cpu    = i;
-		ret = cpufreq_frequency_table_cpuinfo(&driver->policy[i], &p4clockmod_table[0]);
-		if (ret) {
-			kfree(driver);
-			return ret;
-		}
-		driver->policy[i].policy = CPUFREQ_POLICY_PERFORMANCE;
-		driver->policy[i].cpuinfo.transition_latency = CPUFREQ_ETERNAL;
-	}
+	return cpufreq_frequency_table_cpuinfo(policy, &p4clockmod_table[0]);
+}
 
-	cpufreq_p4_driver = driver;
-	
-	ret = cpufreq_register(driver);
-	if (ret) {
-		cpufreq_p4_driver = NULL;
-		kfree(driver);
-	}
 
-	return ret;
+static int cpufreq_p4_cpu_exit(struct cpufreq_policy *policy)
+{
+	return cpufreq_p4_setdc(policy->cpu, DC_DISABLE);
+}
+
+
+static struct cpufreq_driver p4clockmod_driver = {
+	.verify 	= cpufreq_p4_verify,
+	.target		= cpufreq_p4_target,
+	.init		= cpufreq_p4_cpu_init,
+	.exit		= cpufreq_p4_cpu_exit,
+	.name		= "p4-clockmod",
+};
+
+
+static int __init cpufreq_p4_init(void)
+{	
+	struct cpuinfo_x86 *c = cpu_data;
+
+	/*
+	 * THERM_CONTROL is architectural for IA32 now, so 
+	 * we can rely on the capability checks
+	 */
+	if (c->x86_vendor != X86_VENDOR_INTEL)
+		return -ENODEV;
+
+	if (!test_bit(X86_FEATURE_ACPI, c->x86_capability) ||
+		!test_bit(X86_FEATURE_ACC, c->x86_capability))
+		return -ENODEV;
+
+	printk(KERN_INFO PFX "P4/Xeon(TM) CPU On-Demand Clock Modulation available\n");
+
+	return cpufreq_register_driver(&p4clockmod_driver);
 }
 
 
 static void __exit cpufreq_p4_exit(void)
 {
-	unsigned int i;
-
-	if (cpufreq_p4_driver) {
-		for (i=0; i<NR_CPUS; i++) {
-			if (cpu_online(i)) 
-				cpufreq_p4_setdc(i, DC_DISABLE);
-		}
-		cpufreq_unregister();
-		kfree(cpufreq_p4_driver);
-	}
+	cpufreq_unregister_driver(&p4clockmod_driver);
 }
+
+
+MODULE_PARM(stock_freq, "i");
 
 MODULE_AUTHOR ("Zwane Mwaikambo <zwane@commfireservices.com>");
 MODULE_DESCRIPTION ("cpufreq driver for Pentium(TM) 4/Xeon(TM)");
diff -Nru a/arch/i386/kernel/cpu/cpufreq/speedstep.c b/arch/i386/kernel/cpu/cpufreq/speedstep.c
--- a/arch/i386/kernel/cpu/cpufreq/speedstep.c	Sun Feb 23 22:25:21 2003
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep.c	Sun Feb 23 22:25:21 2003
@@ -1,8 +1,8 @@
 /*
- *  $Id: speedstep.c,v 1.58 2002/11/11 15:35:46 db Exp $
+ *  $Id: speedstep.c,v 1.68 2003/01/20 17:31:47 db Exp $
  *
  * (C) 2001  Dave Jones, Arjan van de ven.
- * (C) 2002  Dominik Brodowski <linux@brodo.de>
+ * (C) 2002 - 2003  Dominik Brodowski <linux@brodo.de>
  *
  *  Licensed under the terms of the GNU GPL License version 2.
  *  Based upon reverse engineered information, and on Intel documentation
@@ -30,7 +30,7 @@
 #include <asm/msr.h>
 
 
-static struct cpufreq_driver		*speedstep_driver;
+static struct cpufreq_driver		speedstep_driver;
 
 /* speedstep_chipset:
  *   It is necessary to know which chipset is used. As accesses to 
@@ -208,7 +208,7 @@
 		pm2_blk &= 0xfe;
 		outb(pm2_blk, (pmbase + 0x20));
 
-		/* check if transition was sucessful */
+		/* check if transition was successful */
 		value = inb(pmbase + 0x50);
 
 		/* Enable IRQs */
@@ -217,7 +217,7 @@
 		dprintk(KERN_DEBUG "cpufreq: read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value);
 
 		if (state == (value & 0x1)) {
-			dprintk (KERN_INFO "cpufreq: change to %u MHz succeded\n", (freqs.new / 1000));
+			dprintk (KERN_INFO "cpufreq: change to %u MHz succeeded\n", (freqs.new / 1000));
 		} else {
 			printk (KERN_ERR "cpufreq: change failed - I/O error\n");
 		}
@@ -311,7 +311,7 @@
 			
 		pci_read_config_byte(hostbridge, PCI_REVISION_ID, &rev);
 		if (rev < 5) {
-			dprintk(KERN_INFO "cpufreq: hostbrige does not support speedstep\n");
+			dprintk(KERN_INFO "cpufreq: hostbridge does not support speedstep\n");
 			speedstep_chipset_dev = NULL;
 			return 0;
 		}
@@ -573,11 +573,13 @@
  *
  * Sets a new CPUFreq policy.
  */
-static int speedstep_setpolicy (struct cpufreq_policy *policy)
+static int speedstep_target (struct cpufreq_policy *policy,
+			     unsigned int target_freq,
+			     unsigned int relation)
 {
 	unsigned int    newstate = 0;
 
-	if (cpufreq_frequency_table_setpolicy(policy, &speedstep_freqs[0], &newstate))
+	if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate))
 		return -EINVAL;
 
 	speedstep_set_state(newstate, 1);
@@ -599,6 +601,42 @@
 }
 
 
+static int speedstep_cpu_init(struct cpufreq_policy *policy)
+{
+	int		result = 0;
+	unsigned int	speed;
+
+	/* capability check */
+	if (policy->cpu != 0)
+		return -ENODEV;
+
+	/* detect low and high frequency */
+	result = speedstep_detect_speeds();
+	if (result)
+		return result;
+
+	/* get current speed setting */
+	result = speedstep_get_state(&speed);
+	if (result)
+		return result;
+
+	speed = (speed == SPEEDSTEP_LOW) ? speedstep_low_freq : speedstep_high_freq;
+	dprintk(KERN_INFO "cpufreq: currently at %s speed setting - %i MHz\n", 
+		(speed == speedstep_low_freq) ? "low" : "high",
+		(speed / 1000));
+
+	/* cpuinfo and default policy values */
+	policy->policy = (speed == speedstep_low_freq) ? 
+		CPUFREQ_POLICY_POWERSAVE : CPUFREQ_POLICY_PERFORMANCE;
+	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
+#ifdef CONFIG_CPU_FREQ_24_API
+	speedstep_driver.cpu_cur_freq[policy->cpu] = speed;
+#endif
+
+	return cpufreq_frequency_table_cpuinfo(policy, &speedstep_freqs[0]);
+}
+
+
 #ifndef MODULE
 /**
  * speedstep_setup  speedstep command line parameter parsing
@@ -608,7 +646,7 @@
  * if the CPU in your notebook is a SpeedStep-capable Intel
  * Pentium III Coppermine. These processors cannot be detected
  * automatically, as Intel continues to consider the detection 
- * alogrithm as proprietary material.
+ * algorithm as proprietary material.
  */
 static int __init speedstep_setup(char *str)
 {
@@ -618,6 +656,15 @@
 __setup("speedstep_coppermine=", speedstep_setup);
 #endif
 
+
+static struct cpufreq_driver speedstep_driver = {
+	.name		= "speedstep",
+	.verify 	= speedstep_verify,
+	.target 	= speedstep_target,
+	.init		= speedstep_cpu_init,
+};
+
+
 /**
  * speedstep_init - initializes the SpeedStep CPUFreq driver
  *
@@ -627,11 +674,6 @@
  */
 static int __init speedstep_init(void)
 {
-	int                     result;
-	unsigned int            speed;
-	struct cpufreq_driver   *driver;
-
-
 	/* detect chipset */
 	speedstep_chipset = speedstep_detect_chipset(); 
 
@@ -644,70 +686,13 @@
 		return -ENODEV;
 	}
 
-	dprintk(KERN_INFO "cpufreq: Intel(R) SpeedStep(TM) support $Revision: 1.58 $\n");
-	dprintk(KERN_DEBUG "cpufreq: chipset 0x%x - processor 0x%x\n", 
-	       speedstep_chipset, speedstep_processor);
+	dprintk(KERN_INFO "cpufreq: Intel(R) SpeedStep(TM) support $Revision: 1.68 $\n");
 
 	/* activate speedstep support */
-	result = speedstep_activate();
-	if (result)
-		return result;
-
-	/* detect low and high frequency */
-	result = speedstep_detect_speeds();
-	if (result)
-		return result;
-
-	/* get current speed setting */
-	result = speedstep_get_state(&speed);
-	if (result)
-		return result;
-
-	speed = (speed == SPEEDSTEP_LOW) ? speedstep_low_freq : speedstep_high_freq;
-
-	dprintk(KERN_INFO "cpufreq: currently at %s speed setting - %i MHz\n", 
-	       (speed == speedstep_low_freq) ? "low" : "high",
-	       (speed / 1000));
-
-	/* initialization of main "cpufreq" code*/
-	driver = kmalloc(sizeof(struct cpufreq_driver) + 
-			 NR_CPUS * sizeof(struct cpufreq_policy), GFP_KERNEL);
-	if (!driver)
-		return -ENOMEM;
-	memset(driver, 0, sizeof(struct cpufreq_driver) +
-			NR_CPUS * sizeof(struct cpufreq_policy));
-
-	driver->policy = (struct cpufreq_policy *) (driver + 1);
-
-	driver->policy[0].cpu    = 0;
-	result = cpufreq_frequency_table_cpuinfo(&driver->policy[0], &speedstep_freqs[0]);
-	if (result) {
-		kfree(driver);
-		return result;
-	}
-
-#ifdef CONFIG_CPU_FREQ_24_API
-	driver->cpu_cur_freq[0] = speed;
-#endif
-
-	driver->verify      = &speedstep_verify;
-	driver->setpolicy   = &speedstep_setpolicy;
-	strncpy(driver->name, "speedstep", CPUFREQ_NAME_LEN);
-
-	driver->policy[0].cpuinfo.transition_latency = CPUFREQ_ETERNAL;
-
-	driver->policy[0].policy = (speed == speedstep_low_freq) ? 
-	    CPUFREQ_POLICY_POWERSAVE : CPUFREQ_POLICY_PERFORMANCE;
-
-	speedstep_driver = driver;
-
-	result = cpufreq_register(driver);
-	if (result) {
-		speedstep_driver = NULL;
-		kfree(driver);
-	}
+	if (speedstep_activate())
+		return -EINVAL;
 
-	return result;
+	return cpufreq_register_driver(&speedstep_driver);
 }
 
 
@@ -718,17 +703,15 @@
  */
 static void __exit speedstep_exit(void)
 {
-	if (speedstep_driver) {
-		cpufreq_unregister();
-		kfree(speedstep_driver);
-	}
+	cpufreq_unregister_driver(&speedstep_driver);
 }
 
 
+MODULE_PARM (speedstep_coppermine, "i");
+
 MODULE_AUTHOR ("Dave Jones <davej@suse.de>, Dominik Brodowski <linux@brodo.de>");
 MODULE_DESCRIPTION ("Speedstep driver for Intel mobile processors.");
 MODULE_LICENSE ("GPL");
+
 module_init(speedstep_init);
 module_exit(speedstep_exit);
-
-MODULE_PARM (speedstep_coppermine, "i");
diff -Nru a/arch/i386/kernel/cpu/cyrix.c b/arch/i386/kernel/cpu/cyrix.c
--- a/arch/i386/kernel/cpu/cyrix.c	Sun Feb 23 22:25:22 2003
+++ b/arch/i386/kernel/cpu/cyrix.c	Sun Feb 23 22:25:22 2003
@@ -74,7 +74,7 @@
 
 /*
  * Reset the slow-loop (SLOP) bit on the 686(L) which is set by some old
- * BIOSes for compatability with DOS games.  This makes the udelay loop
+ * BIOSes for compatibility with DOS games.  This makes the udelay loop
  * work correctly, and improves performance.
  *
  * FIXME: our newer udelay uses the tsc. We dont need to frob with SLOP
diff -Nru a/arch/i386/kernel/cpu/mtrr/if.c b/arch/i386/kernel/cpu/mtrr/if.c
--- a/arch/i386/kernel/cpu/mtrr/if.c	Sun Feb 23 22:25:22 2003
+++ b/arch/i386/kernel/cpu/mtrr/if.c	Sun Feb 23 22:25:22 2003
@@ -1,6 +1,5 @@
 #include <linux/init.h>
 #include <linux/proc_fs.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/ctype.h>
 #include <linux/module.h>
 #include <linux/seq_file.h>
@@ -300,8 +299,6 @@
 
 #  endif			/*  CONFIG_PROC_FS  */
 
-static devfs_handle_t devfs_handle;
-
 char * attrib_to_str(int x)
 {
 	return (x <= 6) ? mtrr_strings[x] : "?";
@@ -337,7 +334,6 @@
 			     attrib_to_str(type), usage_table[i]);
 		}
 	}
-	devfs_set_file_size(devfs_handle, len);	
 	return 0;
 }
 
@@ -350,11 +346,6 @@
 		proc_root_mtrr->owner = THIS_MODULE;
 		proc_root_mtrr->proc_fops = &mtrr_fops;
 	}
-#endif
-#ifdef USERSPACE_INTERFACE
-	devfs_handle = devfs_register(NULL, "cpu/mtrr", DEVFS_FL_DEFAULT, 0, 0,
-				      S_IFREG | S_IRUGO | S_IWUSR,
-				      &mtrr_fops, NULL);
 #endif
 	return 0;
 }
diff -Nru a/arch/i386/kernel/doublefault.c b/arch/i386/kernel/doublefault.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/i386/kernel/doublefault.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,65 @@
+#include <linux/mm.h>
+#include <linux/sched.h>
+#include <linux/init.h>
+#include <linux/init_task.h>
+#include <linux/fs.h>
+
+#include <asm/uaccess.h>
+#include <asm/pgtable.h>
+#include <asm/desc.h>
+
+#define DOUBLEFAULT_STACKSIZE (1024)
+static unsigned long doublefault_stack[DOUBLEFAULT_STACKSIZE];
+#define STACK_START (unsigned long)(doublefault_stack+DOUBLEFAULT_STACKSIZE)
+
+#define ptr_ok(x) ((x) > 0xc0000000 && (x) < 0xc1000000)
+
+static void doublefault_fn(void)
+{
+	struct Xgt_desc_struct gdt_desc = {0, 0};
+	unsigned long gdt, tss;
+
+	__asm__ __volatile__("sgdt %0": "=m" (gdt_desc): :"memory");
+	gdt = gdt_desc.address;
+
+	printk("double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size);
+
+	if (ptr_ok(gdt)) {
+		gdt += GDT_ENTRY_TSS << 3;
+		tss = *(u16 *)(gdt+2);
+		tss += *(u8 *)(gdt+4) << 16;
+		tss += *(u8 *)(gdt+7) << 24;
+		printk("double fault, tss at %08lx\n", tss);
+
+		if (ptr_ok(tss)) {
+			struct tss_struct *t = (struct tss_struct *)tss;
+
+			printk("eip = %08lx, esp = %08lx\n", t->eip, t->esp);
+
+			printk("eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n",
+				t->eax, t->ebx, t->ecx, t->edx);
+			printk("esi = %08lx, edi = %08lx\n",
+				t->esi, t->edi);
+		}
+	}
+
+	for (;;) /* nothing */;
+}
+
+struct tss_struct doublefault_tss __cacheline_aligned = {
+	.esp0		= STACK_START,
+	.ss0		= __KERNEL_DS,
+	.ldt		= 0,
+	.bitmap		= INVALID_IO_BITMAP_OFFSET,
+	.io_bitmap	= { [0 ... IO_BITMAP_SIZE ] = ~0 },
+
+	.eip		= (unsigned long) doublefault_fn,
+	.eflags		= 0x00000082,
+	.esp		= STACK_START,
+	.es		= __USER_DS,
+	.cs		= __KERNEL_CS,
+	.ss		= __KERNEL_DS,
+	.ds		= __USER_DS,
+
+	.__cr3		= __pa(swapper_pg_dir)
+};
diff -Nru a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
--- a/arch/i386/kernel/entry.S	Sun Feb 23 22:25:22 2003
+++ b/arch/i386/kernel/entry.S	Sun Feb 23 22:25:22 2003
@@ -41,7 +41,6 @@
  */
 
 #include <linux/config.h>
-#include <linux/sys.h>
 #include <linux/linkage.h>
 #include <asm/thread_info.h>
 #include <asm/errno.h>
@@ -174,9 +173,10 @@
 
 
 ENTRY(ret_from_fork)
-	# NOTE: this function takes a parameter but it's unused on x86.
+	pushl %eax
 	call schedule_tail
 	GET_THREAD_INFO(%ebp)
+	popl %eax
 	jmp syscall_exit
 
 /*
@@ -252,7 +252,7 @@
 	pushl %eax
 	SAVE_ALL
 	GET_THREAD_INFO(%ebp)
-	cmpl $(NR_syscalls), %eax
+	cmpl $(nr_syscalls), %eax
 	jae syscall_badsys
 
 	testb $_TIF_SYSCALL_TRACE,TI_FLAGS(%ebp)
@@ -276,7 +276,7 @@
 	pushl %eax			# save orig_eax
 	SAVE_ALL
 	GET_THREAD_INFO(%ebp)
-	cmpl $(NR_syscalls), %eax
+	cmpl $(nr_syscalls), %eax
 	jae syscall_badsys
 					# system call tracing in operation
 	testb $_TIF_SYSCALL_TRACE,TI_FLAGS(%ebp)
@@ -339,7 +339,7 @@
 	xorl %edx,%edx
 	call do_syscall_trace
 	movl ORIG_EAX(%esp), %eax
-	cmpl $(NR_syscalls), %eax
+	cmpl $(nr_syscalls), %eax
 	jnae syscall_call
 	jmp syscall_exit
 
@@ -500,10 +500,6 @@
 	pushl $do_coprocessor_segment_overrun
 	jmp error_code
 
-ENTRY(double_fault)
-	pushl $do_double_fault
-	jmp error_code
-
 ENTRY(invalid_TSS)
 	pushl $do_invalid_TSS
 	jmp error_code
@@ -801,8 +797,15 @@
 	.long sys_epoll_wait
  	.long sys_remap_file_pages
  	.long sys_set_tid_address
-
-
-	.rept NR_syscalls-(.-sys_call_table)/4
-		.long sys_ni_syscall
-	.endr
+ 	.long sys_timer_create
+ 	.long sys_timer_settime		/* 260 */
+ 	.long sys_timer_gettime
+ 	.long sys_timer_getoverrun
+ 	.long sys_timer_delete
+ 	.long sys_clock_settime
+ 	.long sys_clock_gettime		/* 265 */
+ 	.long sys_clock_getres
+ 	.long sys_clock_nanosleep
+ 
+ 
+nr_syscalls=(.-sys_call_table)/4
diff -Nru a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
--- a/arch/i386/kernel/head.S	Sun Feb 23 22:25:22 2003
+++ b/arch/i386/kernel/head.S	Sun Feb 23 22:25:22 2003
@@ -38,11 +38,37 @@
 #define X86_VENDOR_ID	CPU_PARAMS+28
 
 /*
+ * Initialize page tables
+ */
+#define INIT_PAGE_TABLES \
+	movl $pg0 - __PAGE_OFFSET, %edi; \
+	/* "007" doesn't mean with license to kill, but	PRESENT+RW+USER */ \
+	movl $007, %eax; \
+2:	stosl; \
+	add $0x1000, %eax; \
+	cmp $empty_zero_page - __PAGE_OFFSET, %edi; \
+	jne 2b;
+
+/*
  * swapper_pg_dir is the main page directory, address 0x00101000
  *
  * On entry, %esi points to the real-mode code as a 32-bit pointer.
  */
-startup_32:
+ENTRY(startup_32)
+
+#ifdef CONFIG_X86_VISWS
+/*
+ * On SGI Visual Workstations boot CPU starts in protected mode.
+ */
+	orw %bx, %bx
+	jnz 1f
+	INIT_PAGE_TABLES
+	movl $swapper_pg_dir - __PAGE_OFFSET, %eax
+	movl %eax, %cr3
+	lgdt boot_gdt
+1:
+#endif
+
 /*
  * Set segments to known values
  */
@@ -79,17 +105,7 @@
 	jmp 3f
 1:
 #endif
-/*
- * Initialize page tables
- */
-	movl $pg0-__PAGE_OFFSET,%edi /* initialize page tables */
-	movl $007,%eax		/* "007" doesn't mean with license to kill, but
-				   PRESENT+RW+USER */
-2:	stosl
-	add $0x1000,%eax
-	cmp $empty_zero_page-__PAGE_OFFSET,%edi
-	jne 2b
-
+	INIT_PAGE_TABLES
 /*
  * Enable paging
  */
@@ -412,7 +428,7 @@
 /*
  * The Global Descriptor Table contains 28 quadwords, per-CPU.
  */
-#ifdef CONFIG_SMP
+#if defined(CONFIG_SMP) || defined(CONFIG_X86_VISWS)
 /*
  * The boot_gdt_table must mirror the equivalent in setup.S and is
  * used only by the trampoline for booting other CPUs
@@ -459,6 +475,13 @@
 	.quad 0x00409a0000000000	/* 0xb8 APM CS    code */
 	.quad 0x00009a0000000000	/* 0xc0 APM CS 16 code (16 bit) */
 	.quad 0x0040920000000000	/* 0xc8 APM DS    data */
+
+	.quad 0x0000000000000000	/* 0xd0 - unused */
+	.quad 0x0000000000000000	/* 0xd8 - unused */
+	.quad 0x0000000000000000	/* 0xe0 - unused */
+	.quad 0x0000000000000000	/* 0xe8 - unused */
+	.quad 0x0000000000000000	/* 0xf0 - unused */
+	.quad 0x0000000000000000	/* 0xf8 - GDT entry 31: double-fault TSS */
 
 #if CONFIG_SMP
 	.fill (NR_CPUS-1)*GDT_ENTRIES,8,0 /* other CPU's GDT */
diff -Nru a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
--- a/arch/i386/kernel/i386_ksyms.c	Sun Feb 23 22:25:27 2003
+++ b/arch/i386/kernel/i386_ksyms.c	Sun Feb 23 22:25:27 2003
@@ -104,6 +104,7 @@
 /* Networking helper routines. */
 EXPORT_SYMBOL(csum_partial_copy_generic);
 /* Delay loops */
+EXPORT_SYMBOL(__ndelay);
 EXPORT_SYMBOL(__udelay);
 EXPORT_SYMBOL(__delay);
 EXPORT_SYMBOL(__const_udelay);
@@ -182,8 +183,6 @@
 
 EXPORT_SYMBOL(rtc_lock);
 
-EXPORT_SYMBOL_GPL(register_profile_notifier);
-EXPORT_SYMBOL_GPL(unregister_profile_notifier);
 EXPORT_SYMBOL_GPL(set_nmi_callback);
 EXPORT_SYMBOL_GPL(unset_nmi_callback);
  
diff -Nru a/arch/i386/kernel/i8259.c b/arch/i386/kernel/i8259.c
--- a/arch/i386/kernel/i8259.c	Sun Feb 23 22:25:26 2003
+++ b/arch/i386/kernel/i8259.c	Sun Feb 23 22:25:26 2003
@@ -22,6 +22,7 @@
 #include <asm/desc.h>
 #include <asm/apic.h>
 #include <asm/arch_hooks.h>
+#include <asm/i8259.h>
 
 #include <linux/irq.h>
 
@@ -47,7 +48,7 @@
 
 void mask_and_ack_8259A(unsigned int);
 
-static unsigned int startup_8259A_irq(unsigned int irq)
+unsigned int startup_8259A_irq(unsigned int irq)
 { 
 	enable_8259A_irq(irq);
 	return 0; /* never anything pending */
@@ -71,11 +72,7 @@
 /*
  * This contains the irq mask for both 8259A irq controllers,
  */
-static unsigned int cached_irq_mask = 0xffff;
-
-#define __byte(x,y) 	(((unsigned char *)&(y))[x])
-#define cached_21	(__byte(0,cached_irq_mask))
-#define cached_A1	(__byte(1,cached_irq_mask))
+unsigned int cached_irq_mask = 0xffff;
 
 /*
  * Not all IRQs can be routed through the IO-APIC, eg. on certain (older)
diff -Nru a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
--- a/arch/i386/kernel/io_apic.c	Sun Feb 23 22:25:23 2003
+++ b/arch/i386/kernel/io_apic.c	Sun Feb 23 22:25:23 2003
@@ -222,7 +222,7 @@
 # endif
 
 extern unsigned long irq_affinity [NR_IRQS];
-unsigned long __cacheline_aligned irq_balance_mask [NR_IRQS];
+int __cacheline_aligned pending_irq_balance_apicid [NR_IRQS];
 static int irqbalance_disabled __initdata = 0;
 static int physical_balance = 0;
 
@@ -441,7 +441,7 @@
 		Dprintk("irq = %d moved to cpu = %d\n", selected_irq, min_loaded);
 		/* mark for change destination */
 		spin_lock(&desc->lock);
-		irq_balance_mask[selected_irq] = target_cpu_mask;
+		pending_irq_balance_apicid[selected_irq] = cpu_to_logical_apicid(min_loaded);
 		spin_unlock(&desc->lock);
 		/* Since we made a change, come back sooner to 
 		 * check for more variation.
@@ -500,7 +500,7 @@
 	if (cpu != new_cpu) {
 		irq_desc_t *desc = irq_desc + irq;
 		spin_lock(&desc->lock);
-		irq_balance_mask[irq] = cpu_to_logical_apicid(new_cpu);
+		pending_irq_balance_apicid[irq] = cpu_to_logical_apicid(new_cpu);
 		spin_unlock(&desc->lock);
 	}
 }
@@ -515,7 +515,7 @@
 	
 	/* push everything to CPU 0 to give us a starting point.  */
 	for (i = 0 ; i < NR_IRQS ; i++)
-		irq_balance_mask[i] = 1 << 0;
+		pending_irq_balance_apicid[i] = cpu_to_logical_apicid(0);
 	for (;;) {
 		set_current_state(TASK_INTERRUPTIBLE);
 		time_remaining = schedule_timeout(time_remaining);
@@ -580,9 +580,9 @@
 static inline void move_irq(int irq)
 {
 	/* note - we hold the desc->lock */
-	if (unlikely(irq_balance_mask[irq])) {
-		set_ioapic_affinity(irq, irq_balance_mask[irq]);
-		irq_balance_mask[irq] = 0;
+	if (unlikely(pending_irq_balance_apicid[irq])) {
+		set_ioapic_affinity(irq, pending_irq_balance_apicid[irq]);
+		pending_irq_balance_apicid[irq] = 0;
 	}
 }
 
@@ -1745,25 +1745,25 @@
  */
 
 static struct hw_interrupt_type ioapic_edge_irq_type = {
-	"IO-APIC-edge",
-	startup_edge_ioapic_irq,
-	shutdown_edge_ioapic_irq,
-	enable_edge_ioapic_irq,
-	disable_edge_ioapic_irq,
-	ack_edge_ioapic_irq,
-	end_edge_ioapic_irq,
-	set_ioapic_affinity,
+	.typename 	= "IO-APIC-edge",
+	.startup 	= startup_edge_ioapic_irq,
+	.shutdown 	= shutdown_edge_ioapic_irq,
+	.enable 	= enable_edge_ioapic_irq,
+	.disable 	= disable_edge_ioapic_irq,
+	.ack 		= ack_edge_ioapic_irq,
+	.end 		= end_edge_ioapic_irq,
+	.set_affinity 	= set_ioapic_affinity,
 };
 
 static struct hw_interrupt_type ioapic_level_irq_type = {
-	"IO-APIC-level",
-	startup_level_ioapic_irq,
-	shutdown_level_ioapic_irq,
-	enable_level_ioapic_irq,
-	disable_level_ioapic_irq,
-	mask_and_ack_level_ioapic_irq,
-	end_level_ioapic_irq,
-	set_ioapic_affinity,
+	.typename 	= "IO-APIC-level",
+	.startup 	= startup_level_ioapic_irq,
+	.shutdown 	= shutdown_level_ioapic_irq,
+	.enable 	= enable_level_ioapic_irq,
+	.disable 	= disable_level_ioapic_irq,
+	.ack 		= mask_and_ack_level_ioapic_irq,
+	.end 		= end_level_ioapic_irq,
+	.set_affinity 	= set_ioapic_affinity,
 };
 
 static inline void init_IO_APIC_traps(void)
@@ -1821,26 +1821,14 @@
 static void end_lapic_irq (unsigned int i) { /* nothing */ }
 
 static struct hw_interrupt_type lapic_irq_type = {
-	"local-APIC-edge",
-	NULL, /* startup_irq() not used for IRQ0 */
-	NULL, /* shutdown_irq() not used for IRQ0 */
-	enable_lapic_irq,
-	disable_lapic_irq,
-	ack_lapic_irq,
-	end_lapic_irq
+	.typename 	= "local-APIC-edge",
+	.startup 	= NULL, /* startup_irq() not used for IRQ0 */
+	.shutdown 	= NULL, /* shutdown_irq() not used for IRQ0 */
+	.enable 	= enable_lapic_irq,
+	.disable 	= disable_lapic_irq,
+	.ack 		= ack_lapic_irq,
+	.end 		= end_lapic_irq
 };
-
-void enable_NMI_through_LVT0 (void * dummy)
-{
-	unsigned int v, ver;
-
-	ver = apic_read(APIC_LVR);
-	ver = GET_APIC_VERSION(ver);
-	v = APIC_DM_NMI;			/* unmask and set to NMI */
-	if (!APIC_INTEGRATED(ver))		/* 82489DX */
-		v |= APIC_LVT_LEVEL_TRIGGER;
-	apic_write_around(APIC_LVT0, v);
-}
 
 static void setup_nmi (void)
 {
diff -Nru a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
--- a/arch/i386/kernel/mpparse.c	Sun Feb 23 22:25:23 2003
+++ b/arch/i386/kernel/mpparse.c	Sun Feb 23 22:25:23 2003
@@ -1027,8 +1027,19 @@
 
 		while ((void *) entry < madt_end) {
                 	if (entry->header.type == ACPI_MADT_INT_SRC_OVR &&
-			    acpi_fadt.sci_int == entry->global_irq)
-                		return;
+			    acpi_fadt.sci_int == entry->bus_irq) {
+				/*
+				 * See the note at the end of ACPI 2.0b section
+				 * 5.2.10.8 for what this is about.
+				 */
+				if (entry->bus_irq != entry->global_irq) {
+					acpi_fadt.sci_int = entry->global_irq;
+					irq = entry->global_irq;
+					break;
+				}
+				else
+                			return;
+			}
 
                 	entry = (struct acpi_table_int_src_ovr *)
                 	        ((unsigned long) entry + entry->header.length);
diff -Nru a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
--- a/arch/i386/kernel/process.c	Sun Feb 23 22:25:21 2003
+++ b/arch/i386/kernel/process.c	Sun Feb 23 22:25:21 2003
@@ -423,8 +423,12 @@
  * so the performance issues may eventually be a valid point.
  * More important, however, is the fact that this allows us much
  * more flexibility.
+ *
+ * The return value (in %eax) will be the "prev" task after
+ * the task-switch, and shows up in ret_from_fork in entry.S,
+ * for example.
  */
-void __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+struct task_struct * __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 {
 	struct thread_struct *prev = &prev_p->thread,
 				 *next = &next_p->thread;
@@ -495,6 +499,7 @@
 			 */
 			tss->bitmap = INVALID_IO_BITMAP_OFFSET;
 	}
+	return prev_p;
 }
 
 asmlinkage int sys_fork(struct pt_regs regs)
diff -Nru a/arch/i386/kernel/profile.c b/arch/i386/kernel/profile.c
--- a/arch/i386/kernel/profile.c	Sun Feb 23 22:25:26 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,45 +0,0 @@
-/*
- *	linux/arch/i386/kernel/profile.c
- *
- *	(C) 2002 John Levon <levon@movementarian.org>
- *
- */
-
-#include <linux/profile.h>
-#include <linux/spinlock.h>
-#include <linux/notifier.h>
-#include <linux/irq.h>
-#include <asm/hw_irq.h> 
- 
-static struct notifier_block * profile_listeners;
-static rwlock_t profile_lock = RW_LOCK_UNLOCKED;
- 
-int register_profile_notifier(struct notifier_block * nb)
-{
-	int err;
-	write_lock_irq(&profile_lock);
-	err = notifier_chain_register(&profile_listeners, nb);
-	write_unlock_irq(&profile_lock);
-	return err;
-}
-
-
-int unregister_profile_notifier(struct notifier_block * nb)
-{
-	int err;
-	write_lock_irq(&profile_lock);
-	err = notifier_chain_unregister(&profile_listeners, nb);
-	write_unlock_irq(&profile_lock);
-	return err;
-}
-
-
-void x86_profile_hook(struct pt_regs * regs)
-{
-	/* we would not even need this lock if
-	 * we had a global cli() on register/unregister
-	 */ 
-	read_lock(&profile_lock);
-	notifier_call_chain(&profile_listeners, 0, regs);
-	read_unlock(&profile_lock);
-}
diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
--- a/arch/i386/kernel/setup.c	Sun Feb 23 22:25:24 2003
+++ b/arch/i386/kernel/setup.c	Sun Feb 23 22:25:24 2003
@@ -92,7 +92,6 @@
 extern int root_mountflags;
 extern char _text, _etext, _edata, _end;
 extern int blk_nohighio;
-void __init visws_get_board_type_and_rev(void);
 
 unsigned long saved_videomode;
 
diff -Nru a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
--- a/arch/i386/kernel/time.c	Sun Feb 23 22:25:24 2003
+++ b/arch/i386/kernel/time.c	Sun Feb 23 22:25:24 2003
@@ -135,6 +135,7 @@
 	time_maxerror = NTP_PHASE_LIMIT;
 	time_esterror = NTP_PHASE_LIMIT;
 	write_sequnlock_irq(&xtime_lock);
+	clock_was_set();
 }
 
 /*
diff -Nru a/arch/i386/kernel/trampoline.S b/arch/i386/kernel/trampoline.S
--- a/arch/i386/kernel/trampoline.S	Sun Feb 23 22:25:23 2003
+++ b/arch/i386/kernel/trampoline.S	Sun Feb 23 22:25:23 2003
@@ -46,8 +46,8 @@
 	movl	$0xA5A5A5A5, trampoline_data - r_base
 				# write marker for master knows we're running
 
-	lidt	idt_48 - r_base	# load idt with 0, 0
-	lgdt	gdt_48 - r_base	# load gdt with whatever is appropriate
+	lidt	boot_idt - r_base	# load idt with 0, 0
+	lgdt	boot_gdt - r_base	# load gdt with whatever is appropriate
 
 	xor	%ax, %ax
 	inc	%ax		# protected mode (PE) bit
@@ -57,7 +57,7 @@
 	ljmpl	$__BOOT_CS, $0x00100000
 			# jump to startup_32 in arch/i386/kernel/head.S
 
-idt_48:
+boot_idt:
 	.word	0			# idt limit = 0
 	.word	0, 0			# idt base = 0L
 
@@ -65,8 +65,7 @@
 # NOTE: here we actually use CPU#0's GDT - but that is OK, we reload
 # the proper GDT shortly after booting up the secondary CPUs.
 #
-
-gdt_48:
+ENTRY(boot_gdt)
 	.word	__BOOT_DS + 7			# gdt limit
 	.long	boot_gdt_table-__PAGE_OFFSET	# gdt base = gdt (first SMP CPU)
 
diff -Nru a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
--- a/arch/i386/kernel/traps.c	Sun Feb 23 22:25:22 2003
+++ b/arch/i386/kernel/traps.c	Sun Feb 23 22:25:22 2003
@@ -73,7 +73,6 @@
 asmlinkage void bounds(void);
 asmlinkage void invalid_op(void);
 asmlinkage void device_not_available(void);
-asmlinkage void double_fault(void);
 asmlinkage void coprocessor_segment_overrun(void);
 asmlinkage void invalid_TSS(void);
 asmlinkage void segment_not_present(void);
@@ -349,8 +348,6 @@
 DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow)
 DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds)
 DO_ERROR_INFO( 6, SIGILL,  "invalid operand", invalid_op, ILL_ILLOPN, regs->eip)
-DO_VM86_ERROR( 7, SIGSEGV, "device not available", device_not_available)
-DO_ERROR( 8, SIGSEGV, "double fault", double_fault)
 DO_ERROR( 9, SIGFPE,  "coprocessor segment overrun", coprocessor_segment_overrun)
 DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
 DO_ERROR(11, SIGBUS,  "segment not present", segment_not_present)
@@ -775,7 +772,7 @@
 }
 #endif
 
-#define _set_gate(gate_addr,type,dpl,addr) \
+#define _set_gate(gate_addr,type,dpl,addr,seg) \
 do { \
   int __d0, __d1; \
   __asm__ __volatile__ ("movw %%dx,%%ax\n\t" \
@@ -785,7 +782,7 @@
 	:"=m" (*((long *) (gate_addr))), \
 	 "=m" (*(1+(long *) (gate_addr))), "=&a" (__d0), "=&d" (__d1) \
 	:"i" ((short) (0x8000+(dpl<<13)+(type<<8))), \
-	 "3" ((char *) (addr)),"2" (__KERNEL_CS << 16)); \
+	 "3" ((char *) (addr)),"2" ((seg) << 16)); \
 } while (0)
 
 
@@ -797,22 +794,27 @@
  */
 void set_intr_gate(unsigned int n, void *addr)
 {
-	_set_gate(idt_table+n,14,0,addr);
+	_set_gate(idt_table+n,14,0,addr,__KERNEL_CS);
 }
 
 static void __init set_trap_gate(unsigned int n, void *addr)
 {
-	_set_gate(idt_table+n,15,0,addr);
+	_set_gate(idt_table+n,15,0,addr,__KERNEL_CS);
 }
 
 static void __init set_system_gate(unsigned int n, void *addr)
 {
-	_set_gate(idt_table+n,15,3,addr);
+	_set_gate(idt_table+n,15,3,addr,__KERNEL_CS);
 }
 
 static void __init set_call_gate(void *a, void *addr)
 {
-	_set_gate(a,12,3,addr);
+	_set_gate(a,12,3,addr,__KERNEL_CS);
+}
+
+static void __init set_task_gate(unsigned int n, unsigned int gdt_entry)
+{
+	_set_gate(idt_table+n,5,0,0,(gdt_entry<<3));
 }
 
 
@@ -843,7 +845,7 @@
 	set_system_gate(5,&bounds);
 	set_trap_gate(6,&invalid_op);
 	set_trap_gate(7,&device_not_available);
-	set_trap_gate(8,&double_fault);
+	set_task_gate(8,GDT_ENTRY_DOUBLEFAULT_TSS);
 	set_trap_gate(9,&coprocessor_segment_overrun);
 	set_trap_gate(10,&invalid_TSS);
 	set_trap_gate(11,&segment_not_present);
diff -Nru a/arch/i386/lib/delay.c b/arch/i386/lib/delay.c
--- a/arch/i386/lib/delay.c	Sun Feb 23 22:25:26 2003
+++ b/arch/i386/lib/delay.c	Sun Feb 23 22:25:26 2003
@@ -41,3 +41,8 @@
 {
 	__const_udelay(usecs * 0x000010c6);  /* 2**32 / 1000000 */
 }
+
+void __ndelay(unsigned long nsecs)
+{
+	__const_udelay(nsecs * 0x00005);  /* 2**32 / 1000000000 (rounded up) */
+}
diff -Nru a/arch/i386/mach-visws/Makefile b/arch/i386/mach-visws/Makefile
--- a/arch/i386/mach-visws/Makefile	Sun Feb 23 22:25:26 2003
+++ b/arch/i386/mach-visws/Makefile	Sun Feb 23 22:25:26 2003
@@ -4,8 +4,7 @@
 
 EXTRA_CFLAGS	+= -I../kernel
 
-obj-y				:= setup.o traps.o
+obj-y				:= setup.o traps.o reboot.o
 
-obj-$(CONFIG_PCI)		+= pci-visws.o
 obj-$(CONFIG_X86_VISWS_APIC)	+= visws_apic.o
 obj-$(CONFIG_X86_LOCAL_APIC)	+= mpparse.o
diff -Nru a/arch/i386/mach-visws/mpparse.c b/arch/i386/mach-visws/mpparse.c
--- a/arch/i386/mach-visws/mpparse.c	Sun Feb 23 22:25:22 2003
+++ b/arch/i386/mach-visws/mpparse.c	Sun Feb 23 22:25:22 2003
@@ -1,17 +1,15 @@
-#include <linux/mm.h>
-#include <linux/irq.h>
-#include <linux/init.h>
-#include <linux/delay.h>
+
 #include <linux/config.h>
-#include <linux/bootmem.h>
-#include <linux/smp_lock.h>
-#include <linux/kernel_stat.h>
-#include <linux/mc146818rtc.h>
+#include <linux/init.h>
+#include <linux/smp.h>
 
 #include <asm/smp.h>
-#include <asm/mtrr.h>
+#include <asm/apic.h>
 #include <asm/mpspec.h>
-#include <asm/pgalloc.h>
+#include <asm/io.h>
+
+#include "cobalt.h"
+#include "mach_apic.h"
 
 /* Have we found an MP table */
 int smp_found_config;
@@ -43,25 +41,84 @@
 /* Processor that is doing the boot up */
 unsigned int boot_cpu_physical_apicid = -1U;
 unsigned int boot_cpu_logical_apicid = -1U;
+
 /* Internal processor count */
 static unsigned int num_processors;
 
 /* Bitmask of physically existing CPUs */
 unsigned long phys_cpu_present_map;
 
+u8 raw_phys_apicid[NR_CPUS] = { [0 ... NR_CPUS - 1] = BAD_APICID };
+
 /*
  * The Visual Workstation is Intel MP compliant in the hardware
  * sense, but it doesn't have a BIOS(-configuration table).
  * No problem for Linux.
  */
+
+void __init MP_processor_info (struct mpc_config_processor *m)
+{
+ 	int ver, logical_apicid;
+ 	
+	if (!(m->mpc_cpuflag & CPU_ENABLED))
+		return;
+
+	logical_apicid = m->mpc_apicid;
+	printk(KERN_INFO "%sCPU #%d %ld:%ld APIC version %d\n",
+		m->mpc_cpuflag & CPU_BOOTPROCESSOR ? "Bootup " : "",
+		m->mpc_apicid,
+		(m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
+		(m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
+		m->mpc_apicver);
+
+	if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) {
+		boot_cpu_physical_apicid = m->mpc_apicid;
+		boot_cpu_logical_apicid = logical_apicid;
+	}
+
+	num_processors++;
+
+	if (m->mpc_apicid > MAX_APICS) {
+		printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n",
+			m->mpc_apicid, MAX_APICS);
+		--num_processors;
+		return;
+	}
+	ver = m->mpc_apicver;
+
+	phys_cpu_present_map |= apicid_to_cpu_present(m->mpc_apicid);
+	/*
+	 * Validate version
+	 */
+	if (ver == 0x0) {
+		printk(KERN_ERR "BIOS bug, APIC version is 0 for CPU#%d! "
+			"fixing up to 0x10. (tell your hw vendor)\n",
+			m->mpc_apicid);
+		ver = 0x10;
+	}
+	apic_version[m->mpc_apicid] = ver;
+	raw_phys_apicid[num_processors - 1] = m->mpc_apicid;
+}
+
 void __init find_smp_config(void)
 {
-	smp_found_config = 1;
+	struct mpc_config_processor *mp = phys_to_virt(CO_CPU_TAB_PHYS);
+	unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS));
+
+	if (ncpus > CO_CPU_MAX) {
+		printk(KERN_WARNING "find_visws_smp: got cpu count of %d at %p\n",
+			ncpus, mp);
 
-	phys_cpu_present_map |= 2; /* or in id 1 */
-	apic_version[1] |= 0x10; /* integrated APIC */
-	apic_version[0] |= 0x10;
+		ncpus = CO_CPU_MAX;
+	}
+
+	smp_found_config = 1;
+	while (ncpus--)
+		MP_processor_info(mp++);
 
 	mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
 }
 
+void __init get_smp_config (void)
+{
+}
diff -Nru a/arch/i386/mach-visws/pci-visws.c b/arch/i386/mach-visws/pci-visws.c
--- a/arch/i386/mach-visws/pci-visws.c	Sun Feb 23 22:25:25 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,141 +0,0 @@
-/*
- *	Low-Level PCI Support for SGI Visual Workstation
- *
- *	(c) 1999--2000 Martin Mares <mj@ucw.cz>
- */
-
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/pci.h>
-#include <linux/init.h>
-#include <linux/irq.h>
-
-#include <asm/smp.h>
-#include <asm/lithium.h>
-#include <asm/io.h>
-
-#include "pci-i386.h"
-
-unsigned int pci_probe = 0;
-
-/*
- *  The VISWS uses configuration access type 1 only.
- */
-
-#define CONFIG_CMD(dev, where)   (0x80000000 | (dev->bus->number << 16) | (dev->devfn << 8) | (where & ~3))
-
-static int pci_conf1_read_config_byte(struct pci_dev *dev, int where, u8 *value)
-{
-	outl(CONFIG_CMD(dev,where), 0xCF8);
-	*value = inb(0xCFC + (where&3));
-	return PCIBIOS_SUCCESSFUL;
-}
-
-static int pci_conf1_read_config_word(struct pci_dev *dev, int where, u16 *value)
-{
-	outl(CONFIG_CMD(dev,where), 0xCF8);    
-	*value = inw(0xCFC + (where&2));
-	return PCIBIOS_SUCCESSFUL;    
-}
-
-static int pci_conf1_read_config_dword(struct pci_dev *dev, int where, u32 *value)
-{
-	outl(CONFIG_CMD(dev,where), 0xCF8);
-	*value = inl(0xCFC);
-	return PCIBIOS_SUCCESSFUL;    
-}
-
-static int pci_conf1_write_config_byte(struct pci_dev *dev, int where, u8 value)
-{
-	outl(CONFIG_CMD(dev,where), 0xCF8);    
-	outb(value, 0xCFC + (where&3));
-	return PCIBIOS_SUCCESSFUL;
-}
-
-static int pci_conf1_write_config_word(struct pci_dev *dev, int where, u16 value)
-{
-	outl(CONFIG_CMD(dev,where), 0xCF8);
-	outw(value, 0xCFC + (where&2));
-	return PCIBIOS_SUCCESSFUL;
-}
-
-static int pci_conf1_write_config_dword(struct pci_dev *dev, int where, u32 value)
-{
-	outl(CONFIG_CMD(dev,where), 0xCF8);
-	outl(value, 0xCFC);
-	return PCIBIOS_SUCCESSFUL;
-}
-
-#undef CONFIG_CMD
-
-static struct pci_ops visws_pci_ops = {
-	pci_conf1_read_config_byte,
-	pci_conf1_read_config_word,
-	pci_conf1_read_config_dword,
-	pci_conf1_write_config_byte,
-	pci_conf1_write_config_word,
-	pci_conf1_write_config_dword
-};
-
-static void __init pcibios_fixup_irqs(void)
-{
-	struct pci_dev *dev, *p;
-	u8 pin;
-	int irq;
-
-	pci_for_each_dev(dev) {
-		pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
-		dev->irq = 0;
-		if (!pin)
-			continue;
-		pin--;
-		if (dev->bus->parent) {
-			p = dev->bus->parent->self;
-			pin = (pin + PCI_SLOT(dev->devfn)) % 4;
-		} else
-			p = dev;
-		irq = visws_get_PCI_irq_vector(p->bus->number, PCI_SLOT(p->devfn), pin+1);
-		if (irq >= 0)
-			dev->irq = irq;
-		DBG("PCI IRQ: %s pin %d -> %d\n", dev->slot_name, pin, irq);
-	}
-}
-
-void __init pcibios_fixup_bus(struct pci_bus *b)
-{
-	pci_read_bridge_bases(b);
-}
-
-#if 0
-static struct resource visws_pci_bus_resources[2] = {
-	{ "Host bus 1", 0xf4000000, 0xf7ffffff, 0 },
-	{ "Host bus 2", 0xf0000000, 0xf3ffffff, 0 }
-};
-#endif
-
-void __init pcibios_init(void)
-{
-	unsigned int sec_bus = li_pcib_read16(LI_PCI_BUSNUM) & 0xff;
-
-	printk("PCI: Probing PCI hardware on host buses 00 and %02x\n", sec_bus);
-	pci_scan_bus(0, &visws_pci_ops, NULL);
-	pci_scan_bus(sec_bus, &visws_pci_ops, NULL);
-	pcibios_fixup_irqs();
-	pcibios_resource_survey();
-}
-
-char * __init pcibios_setup(char *str)
-{
-	return str;
-}
-
-int pcibios_enable_device(struct pci_dev *dev, int mask)
-{
-	return pcibios_enable_resources(dev, mask);
-}
-
-void __init pcibios_penalize_isa_irq(irq)
-{
-}
diff -Nru a/arch/i386/mach-visws/reboot.c b/arch/i386/mach-visws/reboot.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/i386/mach-visws/reboot.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,48 @@
+
+#include <linux/smp.h>
+#include <linux/delay.h>
+#include <linux/platform.h>
+
+#include <asm/io.h>
+#include "piix4.h"
+
+void (*pm_power_off)(void);
+
+int reboot_thru_bios;
+int reboot_smp;
+
+void machine_restart(char * __unused)
+{
+#ifdef CONFIG_SMP
+	smp_send_stop();
+#endif
+
+	/*
+	 * Visual Workstations restart after this
+	 * register is poked on the PIIX4
+	 */
+	outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT);
+}
+
+void machine_power_off(void)
+{
+	unsigned short pm_status;
+	extern unsigned int pci_bus0;
+
+	while ((pm_status = inw(PMSTS_PORT)) & 0x100)
+		outw(pm_status, PMSTS_PORT);
+
+	outw(PM_SUSPEND_ENABLE, PMCNTRL_PORT);
+
+	mdelay(10);
+
+#define PCI_CONF1_ADDRESS(bus, devfn, reg) \
+	(0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
+
+	outl(PCI_CONF1_ADDRESS(pci_bus0, SPECIAL_DEV, SPECIAL_REG), 0xCF8);
+	outl(PIIX_SPECIAL_STOP, 0xCFC);
+}
+
+void machine_halt(void)
+{
+}
diff -Nru a/arch/i386/mach-visws/setup.c b/arch/i386/mach-visws/setup.c
--- a/arch/i386/mach-visws/setup.c	Sun Feb 23 22:25:22 2003
+++ b/arch/i386/mach-visws/setup.c	Sun Feb 23 22:25:22 2003
@@ -9,67 +9,26 @@
 #include <linux/interrupt.h>
 
 #include <asm/fixmap.h>
-#include <asm/cobalt.h>
 #include <asm/arch_hooks.h>
 #include <asm/io.h>
+#include "cobalt.h"
+#include "piix4.h"
 
 char visws_board_type = -1;
 char visws_board_rev = -1;
 
-#define	PIIX_PM_START		0x0F80
-
-#define	SIO_GPIO_START		0x0FC0
-
-#define	SIO_PM_START		0x0FC8
-
-#define	PMBASE			PIIX_PM_START
-#define	GPIREG0			(PMBASE+0x30)
-#define	GPIREG(x)		(GPIREG0+((x)/8))
-#define	PIIX_GPI_BD_ID1		18
-#define	PIIX_GPI_BD_REG		GPIREG(PIIX_GPI_BD_ID1)
-
-#define	PIIX_GPI_BD_SHIFT	(PIIX_GPI_BD_ID1 % 8)
-
-#define	SIO_INDEX	0x2e
-#define	SIO_DATA	0x2f
-
-#define	SIO_DEV_SEL	0x7
-#define	SIO_DEV_ENB	0x30
-#define	SIO_DEV_MSB	0x60
-#define	SIO_DEV_LSB	0x61
-
-#define	SIO_GP_DEV	0x7
-
-#define	SIO_GP_BASE	SIO_GPIO_START
-#define	SIO_GP_MSB	(SIO_GP_BASE>>8)
-#define	SIO_GP_LSB	(SIO_GP_BASE&0xff)
-
-#define	SIO_GP_DATA1	(SIO_GP_BASE+0)
-
-#define	SIO_PM_DEV	0x8
-
-#define	SIO_PM_BASE	SIO_PM_START
-#define	SIO_PM_MSB	(SIO_PM_BASE>>8)
-#define	SIO_PM_LSB	(SIO_PM_BASE&0xff)
-#define	SIO_PM_INDEX	(SIO_PM_BASE+0)
-#define	SIO_PM_DATA	(SIO_PM_BASE+1)
-
-#define	SIO_PM_FER2	0x1
-
-#define	SIO_PM_GP_EN	0x80
-
 void __init visws_get_board_type_and_rev(void)
 {
 	int raw;
 
 	visws_board_type = (char)(inb_p(PIIX_GPI_BD_REG) & PIIX_GPI_BD_REG)
 							 >> PIIX_GPI_BD_SHIFT;
-/*
- * Get Board rev.
- * First, we have to initialize the 307 part to allow us access
- * to the GPIO registers.  Let's map them at 0x0fc0 which is right
- * after the PIIX4 PM section.
- */
+	/*
+	 * Get Board rev.
+	 * First, we have to initialize the 307 part to allow us access
+	 * to the GPIO registers.  Let's map them at 0x0fc0 which is right
+	 * after the PIIX4 PM section.
+	 */
 	outb_p(SIO_DEV_SEL, SIO_INDEX);
 	outb_p(SIO_GP_DEV, SIO_DATA);	/* Talk to GPIO regs. */
 
@@ -82,11 +41,11 @@
 	outb_p(SIO_DEV_ENB, SIO_INDEX);
 	outb_p(1, SIO_DATA);		/* Enable GPIO registers. */
 
-/*
- * Now, we have to map the power management section to write
- * a bit which enables access to the GPIO registers.
- * What lunatic came up with this shit?
- */
+	/*
+	 * Now, we have to map the power management section to write
+	 * a bit which enables access to the GPIO registers.
+	 * What lunatic came up with this shit?
+	 */
 	outb_p(SIO_DEV_SEL, SIO_INDEX);
 	outb_p(SIO_PM_DEV, SIO_DATA);	/* Talk to GPIO regs. */
 
@@ -99,18 +58,18 @@
 	outb_p(SIO_DEV_ENB, SIO_INDEX);
 	outb_p(1, SIO_DATA);		/* Enable PM registers. */
 
-/*
- * Now, write the PM register which enables the GPIO registers.
- */
+	/*
+	 * Now, write the PM register which enables the GPIO registers.
+	 */
 	outb_p(SIO_PM_FER2, SIO_PM_INDEX);
 	outb_p(SIO_PM_GP_EN, SIO_PM_DATA);
 
-/*
- * Now, initialize the GPIO registers.
- * We want them all to be inputs which is the
- * power on default, so let's leave them alone.
- * So, let's just read the board rev!
- */
+	/*
+	 * Now, initialize the GPIO registers.
+	 * We want them all to be inputs which is the
+	 * power on default, so let's leave them alone.
+	 * So, let's just read the board rev!
+	 */
 	raw = inb_p(SIO_GP_DATA1);
 	raw &= 0x7f;	/* 7 bits of valid board revision ID. */
 
@@ -128,10 +87,10 @@
 			visws_board_rev = raw;
 		}
 
-	printk(KERN_INFO "Silicon Graphics %s (rev %d)\n",
-	       visws_board_type == VISWS_320 ? "320" :
+	printk(KERN_INFO "Silicon Graphics Visual Workstation %s (rev %d) detected\n",
+	       (visws_board_type == VISWS_320 ? "320" :
 	       (visws_board_type == VISWS_540 ? "540" :
-		"unknown"), visws_board_rev);
+		"unknown")), visws_board_rev);
 }
 
 void __init pre_intr_init_hook(void)
@@ -150,11 +109,16 @@
 {
 	visws_get_board_type_and_rev();
 }
-static struct irqaction irq0  = { timer_interrupt, SA_INTERRUPT, 0, "timer", NULL, NULL};
+
+static struct irqaction irq0 = {
+	.handler =	timer_interrupt,
+	.flags =	SA_INTERRUPT,
+	.name =		"timer",
+};
 
 void __init time_init_hook(void)
 {
-	printk("Starting Cobalt Timer system clock\n");
+	printk(KERN_INFO "Starting Cobalt Timer system clock\n");
 
 	/* Set the countdown value */
 	co_cpu_write(CO_CPU_TIMEVAL, CO_TIME_HZ/HZ);
@@ -166,5 +130,5 @@
 	co_cpu_write(CO_CPU_CTRL, co_cpu_read(CO_CPU_CTRL) & ~CO_CTRL_TIMEMASK);
 
 	/* Wire cpu IDT entry to s/w handler (and Cobalt APIC to IDT) */
-	setup_irq(CO_IRQ_TIMER, &irq0);
+	setup_irq(0, &irq0);
 }
diff -Nru a/arch/i386/mach-visws/traps.c b/arch/i386/mach-visws/traps.c
--- a/arch/i386/mach-visws/traps.c	Sun Feb 23 22:25:25 2003
+++ b/arch/i386/mach-visws/traps.c	Sun Feb 23 22:25:25 2003
@@ -3,132 +3,68 @@
 #include <linux/config.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/ptrace.h>
-#include <linux/timer.h>
-#include <linux/mm.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/spinlock.h>
-#include <linux/interrupt.h>
-#include <linux/highmem.h>
 #include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
 
-#include <asm/system.h>
-#include <asm/uaccess.h>
 #include <asm/io.h>
-#include <asm/atomic.h>
-#include <asm/debugreg.h>
-#include <asm/desc.h>
-#include <asm/i387.h>
-
-#include <asm/smp.h>
 #include <asm/pgalloc.h>
 #include <asm/arch_hooks.h>
+#include <asm/apic.h>
+#include "cobalt.h"
+#include "lithium.h"
 
-#ifdef CONFIG_X86_VISWS_APIC
-#include <asm/fixmap.h>
-#include <asm/cobalt.h>
-#include <asm/lithium.h>
-#endif
-
-#ifdef CONFIG_X86_VISWS_APIC
-
-/*
- * On Rev 005 motherboards legacy device interrupt lines are wired directly
- * to Lithium from the 307.  But the PROM leaves the interrupt type of each
- * 307 logical device set appropriate for the 8259.  Later we'll actually use
- * the 8259, but for now we have to flip the interrupt types to
- * level triggered, active lo as required by Lithium.
- */
-
-#define	REG	0x2e	/* The register to read/write */
-#define	DEV	0x07	/* Register: Logical device select */
-#define	VAL	0x2f	/* The value to read/write */
 
-static void
-superio_outb(int dev, int reg, int val)
-{
-	outb(DEV, REG);
-	outb(dev, VAL);
-	outb(reg, REG);
-	outb(val, VAL);
-}
+#define A01234 (LI_INTA_0 | LI_INTA_1 | LI_INTA_2 | LI_INTA_3 | LI_INTA_4)
+#define BCD (LI_INTB | LI_INTC | LI_INTD)
+#define ALLDEVS (A01234 | BCD)
 
-static int __attribute__ ((unused))
-superio_inb(int dev, int reg)
+static __init void lithium_init(void)
 {
-	outb(DEV, REG);
-	outb(dev, VAL);
-	outb(reg, REG);
-	return inb(VAL);
-}
-
-#define	FLOP	3	/* floppy logical device */
-#define	PPORT	4	/* parallel logical device */
-#define	UART5	5	/* uart2 logical device (not wired up) */
-#define	UART6	6	/* uart1 logical device (THIS is the serial port!) */
-#define	IDEST	0x70	/* int. destination (which 307 IRQ line) reg. */
-#define	ITYPE	0x71	/* interrupt type register */
-
-/* interrupt type bits */
-#define	LEVEL	0x01	/* bit 0, 0 == edge triggered */
-#define	ACTHI	0x02	/* bit 1, 0 == active lo */
+	set_fixmap(FIX_LI_PCIA, LI_PCI_A_PHYS);
+	set_fixmap(FIX_LI_PCIB, LI_PCI_B_PHYS);
 
-static __init void
-superio_init(void)
-{
-	if (visws_board_type == VISWS_320 && visws_board_rev == 5) {
-		superio_outb(UART6, IDEST, 0);	/* 0 means no intr propagated */
-		printk("SGI 320 rev 5: disabling 307 uart1 interrupt\n");
+	if ((li_pcia_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
+	    (li_pcia_read16(PCI_DEVICE_ID) != PCI_VENDOR_ID_SGI_LITHIUM)) {
+		printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'A');
+		panic("This machine is not SGI Visual Workstation 320/540");
 	}
-}
 
-static __init void
-lithium_init(void)
-{
-	set_fixmap(FIX_LI_PCIA, LI_PCI_A_PHYS);
-	printk("Lithium PCI Bridge A, Bus Number: %d\n",
-				li_pcia_read16(LI_PCI_BUSNUM) & 0xff);
-	set_fixmap(FIX_LI_PCIB, LI_PCI_B_PHYS);
-	printk("Lithium PCI Bridge B (PIIX4), Bus Number: %d\n",
-				li_pcib_read16(LI_PCI_BUSNUM) & 0xff);
+	if ((li_pcib_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
+	    (li_pcib_read16(PCI_DEVICE_ID) != PCI_VENDOR_ID_SGI_LITHIUM)) {
+		printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'B');
+		panic("This machine is not SGI Visual Workstation 320/540");
+	}
 
-	/* XXX blindly enables all interrupts */
-	li_pcia_write16(LI_PCI_INTEN, 0xffff);
-	li_pcib_write16(LI_PCI_INTEN, 0xffff);
+	li_pcia_write16(LI_PCI_INTEN, ALLDEVS);
+	li_pcib_write16(LI_PCI_INTEN, ALLDEVS);
 }
 
-static __init void
-cobalt_init(void)
+static __init void cobalt_init(void)
 {
 	/*
 	 * On normal SMP PC this is used only with SMP, but we have to
 	 * use it and set it up here to start the Cobalt clock
 	 */
 	set_fixmap(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE);
-	printk("Local APIC ID %lx\n", apic_read(APIC_ID));
-	printk("Local APIC Version %lx\n", apic_read(APIC_LVR));
+	setup_local_APIC();
+	printk(KERN_INFO "Local APIC Version %#lx, ID %#lx\n",
+		apic_read(APIC_LVR), apic_read(APIC_ID));
 
 	set_fixmap(FIX_CO_CPU, CO_CPU_PHYS);
-	printk("Cobalt Revision %lx\n", co_cpu_read(CO_CPU_REV));
-
 	set_fixmap(FIX_CO_APIC, CO_APIC_PHYS);
-	printk("Cobalt APIC ID %lx\n", co_apic_read(CO_APIC_ID));
+	printk(KERN_INFO "Cobalt Revision %#lx, APIC ID %#lx\n",
+		co_cpu_read(CO_CPU_REV), co_apic_read(CO_APIC_ID));
 
 	/* Enable Cobalt APIC being careful to NOT change the ID! */
-	co_apic_write(CO_APIC_ID, co_apic_read(CO_APIC_ID)|CO_APIC_ENABLE);
+	co_apic_write(CO_APIC_ID, co_apic_read(CO_APIC_ID) | CO_APIC_ENABLE);
 
-	printk("Cobalt APIC enabled: ID reg %lx\n", co_apic_read(CO_APIC_ID));
+	printk(KERN_INFO "Cobalt APIC enabled: ID reg %#lx\n",
+		co_apic_read(CO_APIC_ID));
 }
-#endif
 
-void __init trap_init_hook()
+void __init trap_init_hook(void)
 {
-#ifdef CONFIG_X86_VISWS_APIC
-	superio_init();
 	lithium_init();
 	cobalt_init();
-#endif
 }
diff -Nru a/arch/i386/mach-visws/visws_apic.c b/arch/i386/mach-visws/visws_apic.c
--- a/arch/i386/mach-visws/visws_apic.c	Sun Feb 23 22:25:21 2003
+++ b/arch/i386/mach-visws/visws_apic.c	Sun Feb 23 22:25:21 2003
@@ -1,5 +1,5 @@
 /*
- *	linux/arch/i386/kernel/visws_apic.c
+ *	linux/arch/i386/mach_visws/visws_apic.c
  *
  *	Copyright (C) 1999 Bent Hagemark, Ingo Molnar
  *
@@ -10,234 +10,180 @@
  *  hardware in the system uses this controller directly.  Legacy devices
  *  are connected to the PIIX4 which in turn has its 8259(s) connected to
  *  a of the Cobalt APIC entry.
+ *
+ *  09/02/2000 - Updated for 2.4 by jbarnes@sgi.com
+ *
+ *  25/11/2002 - Updated for 2.5 by Andrey Panin <pazke@orbita1.ru>
  */
 
-#include <linux/ptrace.h>
-#include <linux/errno.h>
+#include <linux/config.h>
 #include <linux/kernel_stat.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/ioport.h>
 #include <linux/interrupt.h>
-#include <linux/timex.h>
-#include <linux/slab.h>
-#include <linux/random.h>
-#include <linux/smp.h>
+#include <linux/irq.h>
 #include <linux/smp_lock.h>
 #include <linux/init.h>
 
-#include <asm/system.h>
 #include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/bitops.h>
-#include <asm/smp.h>
-#include <asm/pgtable.h>
-#include <asm/delay.h>
-#include <asm/desc.h>
-
-#include <asm/cobalt.h>
-
-#include <linux/irq.h>
-
-/*
- * This is the PIIX4-based 8259 that is wired up indirectly to Cobalt
- * -- not the manner expected by the normal 8259 code in irq.c.
- *
- * there is a 'master' physical interrupt source that gets sent to
- * the CPU. But in the chipset there are various 'virtual' interrupts
- * waiting to be handled. We represent this to Linux through a 'master'
- * interrupt controller type, and through a special virtual interrupt-
- * controller. Device drivers only see the virtual interrupt sources.
- */
-
-#define	CO_IRQ_BASE	0x20	/* This is the 0x20 in init_IRQ()! */
-
-static void startup_piix4_master_irq(unsigned int irq);
-static void shutdown_piix4_master_irq(unsigned int irq);
-static void do_piix4_master_IRQ(unsigned int irq, struct pt_regs * regs);
-#define enable_piix4_master_irq startup_piix4_master_irq
-#define disable_piix4_master_irq shutdown_piix4_master_irq
+#include <asm/apic.h>
+#include <asm/i8259.h>
 
-static struct hw_interrupt_type piix4_master_irq_type = {
-	"PIIX4-master",
-	startup_piix4_master_irq,
-	shutdown_piix4_master_irq,
-	do_piix4_master_IRQ,
-	enable_piix4_master_irq,
-	disable_piix4_master_irq
-};
-
-static void enable_piix4_virtual_irq(unsigned int irq);
-static void disable_piix4_virtual_irq(unsigned int irq);
-#define startup_piix4_virtual_irq enable_piix4_virtual_irq
-#define shutdown_piix4_virtual_irq disable_piix4_virtual_irq
-
-static struct hw_interrupt_type piix4_virtual_irq_type = {
-	"PIIX4-virtual",
-	startup_piix4_virtual_irq,
-	shutdown_piix4_virtual_irq,
-	0, /* no handler, it's never called physically */
-	enable_piix4_virtual_irq,
-	disable_piix4_virtual_irq
-};
-
-/*
- * This is the SGI Cobalt (IO-)APIC:
- */
+#include "cobalt.h"
+#include "irq_vectors.h"
 
-static void do_cobalt_IRQ(unsigned int irq, struct pt_regs * regs);
-static void enable_cobalt_irq(unsigned int irq);
-static void disable_cobalt_irq(unsigned int irq);
-static void startup_cobalt_irq(unsigned int irq);
-#define shutdown_cobalt_irq disable_cobalt_irq
 
-static spinlock_t irq_controller_lock = SPIN_LOCK_UNLOCKED;
+int irq_vector[NR_IRQS] = { FIRST_EXTERNAL_VECTOR, 0 };
 
-static struct hw_interrupt_type cobalt_irq_type = {
-	"Cobalt-APIC",
-	startup_cobalt_irq,
-	shutdown_cobalt_irq,
-	do_cobalt_IRQ,
-	enable_cobalt_irq,
-	disable_cobalt_irq
-};
 
+static spinlock_t cobalt_lock = SPIN_LOCK_UNLOCKED;
 
 /*
- * Not an __init, needed by the reboot code
+ * Set the given Cobalt APIC Redirection Table entry to point
+ * to the given IDT vector/index.
  */
-void disable_IO_APIC(void)
+static inline void co_apic_set(int entry, int irq)
 {
-	/* Nop on Cobalt */
-} 
+	co_apic_write(CO_APIC_LO(entry), CO_APIC_LEVEL | irq_vector[irq]);
+	co_apic_write(CO_APIC_HI(entry), 0);
+}
 
 /*
  * Cobalt (IO)-APIC functions to handle PCI devices.
  */
-
-static void disable_cobalt_irq(unsigned int irq)
+static inline int co_apic_ide0_hack(void)
 {
-	/* XXX undo the APIC entry here? */
+	extern char visws_board_type;
+	extern char visws_board_rev;
 
-	/*
-	 * definitely, we do not want to have IRQ storms from
-	 * unused devices --mingo
-	 */
+	if (visws_board_type == VISWS_320 && visws_board_rev == 5)
+		return 5;
+	return CO_APIC_IDE0;
 }
 
-static void enable_cobalt_irq(unsigned int irq)
+static int is_co_apic(unsigned int irq)
 {
+	if (IS_CO_APIC(irq))
+		return CO_APIC(irq);
+
+	switch (irq) {
+		case 0: return CO_APIC_CPU;
+		case CO_IRQ_IDE0: return co_apic_ide0_hack();
+		case CO_IRQ_IDE1: return CO_APIC_IDE1;
+		default: return -1;
+	}
 }
 
+
 /*
- * Set the given Cobalt APIC Redirection Table entry to point
- * to the given IDT vector/index.
+ * This is the SGI Cobalt (IO-)APIC:
  */
-static void co_apic_set(int entry, int idtvec)
+
+static void enable_cobalt_irq(unsigned int irq)
 {
-	co_apic_write(CO_APIC_LO(entry), CO_APIC_LEVEL | (CO_IRQ_BASE+idtvec));
-	co_apic_write(CO_APIC_HI(entry), 0);
+	co_apic_set(is_co_apic(irq), irq);
+}
 
-	printk("Cobalt APIC Entry %d IDT Vector %d\n", entry, idtvec);
+static void disable_cobalt_irq(unsigned int irq)
+{
+	int entry = is_co_apic(irq);
+
+	co_apic_write(CO_APIC_LO(entry), CO_APIC_MASK);
+	co_apic_read(CO_APIC_LO(entry));
 }
 
 /*
  * "irq" really just serves to identify the device.  Here is where we
  * map this to the Cobalt APIC entry where it's physically wired.
- * This is called via request_irq -> setup_x86_irq -> irq_desc->startup()
+ * This is called via request_irq -> setup_irq -> irq_desc->startup()
  */
-static void startup_cobalt_irq(unsigned int irq)
+static unsigned int startup_cobalt_irq(unsigned int irq)
 {
-	/*
-	 * These "irq"'s are wired to the same Cobalt APIC entries
-	 * for all (known) motherboard types/revs
-	 */
-	switch (irq) {
-	case CO_IRQ_TIMER:	co_apic_set(CO_APIC_CPU, CO_IRQ_TIMER);
-				return;
+	unsigned long flags;
 
-	case CO_IRQ_ENET:	co_apic_set(CO_APIC_ENET, CO_IRQ_ENET);
-				return;
+	spin_lock_irqsave(&cobalt_lock, flags);
+	if ((irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING)))
+		irq_desc[irq].status &= ~(IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING);
+	enable_cobalt_irq(irq);
+	spin_unlock_irqrestore(&cobalt_lock, flags);
+	return 0;
+}
 
-	case CO_IRQ_SERIAL:	return; /* XXX move to piix4-8259 "virtual" */
+static void ack_cobalt_irq(unsigned int irq)
+{
+	unsigned long flags;
 
-	case CO_IRQ_8259:	co_apic_set(CO_APIC_8259, CO_IRQ_8259);
-				return;
-
-	case CO_IRQ_IDE:
-		switch (visws_board_type) {
-		case VISWS_320:
-			switch (visws_board_rev) {
-			case 5:
-				co_apic_set(CO_APIC_0_5_IDE0, CO_IRQ_IDE);
-				co_apic_set(CO_APIC_0_5_IDE1, CO_IRQ_IDE);
-					return;
-			case 6:
-				co_apic_set(CO_APIC_0_6_IDE0, CO_IRQ_IDE);
-				co_apic_set(CO_APIC_0_6_IDE1, CO_IRQ_IDE);
-					return;
-			}
-		case VISWS_540:
-			switch (visws_board_rev) {
-			case 2:
-				co_apic_set(CO_APIC_1_2_IDE0, CO_IRQ_IDE);
-					return;
-			}
-		}
-		break;
-	default:
-		panic("huh?");
-	}
+	spin_lock_irqsave(&cobalt_lock, flags);
+	disable_cobalt_irq(irq);
+	apic_write(APIC_EOI, APIC_EIO_ACK);
+	spin_unlock_irqrestore(&cobalt_lock, flags);
 }
 
+static void end_cobalt_irq(unsigned int irq)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&cobalt_lock, flags);
+	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
+		enable_cobalt_irq(irq);
+	spin_unlock_irqrestore(&cobalt_lock, flags);
+}
+
+static struct hw_interrupt_type cobalt_irq_type = {
+	.typename =	"Cobalt-APIC",
+	.startup =	startup_cobalt_irq,
+	.shutdown =	disable_cobalt_irq,
+	.enable =	enable_cobalt_irq,
+	.disable =	disable_cobalt_irq,
+	.ack =		ack_cobalt_irq,
+	.end =		end_cobalt_irq,
+};
+
+
 /*
- * This is the handle() op in do_IRQ()
+ * This is the PIIX4-based 8259 that is wired up indirectly to Cobalt
+ * -- not the manner expected by the code in i8259.c.
+ *
+ * there is a 'master' physical interrupt source that gets sent to
+ * the CPU. But in the chipset there are various 'virtual' interrupts
+ * waiting to be handled. We represent this to Linux through a 'master'
+ * interrupt controller type, and through a special virtual interrupt-
+ * controller. Device drivers only see the virtual interrupt sources.
  */
-static void do_cobalt_IRQ(unsigned int irq, struct pt_regs * regs)
+static unsigned int startup_piix4_master_irq(unsigned int irq)
 {
-	struct irqaction * action;
-	irq_desc_t *desc = irq_desc + irq;
+	init_8259A(0);
 
-	spin_lock(&irq_controller_lock);
-	{
-		unsigned int status;
-		/* XXX APIC EOI? */
-		status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
-		action = NULL;
-		if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
-			action = desc->action;
-			status |= IRQ_INPROGRESS;
-		}
-		desc->status = status;
-	}
-	spin_unlock(&irq_controller_lock);
+	return startup_cobalt_irq(irq);
+}
 
-	/* Exit early if we had no action or it was disabled */
-	if (!action)
-		return;
-
-	handle_IRQ_event(irq, regs, action);
-
-	(void)co_cpu_read(CO_CPU_REV); /* Sync driver ack to its h/w */
-	apic_write(APIC_EOI, APIC_EIO_ACK); /* Send EOI to Cobalt APIC */
-
-	spin_lock(&irq_controller_lock);
-	{
-		unsigned int status = desc->status & ~IRQ_INPROGRESS;
-		desc->status = status;
-		if (!(status & IRQ_DISABLED))
-			enable_cobalt_irq(irq);
-	}
-	spin_unlock(&irq_controller_lock);
+static void end_piix4_master_irq(unsigned int irq)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&cobalt_lock, flags);
+	enable_cobalt_irq(irq);
+	spin_unlock_irqrestore(&cobalt_lock, flags);
 }
 
+static struct hw_interrupt_type piix4_master_irq_type = {
+	.typename =	"PIIX4-master",
+	.startup =	startup_piix4_master_irq,
+	.ack =		ack_cobalt_irq,
+	.end =		end_piix4_master_irq,
+};
+
+
+static struct hw_interrupt_type piix4_virtual_irq_type = {
+	.typename =	"PIIX4-virtual",
+	.startup =	startup_8259A_irq,
+	.shutdown =	disable_8259A_irq,
+	.enable =	enable_8259A_irq,
+	.disable =	disable_8259A_irq,
+};
+
+
 /*
- * PIIX4-8259 master/virtual functions to handle:
- *
- *	floppy
- *	parallel
- *	serial
- *	audio (?)
+ * PIIX4-8259 master/virtual functions to handle interrupt requests
+ * from legacy devices: floppy, parallel, serial, rtc.
  *
  * None of these get Cobalt APIC entries, neither do they have IDT
  * entries. These interrupts are purely virtual and distributed from
@@ -250,161 +196,112 @@
  * enable_irq gets the right irq. This 'master' irq is never directly
  * manipulated by any driver.
  */
-
-static void startup_piix4_master_irq(unsigned int irq)
+static void piix4_master_intr(int irq, void *dev_id, struct pt_regs * regs)
 {
-	/* ICW1 */
-	outb(0x11, 0x20);
-	outb(0x11, 0xa0);
+	int realirq;
+	irq_desc_t *desc;
+	unsigned long flags;
 
-	/* ICW2 */
-	outb(0x08, 0x21);
-	outb(0x70, 0xa1);
+	spin_lock_irqsave(&i8259A_lock, flags);
 
-	/* ICW3 */
-	outb(0x04, 0x21);
-	outb(0x02, 0xa1);
-
-	/* ICW4 */
-	outb(0x01, 0x21);
-	outb(0x01, 0xa1);
-
-	/* OCW1 - disable all interrupts in both 8259's */
-	outb(0xff, 0x21);
-	outb(0xff, 0xa1);
-
-	startup_cobalt_irq(irq);
-}
+	/* Find out what's interrupting in the PIIX4 master 8259 */
+	outb(0x0c, 0x20);		/* OCW3 Poll command */
+	realirq = inb(0x20);
 
-static void shutdown_piix4_master_irq(unsigned int irq)
-{
 	/*
-	 * [we skip the 8259 magic here, not strictly necessary]
+	 * Bit 7 == 0 means invalid/spurious
 	 */
+	if (unlikely(!(realirq & 0x80)))
+		goto out_unlock;
 
-	shutdown_cobalt_irq(irq);
-}
-
-static void do_piix4_master_IRQ(unsigned int irq, struct pt_regs * regs)
-{
-	int realirq, mask;
+	realirq &= 7;
 
-	/* Find out what's interrupting in the PIIX4 8259 */
+	if (unlikely(realirq == 2)) {
+		outb(0x0c, 0xa0);
+		realirq = inb(0xa0);
 
-	spin_lock(&irq_controller_lock);
-	outb(0x0c, 0x20);		/* OCW3 Poll command */
-	realirq = inb(0x20);
+		if (unlikely(!(realirq & 0x80)))
+			goto out_unlock;
 
-	if (!(realirq & 0x80)) {
-		/*
-		 * Bit 7 == 0 means invalid/spurious
-		 */
-		goto out_unlock;
+		realirq = (realirq & 7) + 8;
 	}
-	realirq &= 0x7f;
 
-	/*
-	 * mask and ack the 8259
-	 */
-	mask = inb(0x21);
-	if ((mask >> realirq) & 0x01)
-		/*
-		 * This IRQ is masked... ignore
-		 */
-		goto out_unlock;
+	/* mask and ack interrupt */
+	cached_irq_mask |= 1 << realirq;
+	if (unlikely(realirq > 7)) {
+		inb(0xa1);
+		outb(cached_A1, 0xa1);
+		outb(0x60 + (realirq & 7), 0xa0);
+		outb(0x60 + 2, 0x20);
+	} else {
+		inb(0x21);
+		outb(cached_21, 0x21);
+		outb(0x60 + realirq, 0x20);
+	}
 
-	outb(mask | (1<<realirq), 0x21);
-	/*
-	 * OCW2 - non-specific EOI
-	 */
-	outb(0x20, 0x20);
+	spin_unlock_irqrestore(&i8259A_lock, flags);
 
-	spin_unlock(&irq_controller_lock);
+	desc = irq_desc + realirq;
 
 	/*
 	 * handle this 'virtual interrupt' as a Cobalt one now.
 	 */
-	kstat_cpu(smp_processor_id()).irqs[irq]++;
-	do_cobalt_IRQ(realirq, regs);
+	kstat_cpu(smp_processor_id()).irqs[realirq]++;
 
-	spin_lock(&irq_controller_lock);
-	{
-		irq_desc_t *desc = irq_desc + realirq;
+	if (likely(desc->action != NULL))
+		handle_IRQ_event(realirq, regs, desc->action);
+
+	if (!(desc->status & IRQ_DISABLED))
+		enable_8259A_irq(realirq);
 
-		if (!(desc->status & IRQ_DISABLED))
-			enable_piix4_virtual_irq(realirq);
-	}
-	spin_unlock(&irq_controller_lock);
 	return;
 
 out_unlock:
-	spin_unlock(&irq_controller_lock);
+	spin_unlock_irqrestore(&i8259A_lock, flags);
 	return;
 }
 
-static void enable_piix4_virtual_irq(unsigned int irq)
-{
-	/*
-	 * assumes this irq is one of the legacy devices
-	 */
-
-	unsigned int mask = inb(0x21);
- 	mask &= ~(1 << irq);
-	outb(mask, 0x21);
-	enable_cobalt_irq(irq);
-}
-
-/*
- * assumes this irq is one of the legacy devices
- */
-static void disable_piix4_virtual_irq(unsigned int irq)
-{
-	unsigned int mask;
-
-	disable_cobalt_irq(irq);
+static struct irqaction master_action = {
+	.handler =	piix4_master_intr,
+	.name =		"PIIX4-8259",
+};
 
-	mask = inb(0x21);
- 	mask &= ~(1 << irq);
-	outb(mask, 0x21);
-}
+static struct irqaction cascade_action = {
+	.handler = 	no_action,
+	.name =		"cascade",
+};
 
-static struct irqaction master_action =
-		{ no_action, 0, 0, "PIIX4-8259", NULL, NULL };
 
 void init_VISWS_APIC_irqs(void)
 {
 	int i;
 
-	for (i = 0; i < 16; i++) {
+	for (i = 0; i < CO_IRQ_APIC0 + CO_APIC_LAST + 1; i++) {
 		irq_desc[i].status = IRQ_DISABLED;
 		irq_desc[i].action = 0;
 		irq_desc[i].depth = 1;
 
-		/*
-		 * Cobalt IRQs are mapped to standard ISA
-		 * interrupt vectors:
-		 */
-		switch (i) {
-			/*
-			 * Only CO_IRQ_8259 will be raised
-			 * externally.
-			 */
-		case CO_IRQ_8259:
+		if (i == 0) {
+			irq_desc[i].handler = &cobalt_irq_type;
+		}
+		else if (i == CO_IRQ_IDE0) {
+			irq_desc[i].handler = &cobalt_irq_type;
+		}
+		else if (i == CO_IRQ_IDE1) {
+			irq_desc[i].handler = &cobalt_irq_type;
+		}
+		else if (i == CO_IRQ_8259) {
 			irq_desc[i].handler = &piix4_master_irq_type;
-			break;
-		case CO_IRQ_FLOPPY:
-		case CO_IRQ_PARLL:
+		}
+		else if (i < CO_IRQ_APIC0) {
 			irq_desc[i].handler = &piix4_virtual_irq_type;
-			break;
-		default:
+		}
+		else if (IS_CO_APIC(i)) {
 			irq_desc[i].handler = &cobalt_irq_type;
-			break;
 		}
+		irq_vector[i] = i + FIRST_EXTERNAL_VECTOR;
 	}
 
-	/*
-	 * The master interrupt is always present:
-	 */
-	setup_x86_irq(CO_IRQ_8259, &master_action);
+	setup_irq(CO_IRQ_8259, &master_action);
+	setup_irq(2, &cascade_action);
 }
-
diff -Nru a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
--- a/arch/i386/mach-voyager/voyager_smp.c	Sun Feb 23 22:25:23 2003
+++ b/arch/i386/mach-voyager/voyager_smp.c	Sun Feb 23 22:25:23 2003
@@ -234,9 +234,9 @@
 static __u32 trampoline_base;
 
 /* The per cpu profile stuff - used in smp_local_timer_interrupt */
-static unsigned int prof_multiplier[NR_CPUS] __cacheline_aligned = { 1, };
-static unsigned int prof_old_multiplier[NR_CPUS] __cacheline_aligned = { 1, };
-static DEFINE_PER_CPU(unsigned int, prof_counter) =  1;
+static DEFINE_PER_CPU(int, prof_multiplier) = 1;
+static DEFINE_PER_CPU(int, prof_old_multiplier) = 1;
+static DEFINE_PER_CPU(int, prof_counter) =  1;
 
 /* the map used to check if a CPU has booted */
 static __u32 cpu_booted_map;
@@ -1318,10 +1318,12 @@
 		 *
 		 * Interrupts are already masked off at this point.
 		 */
-		per_cpu(prof_counter,cpu) = prof_multiplier[cpu];
-		if (per_cpu(prof_counter, cpu) != prof_old_multiplier[cpu]) {
+		per_cpu(prof_counter,cpu) = per_cpu(prof_multiplier, cpu);
+		if (per_cpu(prof_counter, cpu) !=
+					per_cpu(prof_old_multiplier, cpu)) {
 			/* FIXME: need to update the vic timer tick here */
-			prof_old_multiplier[cpu] = per_cpu(prof_counter, cpu);
+			per_cpu(prof_old_multiplier, cpu) =
+						per_cpu(prof_counter, cpu);
 		}
 
 		update_process_times(user_mode(regs));
@@ -1406,7 +1408,7 @@
 	 * accounting.
 	 */
 	for (i = 0; i < NR_CPUS; ++i)
-		prof_multiplier[i] = multiplier;
+		per_cpu(prof_multiplier, i) = multiplier;
 
 	return 0;
 }
diff -Nru a/arch/i386/mm/hugetlbpage.c b/arch/i386/mm/hugetlbpage.c
--- a/arch/i386/mm/hugetlbpage.c	Sun Feb 23 22:25:26 2003
+++ b/arch/i386/mm/hugetlbpage.c	Sun Feb 23 22:25:26 2003
@@ -71,8 +71,6 @@
 	return (pte_t *) pmd;
 }
 
-#define mk_pte_huge(entry) {entry.pte_low |= (_PAGE_PRESENT | _PAGE_PSE);}
-
 static void set_huge_pte(struct mm_struct *mm, struct vm_area_struct *vma, struct page *page, pte_t * page_table, int write_access)
 {
 	pte_t entry;
diff -Nru a/arch/i386/pci/Makefile b/arch/i386/pci/Makefile
--- a/arch/i386/pci/Makefile	Sun Feb 23 22:25:24 2003
+++ b/arch/i386/pci/Makefile	Sun Feb 23 22:25:24 2003
@@ -3,6 +3,8 @@
 obj-$(CONFIG_PCI_BIOS)		+= pcbios.o
 obj-$(CONFIG_PCI_DIRECT)	+= direct.o
 
+obj-$(CONFIG_X86_VISWS)		+= visws.o
+
 ifdef	CONFIG_X86_NUMAQ
 obj-y		+= numa.o
 else
@@ -11,8 +13,15 @@
 ifdef	CONFIG_ACPI_PCI
 obj-y		+= acpi.o
 endif
-obj-y		+= legacy.o
 
+ifndef	CONFIG_X86_VISWS
+obj-y		+= legacy.o
+endif
 
 endif		# CONFIG_X86_NUMAQ
-obj-y		+= irq.o common.o
+
+ifndef	CONFIG_X86_VISWS
+obj-y		+= irq.o
+endif
+
+obj-y		+= common.o
diff -Nru a/arch/i386/pci/common.c b/arch/i386/pci/common.c
--- a/arch/i386/pci/common.c	Sun Feb 23 22:25:23 2003
+++ b/arch/i386/pci/common.c	Sun Feb 23 22:25:23 2003
@@ -180,13 +180,8 @@
 		return NULL;
 	}
 #endif
-	else if (!strcmp(str, "rom")) {
-		pci_probe |= PCI_ASSIGN_ROMS;
-		return NULL;
-	} else if (!strcmp(str, "assign-busses")) {
-		pci_probe |= PCI_ASSIGN_ALL_BUSSES;
-		return NULL;
-	} else if (!strcmp(str, "usepirqmask")) {
+#ifndef CONFIG_X86_VISWS
+	else if (!strcmp(str, "usepirqmask")) {
 		pci_probe |= PCI_USE_PIRQ_MASK;
 		return NULL;
 	} else if (!strncmp(str, "irqmask=", 8)) {
@@ -194,6 +189,14 @@
 		return NULL;
 	} else if (!strncmp(str, "lastbus=", 8)) {
 		pcibios_last_bus = simple_strtol(str+8, NULL, 0);
+		return NULL;
+	}
+#endif
+	else if (!strcmp(str, "rom")) {
+		pci_probe |= PCI_ASSIGN_ROMS;
+		return NULL;
+	} else if (!strcmp(str, "assign-busses")) {
+		pci_probe |= PCI_ASSIGN_ALL_BUSSES;
 		return NULL;
 	}
 	return str;
diff -Nru a/arch/i386/pci/direct.c b/arch/i386/pci/direct.c
--- a/arch/i386/pci/direct.c	Sun Feb 23 22:25:22 2003
+++ b/arch/i386/pci/direct.c	Sun Feb 23 22:25:22 2003
@@ -83,7 +83,7 @@
 		PCI_FUNC(devfn), where, size, value);
 }
 
-static struct pci_ops pci_direct_conf1 = {
+struct pci_ops pci_direct_conf1 = {
 	.read =		pci_conf1_read,
 	.write =	pci_conf1_write,
 };
@@ -196,21 +196,35 @@
 static int __devinit pci_sanity_check(struct pci_ops *o)
 {
 	u32 x = 0;
-	struct pci_bus bus;		/* Fake bus and device */
-	struct pci_dev dev;
+	int retval = 0;
+	struct pci_bus *bus;		/* Fake bus and device */
+	struct pci_dev *dev;
 
 	if (pci_probe & PCI_NO_CHECKS)
 		return 1;
-	bus.number = 0;
-	dev.bus = &bus;
-	for(dev.devfn=0; dev.devfn < 0x100; dev.devfn++)
-		if ((!o->read(&bus, dev.devfn, PCI_CLASS_DEVICE, 2, &x) &&
+
+	bus = kmalloc(sizeof(*bus), GFP_ATOMIC);
+	dev = kmalloc(sizeof(*dev), GFP_ATOMIC);
+	if (!bus || !dev) {
+		printk(KERN_ERR "Out of memory in %s\n", __FUNCTION__);
+		goto exit;
+	}
+
+	bus->number = 0;
+	dev->bus = bus;
+	for(dev->devfn=0; dev->devfn < 0x100; dev->devfn++)
+		if ((!o->read(bus, dev->devfn, PCI_CLASS_DEVICE, 2, &x) &&
 		     (x == PCI_CLASS_BRIDGE_HOST || x == PCI_CLASS_DISPLAY_VGA)) ||
-		    (!o->read(&bus, dev.devfn, PCI_VENDOR_ID, 2, &x) &&
-		     (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ)))
-			return 1;
+		    (!o->read(bus, dev->devfn, PCI_VENDOR_ID, 2, &x) &&
+		     (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ))) {
+			retval = 1;
+			goto exit;
+		}
 	DBG("PCI: Sanity check failed\n");
-	return 0;
+exit:
+	kfree(dev);
+	kfree(bus);
+	return retval;
 }
 
 static int __init pci_direct_init(void)
diff -Nru a/arch/i386/pci/legacy.c b/arch/i386/pci/legacy.c
--- a/arch/i386/pci/legacy.c	Sun Feb 23 22:25:26 2003
+++ b/arch/i386/pci/legacy.c	Sun Feb 23 22:25:26 2003
@@ -12,28 +12,39 @@
 static void __devinit pcibios_fixup_peer_bridges(void)
 {
 	int n;
-	struct pci_bus bus;
-	struct pci_dev dev;
+	struct pci_bus *bus;
+	struct pci_dev *dev;
 	u16 l;
 
 	if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff)
 		return;
 	DBG("PCI: Peer bridge fixup\n");
+
+	bus = kmalloc(sizeof(*bus), GFP_ATOMIC);
+	dev = kmalloc(sizeof(*dev), GFP_ATOMIC);
+	if (!bus || !dev) {
+		printk(KERN_ERR "Out of memory in %s\n", __FUNCTION__);
+		goto exit;
+	}
+
 	for (n=0; n <= pcibios_last_bus; n++) {
 		if (pci_bus_exists(&pci_root_buses, n))
 			continue;
-		bus.number = n;
-		bus.ops = pci_root_ops;
-		dev.bus = &bus;
-		for(dev.devfn=0; dev.devfn<256; dev.devfn += 8)
-			if (!pci_read_config_word(&dev, PCI_VENDOR_ID, &l) &&
+		bus->number = n;
+		bus->ops = pci_root_ops;
+		dev->bus = bus;
+		for (dev->devfn=0; dev->devfn<256; dev->devfn += 8)
+			if (!pci_read_config_word(dev, PCI_VENDOR_ID, &l) &&
 			    l != 0x0000 && l != 0xffff) {
-				DBG("Found device at %02x:%02x [%04x]\n", n, dev.devfn, l);
+				DBG("Found device at %02x:%02x [%04x]\n", n, dev->devfn, l);
 				printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n);
 				pci_scan_bus(n, pci_root_ops, NULL);
 				break;
 			}
 	}
+exit:
+	kfree(dev);
+	kfree(bus);
 }
 
 static int __init pci_legacy_init(void)
diff -Nru a/arch/i386/pci/visws.c b/arch/i386/pci/visws.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/i386/pci/visws.c	Sun Feb 23 22:25:25 2003
@@ -0,0 +1,111 @@
+/*
+ *	Low-Level PCI Support for SGI Visual Workstation
+ *
+ *	(c) 1999--2000 Martin Mares <mj@ucw.cz>
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/init.h>
+
+#include "cobalt.h"
+#include "lithium.h"
+
+#include "pci.h"
+
+
+int broken_hp_bios_irq9;
+
+extern struct pci_ops pci_direct_conf1;
+
+static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; }
+
+int (*pcibios_enable_irq)(struct pci_dev *dev) = &pci_visws_enable_irq;
+
+void __init pcibios_penalize_isa_irq(int irq) {}
+
+
+unsigned int pci_bus0, pci_bus1;
+
+static inline u8 bridge_swizzle(u8 pin, u8 slot) 
+{
+	return (((pin - 1) + slot) % 4) + 1;
+}
+
+static u8 __init visws_swizzle(struct pci_dev *dev, u8 *pinp)
+{
+	u8 pin = *pinp;
+
+	while (dev->bus->self) {	/* Move up the chain of bridges. */
+		pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
+		dev = dev->bus->self;
+	}
+	*pinp = pin;
+
+	return PCI_SLOT(dev->devfn);
+}
+
+static int __init visws_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
+{
+	int irq, bus = dev->bus->number;
+
+	pin--;
+
+	/* Nothing usefull at PIIX4 pin 1 */
+	if (bus == pci_bus0 && slot == 4 && pin == 0)
+		return -1;
+
+	/* PIIX4 USB is on Bus 0, Slot 4, Line 3 */
+	if (bus == pci_bus0 && slot == 4 && pin == 3) {
+		irq = CO_IRQ(CO_APIC_PIIX4_USB);
+		goto out;
+	}
+
+	/* First pin spread down 1 APIC entry per slot */
+	if (pin == 0) {
+		irq = CO_IRQ((bus == pci_bus0 ? CO_APIC_PCIB_BASE0 :
+						CO_APIC_PCIA_BASE0) + slot);
+		goto out;
+	}
+
+	/* lines 1,2,3 from any slot is shared in this twirly pattern */
+	if (bus == pci_bus1) {
+		/* lines 1-3 from devices 0 1 rotate over 2 apic entries */
+		irq = CO_IRQ(CO_APIC_PCIA_BASE123 + ((slot + (pin - 1)) % 2));
+	} else { /* bus == pci_bus0 */
+		/* lines 1-3 from devices 0-3 rotate over 3 apic entries */
+		if (slot == 0)
+			slot = 3; /* same pattern */
+		irq = CO_IRQ(CO_APIC_PCIA_BASE123 + ((3 - slot) + (pin - 1) % 3));
+	}
+out:
+	printk(KERN_DEBUG "PCI: Bus %d Slot %d Line %d -> IRQ %d\n", bus, slot, pin, irq);
+	return irq;
+}
+
+void __init pcibios_update_irq(struct pci_dev *dev, int irq)
+{
+	pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
+}
+
+static int __init pcibios_init(void)
+{
+	/* The VISWS supports configuration access type 1 only */
+	pci_probe = (pci_probe | PCI_PROBE_CONF1) &
+		    ~(PCI_PROBE_BIOS | PCI_PROBE_CONF2);
+
+	pci_bus0 = li_pcib_read16(LI_PCI_BUSNUM) & 0xff;
+	pci_bus1 = li_pcia_read16(LI_PCI_BUSNUM) & 0xff;
+
+	printk(KERN_INFO "PCI: Lithium bridge A bus: %u, "
+		"bridge B (PIIX4) bus: %u\n", pci_bus1, pci_bus0);
+
+	pci_scan_bus(pci_bus0, &pci_direct_conf1, NULL);
+	pci_scan_bus(pci_bus1, &pci_direct_conf1, NULL);
+	pci_fixup_irqs(visws_swizzle, visws_map_irq);
+	pcibios_resource_survey();
+	return 0;
+}
+
+subsys_initcall(pcibios_init);
diff -Nru a/arch/i386/vmlinux.lds.S b/arch/i386/vmlinux.lds.S
--- a/arch/i386/vmlinux.lds.S	Sun Feb 23 22:25:22 2003
+++ b/arch/i386/vmlinux.lds.S	Sun Feb 23 22:25:22 2003
@@ -6,7 +6,7 @@
 	
 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
 OUTPUT_ARCH(i386)
-ENTRY(_start)
+ENTRY(startup_32)
 jiffies = jiffies_64;
 SECTIONS
 {
diff -Nru a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c
--- a/arch/ia64/hp/sim/simeth.c	Sun Feb 23 22:25:25 2003
+++ b/arch/ia64/hp/sim/simeth.c	Sun Feb 23 22:25:25 2003
@@ -149,7 +149,7 @@
 static inline int
 netdev_attach(int fd, int irq, unsigned int ipaddr)
 {
-	/* this puts the host interface in the right mode (start interupting) */
+	/* this puts the host interface in the right mode (start interrupting) */
 	return ia64_ssc(fd, ipaddr, 0,0, SSC_NETDEV_ATTACH);
 }
 
diff -Nru a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
--- a/arch/ia64/ia32/sys_ia32.c	Sun Feb 23 22:25:25 2003
+++ b/arch/ia64/ia32/sys_ia32.c	Sun Feb 23 22:25:25 2003
@@ -4063,7 +4063,7 @@
 	return err;
 }
 
-/* Handle adjtimex compatability. */
+/* Handle adjtimex compatibility. */
 
 struct timex32 {
 	u32 modes;
diff -Nru a/arch/ia64/sn/io/l1.c b/arch/ia64/sn/io/l1.c
--- a/arch/ia64/sn/io/l1.c	Sun Feb 23 22:25:26 2003
+++ b/arch/ia64/sn/io/l1.c	Sun Feb 23 22:25:26 2003
@@ -2734,7 +2734,7 @@
  * bigger.
  *
  * Be careful using the same buffer for both cmd and resp; it could get
- * hairy if there were ever an L1 command reqeuest that spanned multiple
+ * hairy if there were ever an L1 command request that spanned multiple
  * packets.  (On the other hand, that would require some additional
  * rewriting of the L1 command interface anyway.)
  */
diff -Nru a/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c b/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c
--- a/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c	Sun Feb 23 22:25:27 2003
+++ b/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c	Sun Feb 23 22:25:27 2003
@@ -3505,7 +3505,7 @@
     } else
 	xio_port = pcibr_dmamap->bd_xio_port;
 
-    /* If this DMA is to an addres that
+    /* If this DMA is to an address that
      * refers back to this Bridge chip,
      * reduce it back to the correct
      * PCI MEM address.
diff -Nru a/arch/ia64/sn/io/sn2/pcibr/pcibr_error.c b/arch/ia64/sn/io/sn2/pcibr/pcibr_error.c
--- a/arch/ia64/sn/io/sn2/pcibr/pcibr_error.c	Sun Feb 23 22:25:21 2003
+++ b/arch/ia64/sn/io/sn2/pcibr/pcibr_error.c	Sun Feb 23 22:25:21 2003
@@ -1874,7 +1874,7 @@
 			BRIDGE_ERRUPPR_ADDRMASK) << 32)));
 
     /*
-     * need to ensure that the xtalk adress in ioe
+     * need to ensure that the xtalk address in ioe
      * maps to PCI error address read from bridge.
      * How to convert PCI address back to Xtalk address ?
      * (better idea: convert XTalk address to PCI address
diff -Nru a/arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c b/arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c
--- a/arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c	Sun Feb 23 22:25:27 2003
+++ b/arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c	Sun Feb 23 22:25:27 2003
@@ -272,7 +272,7 @@
 	    * the old do_pcibr_rrb_free() code only clears the enable bit
 	    * but I say we should clear the whole rrb (ie):
 	    *	  reg = reg & ~(RRB_MASK << (RRB_SIZE * rrb_index));
-	    * But to be compatable with old code we'll only clear enable.
+	    * But to be compatible with old code we'll only clear enable.
 	    */
 	    reg = reg & ~(RRB_ENABLE_BIT(bridge) << (RRB_SIZE * rrb_index));
 	    clr = clr | (enable_bit << (RRB_SIZE * rrb_index));
diff -Nru a/arch/ia64/sn/io/xbow.c b/arch/ia64/sn/io/xbow.c
--- a/arch/ia64/sn/io/xbow.c	Sun Feb 23 22:25:21 2003
+++ b/arch/ia64/sn/io/xbow.c	Sun Feb 23 22:25:21 2003
@@ -305,7 +305,7 @@
 
     /*
      * get the name of this xbow vertex and keep the info.
-     * This is needed during errors and interupts, but as
+     * This is needed during errors and interrupts, but as
      * long as we have it, we can use it elsewhere.
      */
     s = dev_to_name(vhdl, devnm, MAXDEVNAME);
diff -Nru a/arch/ia64/sn/io/xtalk.c b/arch/ia64/sn/io/xtalk.c
--- a/arch/ia64/sn/io/xtalk.c	Sun Feb 23 22:25:22 2003
+++ b/arch/ia64/sn/io/xtalk.c	Sun Feb 23 22:25:22 2003
@@ -890,7 +890,7 @@
     widget_info->w_einfo = 0;
     /*
      * get the name of this xwidget vertex and keep the info.
-     * This is needed during errors and interupts, but as
+     * This is needed during errors and interrupts, but as
      * long as we have it, we can use it elsewhere.
      */
     s = dev_to_name(widget,devnm,MAXDEVNAME);
diff -Nru a/arch/m68k/ifpsp060/src/fpsp.S b/arch/m68k/ifpsp060/src/fpsp.S
--- a/arch/m68k/ifpsp060/src/fpsp.S	Sun Feb 23 22:25:26 2003
+++ b/arch/m68k/ifpsp060/src/fpsp.S	Sun Feb 23 22:25:26 2003
@@ -22147,7 +22147,7 @@
 add_ext:
 	addq.l		&1,FTEMP_LO(%a0)	# add 1 to l-bit
 	bcc.b		xcc_clr			# test for carry out
-	addq.l		&1,FTEMP_HI(%a0)	# propogate carry
+	addq.l		&1,FTEMP_HI(%a0)	# propagate carry
 	bcc.b		xcc_clr
 	roxr.w		FTEMP_HI(%a0)		# mant is 0 so restore v-bit
 	roxr.w		FTEMP_HI+2(%a0)		# mant is 0 so restore v-bit
@@ -22167,7 +22167,7 @@
 add_dbl:
 	add.l		&ad_1_dbl, FTEMP_LO(%a0) # add 1 to lsb
 	bcc.b		dcc_clr			# no carry
-	addq.l		&0x1, FTEMP_HI(%a0)	# propogate carry
+	addq.l		&0x1, FTEMP_HI(%a0)	# propagate carry
 	bcc.b		dcc_clr			# no carry
 
 	roxr.w		FTEMP_HI(%a0)		# mant is 0 so restore v-bit
diff -Nru a/arch/m68k/ifpsp060/src/isp.S b/arch/m68k/ifpsp060/src/isp.S
--- a/arch/m68k/ifpsp060/src/isp.S	Sun Feb 23 22:25:22 2003
+++ b/arch/m68k/ifpsp060/src/isp.S	Sun Feb 23 22:25:22 2003
@@ -2625,7 +2625,7 @@
 	addx.l		%d7, %d4		# add carry to hi(result)
 
 # the result is saved to the register file.
-# for '040 compatability, if Dl == Dh then only the hi(result) is
+# for '040 compatibility, if Dl == Dh then only the hi(result) is
 # saved. so, saving hi after lo accomplishes this without need to
 # check Dl,Dh equality.
 mul64_done:
diff -Nru a/arch/m68k/ifpsp060/src/pfpsp.S b/arch/m68k/ifpsp060/src/pfpsp.S
--- a/arch/m68k/ifpsp060/src/pfpsp.S	Sun Feb 23 22:25:22 2003
+++ b/arch/m68k/ifpsp060/src/pfpsp.S	Sun Feb 23 22:25:22 2003
@@ -6269,7 +6269,7 @@
 add_ext:
 	addq.l		&1,FTEMP_LO(%a0)	# add 1 to l-bit
 	bcc.b		xcc_clr			# test for carry out
-	addq.l		&1,FTEMP_HI(%a0)	# propogate carry
+	addq.l		&1,FTEMP_HI(%a0)	# propagate carry
 	bcc.b		xcc_clr
 	roxr.w		FTEMP_HI(%a0)		# mant is 0 so restore v-bit
 	roxr.w		FTEMP_HI+2(%a0)		# mant is 0 so restore v-bit
@@ -6289,7 +6289,7 @@
 add_dbl:
 	add.l		&ad_1_dbl, FTEMP_LO(%a0) # add 1 to lsb
 	bcc.b		dcc_clr			# no carry
-	addq.l		&0x1, FTEMP_HI(%a0)	# propogate carry
+	addq.l		&0x1, FTEMP_HI(%a0)	# propagate carry
 	bcc.b		dcc_clr			# no carry
 
 	roxr.w		FTEMP_HI(%a0)		# mant is 0 so restore v-bit
diff -Nru a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
--- a/arch/m68k/kernel/head.S	Sun Feb 23 22:25:27 2003
+++ b/arch/m68k/kernel/head.S	Sun Feb 23 22:25:27 2003
@@ -92,7 +92,7 @@
  *	mmu_map was written for two key reasons.  First, it was clear
  * that it was very difficult to read the previous code for mapping
  * regions of memory.  Second, the Macintosh required such extensive
- * memory allocations that it didn't make sense to propogate the
+ * memory allocations that it didn't make sense to propagate the
  * existing code any further.
  *	mmu_map requires some parameters:
  *
diff -Nru a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
--- a/arch/m68knommu/Kconfig	Sun Feb 23 22:25:25 2003
+++ b/arch/m68knommu/Kconfig	Sun Feb 23 22:25:25 2003
@@ -379,11 +379,6 @@
 	help
 	  Set RAM size to be 4MiB.
 
-config RAM4MB
-	bool "4MiB"
-	help
-	  Set RAM size to be 4MiB.
-
 config RAM8MB
 	bool "8MiB"
 	help
diff -Nru a/arch/m68knommu/kernel/init_task.c b/arch/m68knommu/kernel/init_task.c
--- a/arch/m68knommu/kernel/init_task.c	Sun Feb 23 22:25:23 2003
+++ b/arch/m68knommu/kernel/init_task.c	Sun Feb 23 22:25:23 2003
@@ -13,6 +13,7 @@
 static struct fs_struct init_fs = INIT_FS;
 static struct files_struct init_files = INIT_FILES;
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
+static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
 struct mm_struct init_mm = INIT_MM(init_mm);
 
 /*
diff -Nru a/arch/m68knommu/kernel/signal.c b/arch/m68knommu/kernel/signal.c
--- a/arch/m68knommu/kernel/signal.c	Sun Feb 23 22:25:25 2003
+++ b/arch/m68knommu/kernel/signal.c	Sun Feb 23 22:25:25 2003
@@ -783,7 +783,7 @@
 				/* Restart the system call the same way as
 				   if the process were not traced.  */
 				struct k_sigaction *ka =
-					&current->sig->action[signr-1];
+					&current->sighand->action[signr-1];
 				int has_handler =
 					(ka->sa.sa_handler != SIG_IGN &&
 					 ka->sa.sa_handler != SIG_DFL);
@@ -819,7 +819,7 @@
 			}
 		}
 
-		ka = &current->sig->action[signr-1];
+		ka = &current->sighand->action[signr-1];
 		if (ka->sa.sa_handler == SIG_IGN) {
 			if (signr != SIGCHLD)
 				continue;
@@ -848,8 +848,7 @@
 			case SIGSTOP:
 				current->state = TASK_STOPPED;
 				current->exit_code = signr;
-				if (!(current->parent->sig->action[SIGCHLD-1]
-				      .sa.sa_flags & SA_NOCLDSTOP))
+				if (!(current->parent->sighand->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
 					notify_parent(current, SIGCHLD);
 				schedule();
 				continue;
diff -Nru a/arch/m68knommu/mm/Makefile b/arch/m68knommu/mm/Makefile
--- a/arch/m68knommu/mm/Makefile	Sun Feb 23 22:25:27 2003
+++ b/arch/m68knommu/mm/Makefile	Sun Feb 23 22:25:27 2003
@@ -2,4 +2,4 @@
 # Makefile for the linux m68knommu specific parts of the memory manager.
 #
 
-obj-y += init.o fault.o memory.o kmap.o
+obj-y += init.o fault.o memory.o kmap.o extable.o
diff -Nru a/arch/m68knommu/mm/extable.c b/arch/m68knommu/mm/extable.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/m68knommu/mm/extable.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,30 @@
+/*
+ * linux/arch/m68knommu/mm/extable.c
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/spinlock.h>
+#include <asm/uaccess.h>
+
+/* Simple binary search */
+const struct exception_table_entry *
+search_extable(const struct exception_table_entry *first,
+	       const struct exception_table_entry *last,
+	       unsigned long value)
+{
+        while (first <= last) {
+		const struct exception_table_entry *mid;
+		long diff;
+
+		mid = (last - first) / 2 + first;
+		diff = mid->insn - value;
+                if (diff == 0)
+                        return mid;
+                else if (diff < 0)
+                        first = mid+1;
+                else
+                        last = mid-1;
+        }
+        return NULL;
+}
diff -Nru a/arch/m68knommu/platform/5307/vectors.c b/arch/m68knommu/platform/5307/vectors.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/m68knommu/platform/5307/vectors.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,94 @@
+/***************************************************************************/
+
+/*
+ *	linux/arch/m68knommu/platform/5307/vectors.c
+ *
+ *	Copyright (C) 1999-2003, Greg Ungerer <gerg@snapgear.com>
+ */
+
+/***************************************************************************/
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/param.h>
+#include <linux/init.h>
+#include <asm/irq.h>
+#include <asm/dma.h>
+#include <asm/traps.h>
+#include <asm/machdep.h>
+#include <asm/coldfire.h>
+#include <asm/mcftimer.h>
+#include <asm/mcfsim.h>
+#include <asm/mcfdma.h>
+#include <asm/delay.h>
+#include <asm/mcfwdebug.h>
+
+/***************************************************************************/
+
+#ifdef TRAP_DBG_INTERRUPT
+
+asmlinkage void dbginterrupt_c(struct frame *fp)
+{
+	extern void dump(struct pt_regs *fp);
+	printk("%s(%d): BUS ERROR TRAP\n", __FILE__, __LINE__);
+	dump((struct pt_regs *) fp);
+	asm("halt");
+}
+
+#endif
+
+/***************************************************************************/
+
+extern e_vector	*_ramvec;
+
+void set_evector(int vecnum, void (*handler)(void))
+{
+	if (vecnum >= 0 && vecnum <= 255)
+		_ramvec[vecnum] = handler;
+}
+
+/***************************************************************************/
+
+/* Assembler routines */
+asmlinkage void buserr(void);
+asmlinkage void trap(void);
+asmlinkage void system_call(void);
+asmlinkage void inthandler(void);
+
+void __init coldfire_trap_init(void)
+{
+	int i;
+
+	/*
+	 *	There is a common trap handler and common interrupt
+	 *	handler that handle almost every vector. We treat
+	 *	the system call and bus error special, they get their
+	 *	own first level handlers.
+	 */
+	for (i = 3; (i <= 23); i++)
+		_ramvec[i] = trap;
+	for (i = 33; (i <= 63); i++)
+		_ramvec[i] = trap;
+	for (i = 24; (i <= 31); i++)
+		_ramvec[i] = inthandler;
+	for (i = 64; (i < 255); i++)
+		_ramvec[i] = inthandler;
+	_ramvec[255] = 0;
+
+	_ramvec[2] = buserr;
+	_ramvec[32] = system_call;
+
+#ifdef TRAP_DBG_INTERRUPT
+	_ramvec[12] = dbginterrupt;
+#endif
+}
+
+/***************************************************************************/
+
+void coldfire_reset(void)
+{
+	HARD_RESET_NOW();
+}
+
+/***************************************************************************/
diff -Nru a/arch/m68knommu/platform/68328/entry.S b/arch/m68knommu/platform/68328/entry.S
--- a/arch/m68knommu/platform/68328/entry.S	Sun Feb 23 22:25:21 2003
+++ b/arch/m68knommu/platform/68328/entry.S	Sun Feb 23 22:25:21 2003
@@ -95,7 +95,7 @@
 Luser_return:
 	/* only allow interrupts when we are really the last one on the*/
 	/* kernel stack, otherwise stack overflow can occur during*/
-	/* heavy interupt load*/
+	/* heavy interrupt load*/
 	andw	#ALLOWINT,%sr
 
 	movel	%sp,%d1			/* get thread_info pointer */
diff -Nru a/arch/m68knommu/platform/68328/pilot/crt0_rom.S b/arch/m68knommu/platform/68328/pilot/crt0_rom.S
--- a/arch/m68knommu/platform/68328/pilot/crt0_rom.S	Sun Feb 23 22:25:26 2003
+++ b/arch/m68knommu/platform/68328/pilot/crt0_rom.S	Sun Feb 23 22:25:26 2003
@@ -1,4 +1,6 @@
-/* linux/arch/m68knommu/kernel/head.S:  A startup file for the MC68332 
+/*
+ * linux/arch/m68knommu/platform/68328/pilot/crt0_rom.S
+ * - A startup file for the MC68332 
  *
  * Copyright (C) 1998  D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>,
  *                     Kenneth Albanowski <kjahds@kjahds.com>,
@@ -16,8 +18,6 @@
 #include <linux/config.h>
 
 .global _stext
-.global __bss_start
-
 .global _start
 
 .global _rambase
@@ -81,30 +81,28 @@
 	movew	#0x0800, 0xfffff906 /* Ignore CTS */
 	movew	#0x010b, 0xfffff902 /* BAUD to 9600 */
 
-	movew	#0x2410,	0xfffff200 /* PLLCR */
-	movew	#0x123,	0xfffff202 /* PLLFSR */
+	movew	#0x2410, 0xfffff200 /* PLLCR */
+	movew	#0x123, 0xfffff202 /* PLLFSR */
 
 #ifdef CONFIG_PILOT
-	moveb	#0,      0xfffffA27 /* LCKCON */
+	moveb	#0, 0xfffffA27 /* LCKCON */
 	movel   #_start, 0xfffffA00 /* LSSA */
-	moveb   #0xa,    0xfffffA05 /* LVPW */
-	movew	#0x9f,   0xFFFFFa08 /* LXMAX */
-	movew	#0x9f,   0xFFFFFa0a /* LYMAX */
-	moveb   #9,      0xfffffa29 /* LBAR */
-	moveb   #0,      0xfffffa25 /* LPXCD */
-	moveb	#0x04,   0xFFFFFa20 /* LPICF */
-	moveb	#0x58,   0xfffffA27 /* LCKCON */
-	moveb	#0x85,	0xfffff429 /* PFDATA */
-	moveb	#0xd8,   0xfffffA27 /* LCKCON */
-	moveb	#0xc5,	0xfffff429 /* PFDATA */
-	moveb	#0xd5,	0xfffff429 /* PFDATA */
+	moveb   #0xa, 0xfffffA05 /* LVPW */
+	movew	#0x9f, 0xFFFFFa08 /* LXMAX */
+	movew	#0x9f, 0xFFFFFa0a /* LYMAX */
+	moveb   #9, 0xfffffa29 /* LBAR */
+	moveb   #0, 0xfffffa25 /* LPXCD */
+	moveb	#0x04, 0xFFFFFa20 /* LPICF */
+	moveb	#0x58, 0xfffffA27 /* LCKCON */
+	moveb	#0x85, 0xfffff429 /* PFDATA */
+	moveb	#0xd8, 0xfffffA27 /* LCKCON */
+	moveb	#0xc5, 0xfffff429 /* PFDATA */
+	moveb	#0xd5, 0xfffff429 /* PFDATA */
 
 	moveal	#0x00100000, %a3
 	moveal	#0x100ffc00, %a4
-
 #endif /* CONFIG_PILOT */
 
-
 #endif /* CONFIG_M68328 */
 
 	movew   #0x2700, %sr
@@ -126,7 +124,7 @@
 	movel	#__ramvec, %d7
 	addl	#16, %d7
 	moveal	%d7, %a0
-	moveal	#end, %a1
+	moveal	#_ebss, %a1
 	lea	%a1@(512), %a2
 
 	DBG_PUTC('C')
@@ -139,9 +137,9 @@
 	bhi	L2
 
 	/* Copy data segment from ROM to RAM */
-	moveal	#__data_rom_start, %a0
-	moveal	#__data_start, %a1
-	moveal	#__data_end, %a2
+	moveal	#_etext, %a0
+	moveal	#_sdata, %a1
+	moveal	#_edata, %a2
 
 	DBG_PUTC('D')
 
@@ -154,8 +152,8 @@
 
 	DBG_PUTC('E')
 
-	moveal	#__bss_start, %a0
-	moveal	#end, %a1
+	moveal	#_sbss, %a0
+	moveal	#_ebss, %a1
 
 	/* Copy 0 to %a0 until %a0 == %a1 */
 L1:
@@ -166,7 +164,7 @@
 	DBG_PUTC('F')
 
 	/* Copy command line from end of bss to command line */
-	moveal	#end, %a0
+	moveal	#_ebss, %a0
 	moveal	#command_line, %a1
 	lea	%a1@(512), %a2
 
@@ -180,17 +178,17 @@
 	bhi	L3
 
 	movel	#_sdata, %d0	
-	movel	%d0,	_rambase	
-	movel	#end,	%d0
-	movel	%d0,	_ramstart
+	movel	%d0, _rambase	
+	movel	#_ebss,	%d0
+	movel	%d0, _ramstart
 
-	movel	%a4,	%d0
-	subl	#4096,	%d0	/* Reserve 4K of stack */
+	movel	%a4, %d0
+	subl	#4096, %d0	/* Reserve 4K of stack */
 	moveq	#79, %d7
-	movel	%d0,	_ramend
+	movel	%d0, _ramend
 
-	movel	%a3,	%d0
-	movel	%d0,	rom_length
+	movel	%a3, %d0
+	movel	%d0, rom_length
 
 	pea	0
 	pea	env
@@ -200,12 +198,10 @@
 	DBG_PUTC('H')
 
 #ifdef CONFIG_PILOT
-	
-	movel	#penguin_bits,	0xFFFFFA00
-	moveb	#10,		0xFFFFFA05
-	movew	#160,		0xFFFFFA08
-	movew	#160,		0xFFFFFA0A
-
+	movel	#penguin_bits, 0xFFFFFA00
+	moveb	#10, 0xFFFFFA05
+	movew	#160, 0xFFFFFA08
+	movew	#160, 0xFFFFFA0A
 #endif /* CONFIG_PILOT */
 
 	DBG_PUTC('I')
diff -Nru a/arch/m68knommu/platform/68360/commproc.c b/arch/m68knommu/platform/68360/commproc.c
--- a/arch/m68knommu/platform/68360/commproc.c	Sun Feb 23 22:25:26 2003
+++ b/arch/m68knommu/platform/68360/commproc.c	Sun Feb 23 22:25:26 2003
@@ -90,7 +90,7 @@
 	while (pquicc->cp_cr & CMD_FLAG);
 
 	/* On the recommendation of the 68360 manual, p. 7-60
-	 * - Set sdma interupt service mask to 7
+	 * - Set sdma interrupt service mask to 7
 	 * - Set sdma arbitration ID to 4
 	 */
 	pquicc->sdma_sdcr = 0x0740;
diff -Nru a/arch/m68knommu/platform/68360/entry.S b/arch/m68knommu/platform/68360/entry.S
--- a/arch/m68knommu/platform/68360/entry.S	Sun Feb 23 22:25:25 2003
+++ b/arch/m68knommu/platform/68360/entry.S	Sun Feb 23 22:25:25 2003
@@ -91,7 +91,7 @@
 Luser_return:
 	/* only allow interrupts when we are really the last one on the*/
 	/* kernel stack, otherwise stack overflow can occur during*/
-	/* heavy interupt load*/
+	/* heavy interrupt load*/
 	andw	#ALLOWINT,%sr
 
 	movel	%sp,%d1			/* get thread_info pointer */
diff -Nru a/arch/m68knommu/platform/68360/uCquicc/crt0_ram.S b/arch/m68knommu/platform/68360/uCquicc/crt0_ram.S
--- a/arch/m68knommu/platform/68360/uCquicc/crt0_ram.S	Sun Feb 23 22:25:27 2003
+++ b/arch/m68knommu/platform/68360/uCquicc/crt0_ram.S	Sun Feb 23 22:25:27 2003
@@ -15,7 +15,6 @@
 #include <linux/config.h>
 
 .global _stext
-.global __bss_start
 .global _start
 
 .global _rambase
@@ -26,7 +25,6 @@
 
 .global _quicc_base
 .global _periph_base
-.global _dprbase
 
 #define REGB                        0x1000
 #define PEPAR                       (_dprbase + REGB + 0x0016)
@@ -94,63 +92,62 @@
 #include <asm/m68360_regs.h>
 
 	
-/* By the time this RAM specific code begins to execute, DPRAM
- * and DRAM should already be mapped and accessible. */
+/*
+ * By the time this RAM specific code begins to execute, DPRAM
+ * and DRAM should already be mapped and accessible.
+ */
 
 	.text
 _start:
 _stext:
-    nop
-    ori.w   #MCU_DISABLE_INTRPTS,   %sr     /* disable interrupts: */
-    /* We should not need to setup the boot stack the reset should do it. */
-    movea.l	#_boot_stack,           %sp     /*set up stack at the end of DRAM:*/
-
+	nop
+	ori.w	#MCU_DISABLE_INTRPTS, %sr	/* disable interrupts: */
+	/* We should not need to setup the boot stack the reset should do it. */
+	movea.l	#__ramend, %sp			/*set up stack at the end of DRAM:*/
 
 set_mbar_register:
-    moveq.l #0x07,                  %d1     /* Setup MBAR */
-    movec	%d1,                    %dfc
+	moveq.l	#0x07, %d1			/* Setup MBAR */
+	movec	%d1, %dfc
 
-    lea.l   MCU_SIM_MBAR_ADRS,      %a0
-    move.l  #_dprbase,              %d0
-    andi.l  #MCU_SIM_MBAR_BA_MASK,  %d0
-    ori.l   #MCU_SIM_MBAR_AS_MASK,  %d0
-    moves.l %d0,                    %a0@
+	lea.l	MCU_SIM_MBAR_ADRS, %a0
+	move.l	#_dprbase, %d0
+	andi.l	#MCU_SIM_MBAR_BA_MASK, %d0
+	ori.l	#MCU_SIM_MBAR_AS_MASK, %d0
+	moves.l	%d0, %a0@
 
-    moveq.l #0x05,                  %d1
-    movec.l %d1,                    %dfc
+	moveq.l	#0x05, %d1
+	movec.l	%d1, %dfc
 
-/* Now we can begin to access registers in DPRAM */
+	/* Now we can begin to access registers in DPRAM */
 
 set_sim_mcr:
-    /* Set Module Configuration Register */
-    move.l  #MCU_SIM_MCR,           MCR
-
-/* to do:	Determine cause of reset */
+	/* Set Module Configuration Register */
+	move.l	#MCU_SIM_MCR, MCR
 
+	/* to do:	Determine cause of reset */
 
-    /*
-    *       configure system clock MC68360 p. 6-40
-    *       (value +1)*osc/128 = system clock
-    */
+	/*
+	 *       configure system clock MC68360 p. 6-40
+	 *       (value +1)*osc/128 = system clock
+	 */
 set_sim_clock:
-    move.w  #MCU_SIM_PLLCR,         PLLCR
-    move.b  #MCU_SIM_CLKOCR,        CLKOCR
-    move.w  #MCU_SIM_CDVCR,         CDVCR
+	move.w	#MCU_SIM_PLLCR, PLLCR
+	move.b	#MCU_SIM_CLKOCR, CLKOCR
+	move.w	#MCU_SIM_CDVCR, CDVCR
 
-    // Wait for the PLL to settle
-    move.w      #16384, %d0
+	/* Wait for the PLL to settle */
+	move.w	#16384, %d0
 pll_settle_wait:
-    subi.w       #1, %d0
-    bne	pll_settle_wait
+	subi.w	#1, %d0
+	bne	pll_settle_wait
 
-    /* Setup the system protection register, and watchdog timer register */
+	/* Setup the system protection register, and watchdog timer register */
+	move.b	#MCU_SIM_SWIV, SWIV
+	move.w	#MCU_SIM_PICR, PICR
+	move.w	#MCU_SIM_PITR, PITR
+	move.w	#MCU_SIM_SYPCR, SYPCR
 
-    move.b      #MCU_SIM_SWIV,      SWIV
-    move.w      #MCU_SIM_PICR,      PICR
-    move.w      #MCU_SIM_PITR,      PITR
-    move.w      #MCU_SIM_SYPCR,     SYPCR
-
-/* Clear DPRAM - system + parameter */
+	/* Clear DPRAM - system + parameter */
 	movea.l	#_dprbase, %a0
 	movea.l	#_dprbase+0x2000, %a1
 
@@ -161,72 +158,68 @@
 	bhi	clear_dpram
 
 configure_memory_controller:    
-    /*
-    *   Set up Global Memory Register (GMR)
-    */
-    move.l      #MCU_SIM_GMR,   %d0
-    move.l      %d0, GMR
+	/* Set up Global Memory Register (GMR) */
+	move.l	#MCU_SIM_GMR, %d0
+	move.l	%d0, GMR
 
 configure_chip_select_0:
-    move.l      #__ramend,      %d0
-    subi.l      #__ramstart,    %d0
-    subq.l      #0x01,          %d0
-    eori.l      #SIM_OR_MASK,   %d0
-    ori.l       #SIM_OR0_MASK,  %d0
-    move.l      %d0,            OR0
-
-    move.l      #__ramstart,    %d0
-    ori.l       #SIM_BR0_MASK,  %d0
-    move.l      %d0,            BR0
-
+	move.l	#__ramend, %d0
+	subi.l	#__ramstart, %d0
+	subq.l	#0x01, %d0
+	eori.l	#SIM_OR_MASK, %d0
+	ori.l	#SIM_OR0_MASK, %d0
+	move.l	%d0, OR0
+
+	move.l	#__ramstart, %d0
+	ori.l	#SIM_BR0_MASK, %d0
+	move.l	%d0, BR0
 
 configure_chip_select_1:
-    move.l      #__flashend,    %d0
-    subi.l      #__flashstart,  %d0
-    subq.l      #0x01,          %d0
-    eori.l      #SIM_OR_MASK,   %d0
-    ori.l       #SIM_OR1_MASK,  %d0
-    move.l      %d0,            OR1
-
-    move.l      #__flashstart,  %d0
-    ori.l       #SIM_BR1_MASK,  %d0
-    move.l      %d0,            BR1
-
-
-    move.w      #MCU_SIM_PEPAR, PEPAR 
-
-/* point to vector table: */
-    move.l  #_romvec,   %a0
-    move.l	#_ramvec,   %a1
+	move.l	#__rom_end, %d0
+	subi.l	#__rom_start, %d0
+	subq.l	#0x01, %d0
+	eori.l	#SIM_OR_MASK, %d0
+	ori.l	#SIM_OR1_MASK, %d0
+	move.l	%d0, OR1
+
+	move.l	#__rom_start, %d0
+	ori.l	#SIM_BR1_MASK, %d0
+	move.l	%d0, BR1
+
+	move.w	#MCU_SIM_PEPAR, PEPAR 
+
+	/* point to vector table: */
+	move.l	#_romvec, %a0
+	move.l	#_ramvec, %a1
 copy_vectors:
-    move.l  %a0@,       %d0
-    move.l  %d0,        %a1@
-    move.l  %a0@,       %a1@
-    addq.l  #0x04,      %a0
-    addq.l  #0x04,      %a1
-    cmp.l   #_start,    %a0
-    blt     copy_vectors
+	move.l	%a0@, %d0
+	move.l	%d0, %a1@
+	move.l	%a0@, %a1@
+	addq.l	#0x04, %a0
+	addq.l	#0x04, %a1
+	cmp.l	#_start, %a0
+	blt	copy_vectors
 
-    move.l	#_ramvec, %a1
-    movec	%a1, %vbr
+	move.l	#_ramvec, %a1
+	movec	%a1, %vbr
 
 
 	/* Copy data segment from ROM to RAM */
-	moveal	#__data_rom_start, %a0
-	moveal	#__data_start, %a1
-	moveal	#__data_end, %a2
+	moveal	#_stext, %a0
+	moveal	#_sdata, %a1
+	moveal	#_edata, %a2
 
 	/* Copy %a0 to %a1 until %a1 == %a2 */
 LD1:
-    move.l  %a0@,   %d0
-    addq.l  #0x04,  %a0
-    move.l  %d0,    %a1@
-    addq.l  #0x04,  %a1
-    cmp.l   #__data_end,    %a1
-    blt     LD1
+	move.l	%a0@, %d0
+	addq.l	#0x04, %a0
+	move.l	%d0, %a1@
+	addq.l	#0x04, %a1
+	cmp.l	#_edata, %a1
+	blt     LD1
 
-	moveal	#__bss_start, %a0
-	moveal	#end, %a1
+	moveal	#_sbss, %a0
+	moveal	#_ebss, %a1
 
 	/* Copy 0 to %a0 until %a0 == %a1 */
 L1:
@@ -235,21 +228,21 @@
 	bhi	L1
 
 load_quicc:
-    move.l  #_dprbase,  _quicc_base
+	move.l	#_dprbase, _quicc_base
 
 store_ram_size:
-    /* Set ram size information */
-    move.l  #_sdata,    _rambase
-    move.l  #end,       _ramstart
-    move.l  #__ramend,  %d0
-    sub.l   #0x1000,    %d0     /* Reserve 4K for stack space.*/
-    move.l  %d0,        _ramend /* Different from __ramend.*/
+	/* Set ram size information */
+	move.l	#_sdata, _rambase
+	move.l	#_ebss, _ramstart
+	move.l	#__ramend, %d0
+	sub.l	#0x1000, %d0			/* Reserve 4K for stack space.*/
+	move.l	%d0, _ramend			/* Different from __ramend.*/
 
 store_flash_size:
-    /* Set rom size information */
-    move.l  #__flashend,    %d0
-    sub.l   #__flashstart,  %d0
-    move.l  %d0,            rom_length
+	/* Set rom size information */
+	move.l	#__rom_end, %d0
+	sub.l	#__rom_start, %d0
+	move.l	%d0, rom_length
     
 	pea	0
 	pea	env
@@ -260,17 +253,14 @@
 	lea	0x2000(%a2), %sp
 
 lp:
-    jsr	start_kernel
- /*   jmp lp */
+	jsr	start_kernel
 
 _exit:
-
 	jmp	_exit
 
 
-
 	.data
-    .align 4
+	.align 4
 env:
 	.long	0
 _quicc_base:
@@ -278,13 +268,16 @@
 _periph_base:
 	.long	0
 _ramvec:
-    .long   0
+	.long   0
 _rambase:
-    .long   0
+	.long   0
 _ramstart:
-    .long   0
+	.long   0
 _ramend:
-    .long   0
+	.long   0
+_dprbase:
+	.long	0xffffe000
+
 	.text
 
     /*
@@ -293,7 +286,7 @@
      */
  
 .section ".data.initvect","awx"
-    .long   _boot_stack /* Reset: Initial Stack Pointer                 - 0.  */
+    .long   __ramend	/* Reset: Initial Stack Pointer                 - 0.  */
     .long   _start      /* Reset: Initial Program Counter               - 1.  */
     .long   buserr      /* Bus Error                                    - 2.  */
     .long   trap        /* Address Error                                - 3.  */
diff -Nru a/arch/m68knommu/platform/68360/uCquicc/crt0_rom.S b/arch/m68knommu/platform/68360/uCquicc/crt0_rom.S
--- a/arch/m68knommu/platform/68360/uCquicc/crt0_rom.S	Sun Feb 23 22:25:26 2003
+++ b/arch/m68knommu/platform/68360/uCquicc/crt0_rom.S	Sun Feb 23 22:25:26 2003
@@ -11,11 +11,10 @@
  * Copyright (C) 1998  D. Jeff Dionne <jeff@uclinux.org>,
  *
  */
-#define ASSEMBLY
 #include <linux/config.h>
 
 .global _stext
-.global __bss_start
+.global _sbss
 .global _start
 
 .global _rambase
@@ -26,7 +25,6 @@
 
 .global _quicc_base
 .global _periph_base
-.global _dprbase
 
 #define REGB                        0x1000
 #define PEPAR                       (_dprbase + REGB + 0x0016)
@@ -78,7 +76,6 @@
 #define SIM_OR0_MASK                0x20000000
 #define SIM_BR0_MASK                0x00000001
 
-
 /* Defines for chip select one - the RAM */
 #define SIM_OR1_MASK                0x10000000
 #define SIM_BR1_MASK                0x00000001
@@ -107,66 +104,66 @@
 #include <asm/m68360_regs.h>
 
 	
-/* By the time this RAM specific code begins to execute, DPRAM
- * and DRAM should already be mapped and accessible. */
+/*
+ * By the time this RAM specific code begins to execute, DPRAM
+ * and DRAM should already be mapped and accessible.
+ */
 
 	.text
 _start:
 _stext:
-    nop
-    ori.w   #MCU_DISABLE_INTRPTS,   %sr     /* disable interrupts: */
-    /* We should not need to setup the boot stack the reset should do it. */
-    movea.l	#_boot_stack,           %sp     /*set up stack at the end of DRAM:*/
+	nop
+	ori.w	#MCU_DISABLE_INTRPTS, %sr	/* disable interrupts: */
+	/* We should not need to setup the boot stack the reset should do it. */
+	movea.l	#__ramend, %sp		/* set up stack at the end of DRAM:*/
 
 
 set_mbar_register:
-    moveq.l #0x07,                  %d1     /* Setup MBAR */
-    movec	%d1,                    %dfc
+	moveq.l	#0x07, %d1			/* Setup MBAR */
+	movec	%d1, %dfc
 
-    lea.l   MCU_SIM_MBAR_ADRS,      %a0
-    move.l  #_dprbase,              %d0
-    andi.l  #MCU_SIM_MBAR_BA_MASK,  %d0
-    ori.l   #MCU_SIM_MBAR_AS_MASK,  %d0
-    moves.l %d0,                    %a0@
+	lea.l	MCU_SIM_MBAR_ADRS, %a0
+	move.l	#_dprbase, %d0
+	andi.l	#MCU_SIM_MBAR_BA_MASK, %d0
+	ori.l	#MCU_SIM_MBAR_AS_MASK, %d0
+	moves.l	%d0, %a0@
 
-    moveq.l #0x05,                  %d1
-    movec.l %d1,                    %dfc
+	moveq.l	#0x05, %d1
+	movec.l	%d1, %dfc
 
-/* Now we can begin to access registers in DPRAM */
+	/* Now we can begin to access registers in DPRAM */
 
 set_sim_mcr:
-    /* Set Module Configuration Register */
-    move.l  #MCU_SIM_MCR,           MCR
-
-/* to do:	Determine cause of reset */
+	/* Set Module Configuration Register */
+	move.l	#MCU_SIM_MCR, MCR
 
+	/* to do:	Determine cause of reset */
 
-    /*
-    *       configure system clock MC68360 p. 6-40
-    *       (value +1)*osc/128 = system clock
-    *                    or
-    *       (value + 1)*osc = system clock
-    *       You do not need to divide the oscillator by 128 unless you want to.
-    */
+	/*
+	 *	configure system clock MC68360 p. 6-40
+	 *	(value +1)*osc/128 = system clock
+	 *                    or
+	 *	(value + 1)*osc = system clock
+	 *	You do not need to divide the oscillator by 128 unless you want to.
+	 */
 set_sim_clock:
-    move.w  #MCU_SIM_PLLCR,         PLLCR
-    move.b  #MCU_SIM_CLKOCR,        CLKOCR
-    move.w  #MCU_SIM_CDVCR,         CDVCR
+	move.w	#MCU_SIM_PLLCR, PLLCR
+	move.b	#MCU_SIM_CLKOCR, CLKOCR
+	move.w	#MCU_SIM_CDVCR, CDVCR
 
-    // Wait for the PLL to settle
-    move.w      #16384, %d0
+	/* Wait for the PLL to settle */
+	move.w	#16384, %d0
 pll_settle_wait:
-    subi.w       #1, %d0
-    bne	pll_settle_wait
+	subi.w	#1, %d0
+	bne	pll_settle_wait
 
-    /* Setup the system protection register, and watchdog timer register */
+	/* Setup the system protection register, and watchdog timer register */
+	move.b	#MCU_SIM_SWIV, SWIV
+	move.w	#MCU_SIM_PICR, PICR
+	move.w	#MCU_SIM_PITR, PITR
+	move.w	#MCU_SIM_SYPCR, SYPCR
 
-    move.b      #MCU_SIM_SWIV,      SWIV
-    move.w      #MCU_SIM_PICR,      PICR
-    move.w      #MCU_SIM_PITR,      PITR
-    move.w      #MCU_SIM_SYPCR,     SYPCR
-
-/* Clear DPRAM - system + parameter */
+	/* Clear DPRAM - system + parameter */
 	movea.l	#_dprbase, %a0
 	movea.l	#_dprbase+0x2000, %a1
 
@@ -177,65 +174,63 @@
 	bhi	clear_dpram
 
 configure_memory_controller:    
-    /*
-    *   Set up Global Memory Register (GMR)
-    */
-    move.l      #MCU_SIM_GMR,   %d0
-    move.l      %d0, GMR
+	/* Set up Global Memory Register (GMR) */
+	move.l	#MCU_SIM_GMR, %d0
+	move.l	%d0, GMR
 
 configure_chip_select_0:
-    move.l      #0x00400000,    %d0
-    subq.l      #0x01,          %d0
-    eori.l      #SIM_OR_MASK,   %d0
-    ori.l       #SIM_OR0_MASK,  %d0
-    move.l      %d0,            OR0
-
-    move.l      #__flashstart,  %d0
-    ori.l       #SIM_BR0_MASK,  %d0
-    move.l      %d0,            BR0
-
-    move.l      #0x0,           BR1
-    move.l      #0x0,           BR2
-    move.l      #0x0,           BR3
-    move.l      #0x0,           BR4
-    move.l      #0x0,           BR5
-    move.l      #0x0,           BR6
-    move.l      #0x0,           BR7
-
-    move.w      #MCU_SIM_PEPAR, PEPAR 
-
-/* point to vector table: */
-    move.l  #_romvec,   %a0
-    move.l	#_ramvec,   %a1
+	move.l	#0x00400000, %d0
+	subq.l	#0x01, %d0
+	eori.l	#SIM_OR_MASK, %d0
+	ori.l	#SIM_OR0_MASK, %d0
+	move.l	%d0, OR0
+
+	move.l	#__rom_start, %d0
+	ori.l	#SIM_BR0_MASK, %d0
+	move.l	%d0, BR0
+
+	move.l	#0x0, BR1
+	move.l	#0x0, BR2
+	move.l	#0x0, BR3
+	move.l	#0x0, BR4
+	move.l	#0x0, BR5
+	move.l	#0x0, BR6
+	move.l	#0x0, BR7
+
+	move.w	#MCU_SIM_PEPAR, PEPAR 
+
+	/* point to vector table: */
+	move.l	#_romvec, %a0
+	move.l	#_ramvec, %a1
 copy_vectors:
-    move.l  %a0@,       %d0
-    move.l  %d0,        %a1@
-    move.l  %a0@,       %a1@
-    addq.l  #0x04,      %a0
-    addq.l  #0x04,      %a1
-    cmp.l   #_start,    %a0
-    blt     copy_vectors
+	move.l	%a0@, %d0
+	move.l	%d0, %a1@
+	move.l	%a0@, %a1@
+	addq.l	#0x04, %a0
+	addq.l	#0x04, %a1
+	cmp.l	#_start, %a0
+	blt	copy_vectors
 
-    move.l	#_ramvec, %a1
-    movec	%a1, %vbr
+	move.l	#_ramvec, %a1
+	movec	%a1, %vbr
 
 
 	/* Copy data segment from ROM to RAM */
-	moveal	#__data_rom_start, %a0
-	moveal	#__data_start, %a1
-	moveal	#__data_end, %a2
+	moveal	#_etext, %a0
+	moveal	#_sdata, %a1
+	moveal	#_edata, %a2
 
 	/* Copy %a0 to %a1 until %a1 == %a2 */
 LD1:
-    move.l  %a0@,   %d0
-    addq.l  #0x04,  %a0
-    move.l  %d0,    %a1@
-    addq.l  #0x04,  %a1
-    cmp.l   #__data_end,    %a1
-    blt     LD1
+	move.l	%a0@, %d0
+	addq.l	#0x04, %a0
+	move.l	%d0, %a1@
+	addq.l	#0x04, %a1
+	cmp.l	#_edata, %a1
+	blt	LD1
 
-	moveal	#__bss_start, %a0
-	moveal	#end, %a1
+	moveal	#_sbss, %a0
+	moveal	#_ebss, %a1
 
 	/* Copy 0 to %a0 until %a0 == %a1 */
 L1:
@@ -244,21 +239,21 @@
 	bhi	L1
 
 load_quicc:
-    move.l  #_dprbase,  _quicc_base
+	move.l	#_dprbase, _quicc_base
 
 store_ram_size:
-    /* Set ram size information */
-    move.l  #_sdata,    _rambase
-    move.l  #end,       _ramstart
-    move.l  #__ramend,  %d0
-    sub.l   #0x1000,    %d0     /* Reserve 4K for stack space.*/
-    move.l  %d0,        _ramend /* Different from __ramend.*/
+	/* Set ram size information */
+	move.l	#_sdata, _rambase
+	move.l	#_ebss, _ramstart
+	move.l	#__ramend, %d0
+	sub.l	#0x1000, %d0			/* Reserve 4K for stack space.*/
+	move.l	%d0, _ramend			/* Different from __ramend.*/
 
 store_flash_size:
-    /* Set rom size information */
-    move.l  #__flashend,    %d0
-    sub.l   #__flashstart,  %d0
-    move.l  %d0,            rom_length
+	/* Set rom size information */
+	move.l	#__rom_end, %d0
+	sub.l	#__rom_start, %d0
+	move.l	%d0, rom_length
     
 	pea	0
 	pea	env
@@ -269,17 +264,14 @@
 	lea	0x2000(%a2), %sp
 
 lp:
-    jsr	start_kernel
- /*   jmp lp */
+	jsr	start_kernel
 
 _exit:
-
 	jmp	_exit
 
 
-
 	.data
-    .align 4
+	.align 4
 env:
 	.long	0
 _quicc_base:
@@ -287,13 +279,17 @@
 _periph_base:
 	.long	0
 _ramvec:
-    .long   0
+	.long   0
 _rambase:
-    .long   0
+	.long   0
 _ramstart:
-    .long   0
+	.long   0
 _ramend:
-    .long   0
+	.long   0
+_dprbase:
+	.long	0xffffe000
+
+
 	.text
 
     /*
@@ -302,7 +298,7 @@
      */
  
 .section ".data.initvect","awx"
-    .long   _boot_stack /* Reset: Initial Stack Pointer                 - 0.  */
+    .long   __ramend	/* Reset: Initial Stack Pointer                 - 0.  */
     .long   _start      /* Reset: Initial Program Counter               - 1.  */
     .long   buserr      /* Bus Error                                    - 2.  */
     .long   trap        /* Address Error                                - 3.  */
diff -Nru a/arch/m68knommu/platform/68VZ328/ucdimm/config.c b/arch/m68knommu/platform/68VZ328/ucdimm/config.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/m68knommu/platform/68VZ328/ucdimm/config.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,119 @@
+/*
+ *  linux/arch/m68knommu/platform/68VZ328/ucdimm/config.c
+ *
+ *  Copyright (C) 1993 Hamish Macdonald
+ *  Copyright (C) 1999 D. Jeff Dionne
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+#include <stdarg.h>
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/tty.h>
+#include <linux/console.h>
+
+#include <asm/setup.h>
+#include <asm/system.h>
+#include <asm/pgtable.h>
+#include <asm/irq.h>
+#include <asm/machdep.h>
+#include <asm/MC68VZ328.h>
+#include <asm/bootstd.h>
+
+void BSP_sched_init(void (*timer_routine)(int, void *, struct pt_regs *))
+{
+	/* Restart mode, Enable int, 32KHz, Enable timer */
+	TCTL = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_32KHZ | TCTL_TEN;
+	/* Set prescaler (Divide 32KHz by 32)*/
+	TPRER = 31;
+	/* Set compare register  32Khz / 32 / 10 = 100 */
+	TCMP = 10;                                                              
+
+	request_irq(TMR_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL);
+}
+
+void BSP_tick(void)
+{
+  	/* Reset Timer1 */
+	TSTAT &= 0;
+}
+
+unsigned long BSP_gettimeoffset (void)
+{
+	return 0;
+}
+
+void BSP_gettod (int *yearp, int *monp, int *dayp,
+		   int *hourp, int *minp, int *secp)
+{
+}
+
+int BSP_hwclk(int op, struct hwclk_time *t)
+{
+	if (!op) {
+		/* read */
+	} else {
+		/* write */
+	}
+	return 0;
+}
+
+int BSP_set_clock_mmss (unsigned long nowtime)
+{
+#if 0
+	short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
+
+	tod->second1 = real_seconds / 10;
+	tod->second2 = real_seconds % 10;
+	tod->minute1 = real_minutes / 10;
+	tod->minute2 = real_minutes % 10;
+#endif
+	return 0;
+}
+
+void BSP_reset (void)
+{
+	local_irq_disable();
+	asm volatile ("
+		moveal #0x10c00000, %a0;
+		moveb #0, 0xFFFFF300;
+		moveal 0(%a0), %sp;
+		moveal 4(%a0), %a0;
+		jmp (%a0);
+	");
+}
+
+unsigned char *cs8900a_hwaddr;
+static int errno;
+
+_bsc0(char *, getserialnum)
+_bsc1(unsigned char *, gethwaddr, int, a)
+_bsc1(char *, getbenv, char *, a)
+
+void config_BSP(char *command, int len)
+{
+	unsigned char *p;
+
+	printk("\n68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n");
+
+	printk("uCdimm serial string [%s]\n",getserialnum());
+	p = cs8900a_hwaddr = gethwaddr(0);
+	printk("uCdimm hwaddr %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
+		p[0], p[1], p[2], p[3], p[4], p[5]);
+	p = getbenv("APPEND");
+	if (p) strcpy(p,command);
+	else command[0] = 0;
+ 
+	mach_sched_init      = BSP_sched_init;
+	mach_tick            = BSP_tick;
+	mach_gettimeoffset   = BSP_gettimeoffset;
+	mach_gettod          = BSP_gettod;
+	mach_reset           = BSP_reset;
+
+	config_M68VZ328_irq();
+}
diff -Nru a/arch/m68knommu/vmlinux.lds.S b/arch/m68knommu/vmlinux.lds.S
--- a/arch/m68knommu/vmlinux.lds.S	Sun Feb 23 22:25:24 2003
+++ b/arch/m68knommu/vmlinux.lds.S	Sun Feb 23 22:25:24 2003
@@ -1,7 +1,7 @@
 /*
  *	vmlinux.lds.S -- master linker script for m68knommu arch
  *
- *	(C) Copyright 2002, Greg Ungerer <gerg@snapgear.com>
+ *	(C) Copyright 2002-2003, Greg Ungerer <gerg@snapgear.com>
  *
  *	This ends up looking compilcated, because of the number of
  *	address variations for ram and rom/flash layouts. The real
@@ -226,7 +226,32 @@
 		*(__ex_table)
 		__stop___ex_table = .;
 
-		RODATA
+		*(.rodata) *(.rodata.*)
+		*(__vermagic)		/* Kernel version magic */
+		*(.rodata1)
+
+		/* Kernel symbol table: Normal symbols */
+		__start___ksymtab = .;
+		*(__ksymtab)
+		__stop___ksymtab = .;
+
+		/* Kernel symbol table: GPL-only symbols */
+		__start___ksymtab_gpl = .;
+		*(__ksymtab_gpl)
+		__stop___ksymtab_gpl = .;
+
+		/* Kernel symbol table: Normal symbols */
+		__start___kcrctab = .;
+		*(__kcrctab)
+		__stop___kcrctab = .;
+
+		/* Kernel symbol table: GPL-only symbols */
+		__start___kcrctab_gpl = .;
+		*(__kcrctab_gpl)
+		__stop___kcrctab_gpl = .;
+
+		/* Kernel symbol table: strings */
+		*(__ksymtab_strings)
 
 		. = ALIGN(4) ;
 		_etext = . ;
diff -Nru a/arch/mips/au1000/common/serial.c b/arch/mips/au1000/common/serial.c
--- a/arch/mips/au1000/common/serial.c	Sun Feb 23 22:25:23 2003
+++ b/arch/mips/au1000/common/serial.c	Sun Feb 23 22:25:23 2003
@@ -195,7 +195,7 @@
 
 #if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
 #define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \
- kdevname(tty->device), (info->flags), serial_refcount,info->count,tty->count,s)
+ cdevname(tty->device), (info->flags), serial_refcount,info->count,tty->count,s)
 #else
 #define DBG_CNT(s)
 #endif
@@ -227,11 +227,11 @@
 		"Warning: null async_struct for (%s) in %s\n";
 
 	if (!info) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (info->magic != SERIAL_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/arch/mips/baget/vacserial.c b/arch/mips/baget/vacserial.c
--- a/arch/mips/baget/vacserial.c	Sun Feb 23 22:25:25 2003
+++ b/arch/mips/baget/vacserial.c	Sun Feb 23 22:25:25 2003
@@ -29,7 +29,7 @@
   
 #if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
 #define DBG_CNT(s) baget_printk("(%s):[%x] refc=%d, serc=%d, ttyc=%d-> %s\n", \
-  kdevname(tty->device),(info->flags),serial_refcount,info->count,tty->count,s)
+  cdevname(tty->device),(info->flags),serial_refcount,info->count,tty->count,s)
 #else
 #define DBG_CNT(s)
 #endif
@@ -173,11 +173,11 @@
 		"Warning: null async_struct for (%s) in %s\n";
 
 	if (!info) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (info->magic != SERIAL_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/arch/mips/ddb5xxx/common/pci.c b/arch/mips/ddb5xxx/common/pci.c
--- a/arch/mips/ddb5xxx/common/pci.c	Sun Feb 23 22:25:27 2003
+++ b/arch/mips/ddb5xxx/common/pci.c	Sun Feb 23 22:25:27 2003
@@ -148,7 +148,7 @@
                 }
                 bus->resource[0]->flags |= pci_bridge_check_io(dev);
                 bus->resource[1]->flags |= IORESOURCE_MEM;
-                /* For now, propogate hose limits to the bus;
+                /* For now, propagate hose limits to the bus;
                    we'll adjust them later. */
                 bus->resource[0]->end = hose->io_resource->end;
                 bus->resource[1]->end = hose->mem_resource->end;
diff -Nru a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
--- a/arch/mips/kernel/irixsig.c	Sun Feb 23 22:25:26 2003
+++ b/arch/mips/kernel/irixsig.c	Sun Feb 23 22:25:26 2003
@@ -1,5 +1,5 @@
 /*
- * irixsig.c: WHEEE, IRIX signals!  YOW, am I compatable or what?!?!
+ * irixsig.c: WHEEE, IRIX signals!  YOW, am I compatible or what?!?!
  *
  * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
  * Copyright (C) 1997 - 2000 Ralf Baechle (ralf@gnu.org)
diff -Nru a/arch/mips/kernel/pci.c b/arch/mips/kernel/pci.c
--- a/arch/mips/kernel/pci.c	Sun Feb 23 22:25:25 2003
+++ b/arch/mips/kernel/pci.c	Sun Feb 23 22:25:25 2003
@@ -145,7 +145,7 @@
 		}
 		bus->resource[0]->flags |= pci_bridge_check_io(dev);
 		bus->resource[1]->flags |= IORESOURCE_MEM;
-		/* For now, propogate hose limits to the bus;
+		/* For now, propagate hose limits to the bus;
 		   we'll adjust them later. */
 		bus->resource[0]->end = hose->io_resource->end;
 		bus->resource[1]->end = hose->mem_resource->end;
diff -Nru a/arch/mips/philips/nino/int-handler.S b/arch/mips/philips/nino/int-handler.S
--- a/arch/mips/philips/nino/int-handler.S	Sun Feb 23 22:25:21 2003
+++ b/arch/mips/philips/nino/int-handler.S	Sun Feb 23 22:25:21 2003
@@ -72,7 +72,7 @@
 		nop
 
 /*
- * Ok, we've got one of over a hundred other interupts.
+ * Ok, we've got one of over a hundred other interrupts.
  */
 low_priority:
 		lui	t0, %hi(IntStatus1)
diff -Nru a/arch/mips64/kernel/linux32.c b/arch/mips64/kernel/linux32.c
--- a/arch/mips64/kernel/linux32.c	Sun Feb 23 22:25:25 2003
+++ b/arch/mips64/kernel/linux32.c	Sun Feb 23 22:25:25 2003
@@ -1800,7 +1800,7 @@
 	return ret;
 }
 
-/* Handle adjtimex compatability. */
+/* Handle adjtimex compatibility. */
 
 struct timex32 {
 	u32 modes;
diff -Nru a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile
--- a/arch/parisc/kernel/Makefile	Sun Feb 23 22:25:23 2003
+++ b/arch/parisc/kernel/Makefile	Sun Feb 23 22:25:23 2003
@@ -16,7 +16,6 @@
 		   processor.o pdc_chassis.o
 
 obj-$(CONFIG_SMP)	+= smp.o
-obj-$(CONFIG_PROFILING)	+= profile.o
 obj-$(CONFIG_PA11)	+= pci-dma.o
 obj-$(CONFIG_PCI)	+= pci.o
 obj-$(CONFIG_MODULES)	+= module.o
diff -Nru a/arch/parisc/kernel/ioctl32.c b/arch/parisc/kernel/ioctl32.c
--- a/arch/parisc/kernel/ioctl32.c	Sun Feb 23 22:25:21 2003
+++ b/arch/parisc/kernel/ioctl32.c	Sun Feb 23 22:25:21 2003
@@ -2892,7 +2892,7 @@
 
 IOCTL_TABLE_START
 /* List here exlicitly which ioctl's are known to have
- * compatable types passed or none at all...
+ * compatible types passed or none at all...
  */
 /* Big T */
 COMPATIBLE_IOCTL(TCGETA)
diff -Nru a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
--- a/arch/parisc/kernel/irq.c	Sun Feb 23 22:25:23 2003
+++ b/arch/parisc/kernel/irq.c	Sun Feb 23 22:25:23 2003
@@ -447,7 +447,7 @@
 
 	/* 1) only process IRQs that are enabled/unmasked (cpu_eiem)
 	 * 2) We loop here on EIRR contents in order to avoid
-	 *    nested interrupts or having to take another interupt
+	 *    nested interrupts or having to take another interrupt
 	 *    when we could have just handled it right away.
 	 * 3) Limit the number of times we loop to make sure other
 	 *    processing can occur.
diff -Nru a/arch/parisc/kernel/parisc_ksyms.c b/arch/parisc/kernel/parisc_ksyms.c
--- a/arch/parisc/kernel/parisc_ksyms.c	Sun Feb 23 22:25:27 2003
+++ b/arch/parisc/kernel/parisc_ksyms.c	Sun Feb 23 22:25:27 2003
@@ -207,10 +207,5 @@
 EXPORT_SYMBOL_NOVERS($$dyncall);
 #endif
 
-#ifdef CONFIG_PROFILING
-EXPORT_SYMBOL_GPL(register_profile_notifier);
-EXPORT_SYMBOL_GPL(unregister_profile_notifier);
-#endif
-
 #include <asm/pgtable.h>
 EXPORT_SYMBOL_NOVERS(vmalloc_start);
diff -Nru a/arch/parisc/kernel/profile.c b/arch/parisc/kernel/profile.c
--- a/arch/parisc/kernel/profile.c	Sun Feb 23 22:25:23 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,43 +0,0 @@
-/* arch/parisc/kernel/profile.c
- *
- * Almost entirely copied from ppc64 which is:
- * (C) 2002 John Levon <levon@movementarian.org>
- */
-
-#include <linux/profile.h>
-#include <linux/spinlock.h>
-#include <linux/notifier.h>
-#include <asm/irq.h>
-
-static struct notifier_block *profile_listeners;
-static rwlock_t profile_lock = RW_LOCK_UNLOCKED;
-
-int register_profile_notifier(struct notifier_block *nb)
-{
-	int err;
-
-	write_lock_irq(&profile_lock);
-	err = notifier_chain_register(&profile_listeners, nb);
-	write_unlock_irq(&profile_lock);
-
-	return err;
-}
-
-int unregister_profile_notifier(struct notifier_block *nb)
-{
-	int err;
-
-	write_lock_irq(&profile_lock);
-	err = notifier_chain_unregister(&profile_listeners, nb);
-	write_unlock_irq(&profile_lock);
-
-	return err;
-}
-
-void parisc_profile_hook(struct pt_regs *regs)
-{
-	read_lock(&profile_lock);
-	notifier_call_chain(&profile_listeners, 0, regs);
-	read_unlock(&profile_lock);
-}
-
diff -Nru a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
--- a/arch/parisc/kernel/time.c	Sun Feb 23 22:25:23 2003
+++ b/arch/parisc/kernel/time.c	Sun Feb 23 22:25:23 2003
@@ -51,11 +51,7 @@
 	extern unsigned long prof_cpu_mask;
 	extern char _stext;
 
-#ifdef CONFIG_PROFILING
-	extern void parisc_profile_hook(struct pt_regs *);
-
-	parisc_profile_hook(regs);
-#endif
+	profile_hook(regs);
 
 	if (user_mode(regs))
 		return;
diff -Nru a/arch/ppc/8260_io/uart.c b/arch/ppc/8260_io/uart.c
--- a/arch/ppc/8260_io/uart.c	Sun Feb 23 22:25:21 2003
+++ b/arch/ppc/8260_io/uart.c	Sun Feb 23 22:25:21 2003
@@ -227,11 +227,11 @@
 		"Warning: null async_struct for (%s) in %s\n";
 
 	if (!info) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (info->magic != SERIAL_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/arch/ppc/8xx_io/uart.c b/arch/ppc/8xx_io/uart.c
--- a/arch/ppc/8xx_io/uart.c	Sun Feb 23 22:25:25 2003
+++ b/arch/ppc/8xx_io/uart.c	Sun Feb 23 22:25:25 2003
@@ -242,11 +242,11 @@
 		"Warning: null async_struct for (%s) in %s\n";
 
 	if (!info) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (info->magic != SERIAL_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
--- a/arch/ppc/kernel/entry.S	Sun Feb 23 22:25:26 2003
+++ b/arch/ppc/kernel/entry.S	Sun Feb 23 22:25:26 2003
@@ -30,6 +30,7 @@
 #include <asm/thread_info.h>
 #include <asm/ppc_asm.h>
 #include <asm/offsets.h>
+#include <asm/unistd.h>
 
 #undef SHOW_SYSCALLS
 #undef SHOW_SYSCALLS_TASK
diff -Nru a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
--- a/arch/ppc/kernel/misc.S	Sun Feb 23 22:25:26 2003
+++ b/arch/ppc/kernel/misc.S	Sun Feb 23 22:25:26 2003
@@ -837,7 +837,7 @@
 	bdnz	00b
 	blr	
 
-_GLOBAL(ide_insw)
+_GLOBAL(__ide_mm_insw)
 _GLOBAL(_insw_ns)
 	cmpwi	0,r5,0
 	mtctr	r5
@@ -849,7 +849,7 @@
 	bdnz	00b
 	blr
 
-_GLOBAL(ide_outsw)
+_GLOBAL(__ide_mm_outsw)
 _GLOBAL(_outsw_ns)
 	cmpwi	0,r5,0
 	mtctr	r5
@@ -861,6 +861,7 @@
 	bdnz	00b
 	blr	
 
+_GLOBAL(__ide_mm_insl)
 _GLOBAL(_insl_ns)
 	cmpwi	0,r5,0
 	mtctr	r5
@@ -872,6 +873,7 @@
 	bdnz	00b
 	blr
 
+_GLOBAL(__ide_mm_outsl)
 _GLOBAL(_outsl_ns)
 	cmpwi	0,r5,0
 	mtctr	r5
@@ -1281,7 +1283,12 @@
 	.long sys_epoll_ctl
 	.long sys_epoll_wait
  	.long sys_remap_file_pages
-
-	.rept NR_syscalls-(.-sys_call_table)/4
-		.long sys_ni_syscall
-	.endr
+ 	.long sys_timer_create	/* 240 */
+ 	.long sys_timer_settime
+ 	.long sys_timer_gettime
+ 	.long sys_timer_getoverrun
+ 	.long sys_timer_delete
+ 	.long sys_clock_settime	/* 245 */
+ 	.long sys_clock_gettime
+ 	.long sys_clock_getres
+ 	.long sys_clock_nanosleep
diff -Nru a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c
--- a/arch/ppc/kernel/process.c	Sun Feb 23 22:25:24 2003
+++ b/arch/ppc/kernel/process.c	Sun Feb 23 22:25:24 2003
@@ -197,10 +197,12 @@
 	return 1;
 }
 
-void __switch_to(struct task_struct *prev, struct task_struct *new)
+struct task_struct *__switch_to(struct task_struct *prev,
+	struct task_struct *new)
 {
 	struct thread_struct *new_thread, *old_thread;
 	unsigned long s;
+	struct task_struct *last;
 	
 	local_irq_save(s);
 #if CHECK_STACK
@@ -244,8 +246,9 @@
 		new->thread.regs->msr |= MSR_VEC;
 	new_thread = &new->thread;
 	old_thread = &current->thread;
-	_switch(old_thread, new_thread);
+	last = _switch(old_thread, new_thread);
 	local_irq_restore(s);
+	return last;
 }
 
 void show_regs(struct pt_regs * regs)
diff -Nru a/arch/ppc/xmon/ansidecl.h b/arch/ppc/xmon/ansidecl.h
--- a/arch/ppc/xmon/ansidecl.h	Sun Feb 23 22:25:27 2003
+++ b/arch/ppc/xmon/ansidecl.h	Sun Feb 23 22:25:27 2003
@@ -1,4 +1,4 @@
-/* ANSI and traditional C compatability macros
+/* ANSI and traditional C compatibility macros
    Copyright 1991, 1992 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
diff -Nru a/arch/ppc64/Makefile b/arch/ppc64/Makefile
--- a/arch/ppc64/Makefile	Sun Feb 23 22:25:22 2003
+++ b/arch/ppc64/Makefile	Sun Feb 23 22:25:22 2003
@@ -44,6 +44,8 @@
 archclean:
 	$(Q)$(MAKE) -f scripts/Makefile.clean obj=arch/ppc64/boot
 
+archmrproper:
+
 prepare: include/asm-ppc64/offsets.h
 
 arch/ppc64/kernel/asm-offsets.s: include/asm include/linux/version.h \
diff -Nru a/arch/ppc64/boot/Makefile b/arch/ppc64/boot/Makefile
--- a/arch/ppc64/boot/Makefile	Sun Feb 23 22:25:26 2003
+++ b/arch/ppc64/boot/Makefile	Sun Feb 23 22:25:26 2003
@@ -24,35 +24,45 @@
 #CROSS32_COMPILE = /usr/local/ppc/bin/powerpc-linux-
 
 BOOTCC		:= $(CROSS32_COMPILE)gcc
-BOOTCFLAGS	:= $(HOSTCFLAGS) -Iinclude
-BOOTLD		:= $(CROSS32_COMPILE)ld
+HOSTCC		:= gcc
+BOOTCFLAGS	:= $(HOSTCFLAGS) -Iinclude -fno-builtin 
 BOOTAS		:= $(CROSS32_COMPILE)as
-BOOTAFLAGS	:= -D__ASSEMBLY__ $(HOSTCFLAGS)
-
-CFLAGS		:= $(CPPFLAGS) -O -fno-builtin -DSTDC_HEADERS
-LD_ARGS		:= -Ttext 0x00400000 -e _start
-OBJCOPYFLAGS	:= -S -O binary
-
-obj-boot := start.o main.o zlib.o imagesize.o no_initrd.o
-OBJS     := crt0.o start.o main.o zlib.o imagesize.o image.o
-obj-boot := $(addprefix $(obj)/,$(obj-boot))
-OBJS     := $(addprefix $(obj)/,$(OBJS))
-targets  += $(obj-boot) $(addprefix $(obj)/,image.c image.o)
+BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional
+BOOTLD		:= $(CROSS32_COMPILE)ld
+BOOTLFLAGS	:= -Ttext 0x00400000 -e _start -T $(obj)/zImage.lds
+BOOTOBJCOPY	:= $(CROSS32_COMPILE)objcopy
+OBJCOPYFLAGS    := contents,alloc,load,readonly,data
+
+src-boot := crt0.S string.S prom.c main.c zlib.c imagesize.c
+src-boot := $(addprefix $(obj)/, $(src-boot))
+obj-boot := $(addsuffix .o, $(basename $(src-boot)))
 
 quiet_cmd_bootcc = BOOTCC  $@
       cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
-$(obj-boot): %.o: %.c FORCE
-	$(call if_changed_dep,bootcc)
 
 quiet_cmd_bootas = BOOTAS  $@
-      cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -traditional \
-						-c -o $@ $<
-$(obj)/crt0.o: %.o: %.S FORCE
+      cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
+
+$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
+	$(call if_changed_dep,bootcc)
+$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S
 	$(call if_changed_dep,bootas)
 
-host-progs		:= piggyback addnote addSystemMap addRamDisk
-HOSTCFLAGS_piggyback.o	:= -DKERNELBASE=$(KERNELBASE)
-EXTRA_TARGETS 		+= zImage zImage.initrd vmlinux.bin vmlinux.gz \
+#-----------------------------------------------------------
+# ELF sections within the zImage bootloader/wrapper
+#-----------------------------------------------------------
+required := vmlinux .config System.map
+initrd   := initrd
+
+obj-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.o, $(section)))
+src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
+gz-sec  = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
+
+host-progs		:= piggy addnote addSystemMap addRamDisk
+EXTRA_TARGETS 		+= zImage zImage.initrd imagesize.c \
+			   $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
+			   $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
+			   $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
 			   vmlinux.sm vmlinux.initrd vmlinux.sminitrd \
 			   sysmap.o initrd.o
 
@@ -69,42 +79,48 @@
 $(obj)/vmlinux.sminitrd: $(obj)/vmlinux.sm $(obj)/addRamDisk $(obj)/ramdisk.image.gz FORCE
 	$(call if_changed,ramdisk)
 
+$(obj)/sysmap.o: System.map $(obj)/piggyback
+	$(call if_changed,piggy)
+
+addsection = $(BOOTOBJCOPY) $(1) \
+		--add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(patsubst %.o,%.gz, $(1)) \
+		--set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(OBJCOPYFLAGS)
+
+quiet_cmd_addnote = ADDNOTE $@ 
+      cmd_addnote = $(BOOTLD) $(BOOTLFLAGS) -o $@ $(obj-boot) && $(obj)/addnote $@
 
 quiet_cmd_piggy = PIGGY   $@
       cmd_piggy = $(obj)/piggyback $(@:.o=) < $< | $(BOOTAS) -o $@
 
-$(obj)/image.o: $(obj)/vmlinux.gz $(obj)/piggyback FORCE
-	$(call if_changed,piggy)
+$(call gz-sec, $(required)): $(obj)/kernel-%.gz: %
+	$(call if_changed,gzip)
 
-$(obj)/sysmap.o: System.map $(obj)/piggyback FORCE
-	$(call if_changed,piggy)
+$(obj)/kernel-initrd.gz: $(obj)/ramdisk.image.gz
+	cp -f $(obj)/ramdisk.image.gz $@
 
-$(obj)/initrd.o: $(obj)/ramdisk.image.gz $(obj)/piggyback FORCE
-	$(call if_changed,piggy)
+$(call src-sec, $(required) $(initrd)): $(obj)/kernel-%.c: $(obj)/kernel-%.gz
+	touch $@
 
-quiet_cmd_addnote = ADDNOTE $@ 
-      cmd_addnote = $(BOOTLD) $(LD_ARGS) -T $(obj)/zImage.lds -o $@ $(OBJS) $<\
-		    && $(obj)/addnote $@
+$(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c
+	$(call if_changed_dep,bootcc)
+	$(call addsection, $@)
 
-$(obj)/zImage: $(obj)/no_initrd.o $(OBJS) $(obj)/addnote FORCE
+$(obj)/zImage: obj-boot += $(call obj-sec, $(required))
+$(obj)/zImage: $(call obj-sec, $(required)) $(obj-boot) $(obj)/addnote FORCE
 	$(call if_changed,addnote)
 
-$(obj)/zImage.initrd: $(obj)/initrd.o $(OBJS) $(obj)/addnote FORCE
+$(obj)/zImage.initrd: obj-boot += $(call obj-sec, $(required) $(initrd))
+$(obj)/zImage.initrd: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(obj)/addnote FORCE
 	$(call if_changed,addnote)
 
-$(obj)/vmlinux.bin: vmlinux FORCE
-	$(call if_changed,objcopy)
-
-$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
-	$(call if_changed,gzip)
-
 $(obj)/imagesize.c: vmlinux
 	@echo Generating $@
 	ls -l vmlinux | \
 	awk '{printf "/* generated -- do not edit! */\n" \
-		"int uncompressed_size = %d;\n", $$5}' > $(obj)/imagesize.c
+		"unsigned long vmlinux_filesize = %d;\n", $$5}' > $(obj)/imagesize.c
 	$(CROSS_COMPILE)nm -n vmlinux | tail -1 | \
-	awk '{printf "long vmlinux_end = 0x%s;\n", substr($$1,8)}' \
+	awk '{printf "unsigned long vmlinux_memsize = 0x%s;\n", substr($$1,8)}' \
 		>> $(obj)/imagesize.c
 
-clean-files :=  $(targets)
+
+clean-files := $(patsubst $(obj)/%,%, $(obj-boot))
diff -Nru a/arch/ppc64/boot/README b/arch/ppc64/boot/README
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc64/boot/README	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,11 @@
+
+To extract the kernel vmlinux, System.map, .config or initrd from the zImage binary:
+
+objcopy -j .kernel:vmlinux -O binary zImage vmlinux.gz
+objcopy -j .kernel:System.map -O binary zImage System.map.gz
+objcopy -j .kernel:.config -O binary zImage config.gz
+objcopy -j .kernel:initrd -O binary zImage.initrd initrd.gz
+
+
+	Peter
+
diff -Nru a/arch/ppc64/boot/addRamDisk.c b/arch/ppc64/boot/addRamDisk.c
--- a/arch/ppc64/boot/addRamDisk.c	Sun Feb 23 22:25:24 2003
+++ b/arch/ppc64/boot/addRamDisk.c	Sun Feb 23 22:25:24 2003
@@ -25,7 +25,7 @@
 
 void death(const char *msg, FILE *fdesc, const char *fname) 
 {
-	printf(msg);
+	fprintf(stderr, msg);
 	fclose(fdesc);
 	unlink(fname);
 	exit(1);
@@ -66,47 +66,47 @@
   
   
 	if (argc < 2) {
-		printf("Name of RAM disk file missing.\n");
+		fprintf(stderr, "Name of RAM disk file missing.\n");
 		exit(1);
 	}
 
 	if (argc < 3) {
-		printf("Name of System Map input file is missing.\n");
+		fprintf(stderr, "Name of System Map input file is missing.\n");
 		exit(1);
 	}
   
 	if (argc < 4) {
-		printf("Name of vmlinux file missing.\n");
+		fprintf(stderr, "Name of vmlinux file missing.\n");
 		exit(1);
 	}
 
 	if (argc < 5) {
-		printf("Name of vmlinux output file missing.\n");
+		fprintf(stderr, "Name of vmlinux output file missing.\n");
 		exit(1);
 	}
 
 
 	ramDisk = fopen(argv[1], "r");
 	if ( ! ramDisk ) {
-		printf("RAM disk file \"%s\" failed to open.\n", argv[1]);
+		fprintf(stderr, "RAM disk file \"%s\" failed to open.\n", argv[1]);
 		exit(1);
 	}
 
 	sysmap = fopen(argv[2], "r");
 	if ( ! sysmap ) {
-		printf("System Map file \"%s\" failed to open.\n", argv[2]);
+		fprintf(stderr, "System Map file \"%s\" failed to open.\n", argv[2]);
 		exit(1);
 	}
   
 	inputVmlinux = fopen(argv[3], "r");
 	if ( ! inputVmlinux ) {
-		printf("vmlinux file \"%s\" failed to open.\n", argv[3]);
+		fprintf(stderr, "vmlinux file \"%s\" failed to open.\n", argv[3]);
 		exit(1);
 	}
   
 	outputVmlinux = fopen(argv[4], "w+");
 	if ( ! outputVmlinux ) {
-		printf("output vmlinux file \"%s\" failed to open.\n", argv[4]);
+		fprintf(stderr, "output vmlinux file \"%s\" failed to open.\n", argv[4]);
 		exit(1);
 	}
   
@@ -118,7 +118,7 @@
 	fseek(inputVmlinux, 0, SEEK_SET);
 	printf("kernel file size = %d\n", kernelLen);
 	if ( kernelLen == 0 ) {
-		printf("You must have a linux kernel specified as argv[3]\n");
+		fprintf(stderr, "You must have a linux kernel specified as argv[3]\n");
 		exit(1);
 	}
 
@@ -154,15 +154,14 @@
   
 	/* Process the Sysmap file to determine where _end is */
 	sysmapPages = sysmapLen / 4096;
-	for (i=0; i<sysmapPages; ++i) {
-		get4k(sysmap, inbuf);
-	}
+	/* read the whole file line by line, expect that it doesnt fail */
+	while ( fgets(inbuf, 4096, sysmap) )  ;
 	/* search for _end in the last page of the system map */
 	ptr_end = strstr(inbuf, " _end");
 	if (!ptr_end) {
-		printf("Unable to find _end in the sysmap file \n");
-		printf("inbuf: \n");
-		printf("%s \n", inbuf);
+		fprintf(stderr, "Unable to find _end in the sysmap file \n");
+		fprintf(stderr, "inbuf: \n");
+		fprintf(stderr, "%s \n", inbuf);
 		exit(1);
 	}
 	printf("Found _end in the last page of the sysmap - backing up 10 characters it looks like %s", ptr_end-10);
diff -Nru a/arch/ppc64/boot/addSystemMap.c b/arch/ppc64/boot/addSystemMap.c
--- a/arch/ppc64/boot/addSystemMap.c	Sun Feb 23 22:25:24 2003
+++ b/arch/ppc64/boot/addSystemMap.c	Sun Feb 23 22:25:24 2003
@@ -64,38 +64,38 @@
 	long padPages = 0;
 	if ( argc < 2 )
 	{
-		printf("Name of System Map file missing.\n");
+		fprintf(stderr, "Name of System Map file missing.\n");
 		exit(1);
 	}
 
 	if ( argc < 3 )
 	{
-		printf("Name of vmlinux file missing.\n");
+		fprintf(stderr, "Name of vmlinux file missing.\n");
 		exit(1);
 	}
 
 	if ( argc < 4 )
 	{
-		printf("Name of vmlinux output file missing.\n");
+		fprintf(stderr, "Name of vmlinux output file missing.\n");
 		exit(1);
 	}
 
 	sysmap = fopen(argv[1], "r");
 	if ( ! sysmap )
 	{
-		printf("System Map file \"%s\" failed to open.\n", argv[1]);
+		fprintf(stderr, "System Map file \"%s\" failed to open.\n", argv[1]);
 		exit(1);
 	}
 	inputVmlinux = fopen(argv[2], "r");
 	if ( ! inputVmlinux )
 	{
-		printf("vmlinux file \"%s\" failed to open.\n", argv[2]);
+		fprintf(stderr, "vmlinux file \"%s\" failed to open.\n", argv[2]);
 		exit(1);
 	}
 	outputVmlinux = fopen(argv[3], "w");
 	if ( ! outputVmlinux )
 	{
-		printf("output vmlinux file \"%s\" failed to open.\n", argv[3]);
+		fprintf(stderr, "output vmlinux file \"%s\" failed to open.\n", argv[3]);
 		exit(1);
 	}
 
@@ -107,7 +107,7 @@
 	printf("kernel file size = %ld\n", kernelLen);
 	if ( kernelLen == 0 )
 	{
-		printf("You must have a linux kernel specified as argv[2]\n");
+		fprintf(stderr, "You must have a linux kernel specified as argv[2]\n");
 		exit(1);
 	}
 
@@ -146,17 +146,15 @@
   /* Process the Sysmap file to determine the true end of the kernel */
 	sysmapPages = sysmapLen / 4096;
 	printf("System map pages to copy = %ld\n", sysmapPages);
-	for (i=0; i<sysmapPages; ++i)
-	{
-		get4k(sysmap, inbuf);
-	}
+	/* read the whole file line by line, expect that it doesnt fail */
+	while ( fgets(inbuf, 4096, sysmap) )  ;
 	/* search for _end in the last page of the system map */
 	ptr_end = strstr(inbuf, " _end");
 	if (!ptr_end)
 	{
-		printf("Unable to find _end in the sysmap file \n");
-		printf("inbuf: \n");
-		printf("%s \n", inbuf);
+		fprintf(stderr, "Unable to find _end in the sysmap file \n");
+		fprintf(stderr, "inbuf: \n");
+		fprintf(stderr, "%s \n", inbuf);
 		exit(1);
 	}
 	printf("Found _end in the last page of the sysmap - backing up 10 characters it looks like %s", ptr_end-10);
diff -Nru a/arch/ppc64/boot/crt0.S b/arch/ppc64/boot/crt0.S
--- a/arch/ppc64/boot/crt0.S	Sun Feb 23 22:25:25 2003
+++ b/arch/ppc64/boot/crt0.S	Sun Feb 23 22:25:25 2003
@@ -8,258 +8,41 @@
  *
  * NOTE: this code runs in 32 bit mode and is packaged as ELF32.
  */
+
+#include <asm/ppc_asm.h>
+
 	.text
 	.globl	_start
 _start:
-	lis	9,_start@h
-	lis	8,_etext@ha
-	addi	8,8,_etext@l
-1:	dcbf	0,9
-	icbi	0,9
-	addi	9,9,0x20
-	cmplwi	0,9,8
+	lis	r9,_start@h
+	lis	r8,_etext@ha
+	addi	r8,r8,_etext@l
+1:	dcbf	r0,r9
+	icbi	r0,r9
+	addi	r9,r9,0x20
+	cmplwi	0,r9,8
 	blt	1b
 	sync
 	isync
 
 	## Clear out the BSS as per ANSI C requirements
 
-	lis 7,_end@ha
-	addi    7,7,_end@l		# r7 = &_end 
-	lis 8,__bss_start@ha		# 
-	addi    8,8,__bss_start@l	# r8 = &_bss_start
+	lis	r7,_end@ha
+	addi    r7,r7,_end@l		# r7 = &_end 
+	lis	r8,__bss_start@ha	# 
+	addi    r8,r8,__bss_start@l	# r8 = &_bss_start
 
 	## Determine how large an area, in number of words, to clear
 
-	subf	7,8,7			# r7 = &_end - &_bss_start + 1 
-	addi	7,7,3			# r7 += 3 
-	srwi.	7,7,2			# r7 = size in words.
-	beq	3f			# If the size is zero, do not bother
-	addi	8,8,-4			# r8 -= 4 
-	mtctr	7			# SPRN_CTR = number of words to clear
-	li	0,0			# r0 = 0
-2:	stwu	0,4(8)			# Clear out a word
-	bdnz	2b			# If we are not done yet, keep clearing
+	subf	r7,r8,r7		# r7 = &_end - &_bss_start + 1 
+	addi	r7,r7,3			# r7 += 3 
+	srwi.	r7,r7,2			# r7 = size in words.
+	beq	3f			# If the size is zero, don't bother
+	addi	r8,r8,-4		# r8 -= 4 
+	mtctr	r7			# SPRN_CTR = number of words to clear
+	li	r0,0			# r0 = 0
+2:	stwu	r0,4(r8)		# Clear out a word
+	bdnz	2b			# Keep clearing until done
 3:
-
-
 	b	start
 
-
-
-/*
- * Flush the dcache and invalidate the icache for a range of addresses.
- *
- * flush_cache(addr, len)
- */
-	.global	flush_cache
-flush_cache:
-	addi	4,4,0x1f	/* len = (len + 0x1f) / 0x20 */
-	rlwinm.	4,4,27,5,31
-	mtctr	4
-	beqlr
-1:	dcbf	0,3
-	icbi	0,3
-	addi	3,3,0x20
-	bdnz	1b
-	sync
-	isync
-	blr
-
-
-#define r0	0
-#define r3	3
-#define r4	4
-#define r5	5
-#define r6	6
-#define r7	7
-#define r8	8
-
-	.globl	strcpy
-strcpy:
-	addi	r5,r3,-1
-	addi	r4,r4,-1
-1:	lbzu	r0,1(r4)
-	cmpwi	0,r0,0
-	stbu	r0,1(r5)
-	bne	1b
-	blr
-
-	.globl	strncpy
-strncpy:
-	cmpwi	0,r5,0
-	beqlr
-	mtctr	r5
-	addi	r6,r3,-1
-	addi	r4,r4,-1
-1:	lbzu	r0,1(r4)
-	cmpwi	0,r0,0
-	stbu	r0,1(r6)
-	bdnzf	2,1b		/* dec ctr, branch if ctr != 0 && !cr0.eq */
-	blr
-
-	.globl	strcat
-strcat:
-	addi	r5,r3,-1
-	addi	r4,r4,-1
-1:	lbzu	r0,1(r5)
-	cmpwi	0,r0,0
-	bne	1b
-	addi	r5,r5,-1
-1:	lbzu	r0,1(r4)
-	cmpwi	0,r0,0
-	stbu	r0,1(r5)
-	bne	1b
-	blr
-
-	.globl	strcmp
-strcmp:
-	addi	r5,r3,-1
-	addi	r4,r4,-1
-1:	lbzu	r3,1(r5)
-	cmpwi	1,r3,0
-	lbzu	r0,1(r4)
-	subf.	r3,r0,r3
-	beqlr	1
-	beq	1b
-	blr
-
-	.globl	strlen
-strlen:
-	addi	r4,r3,-1
-1:	lbzu	r0,1(r4)
-	cmpwi	0,r0,0
-	bne	1b
-	subf	r3,r3,r4
-	blr
-
-	.globl	memset
-memset:
-	rlwimi	r4,r4,8,16,23
-	rlwimi	r4,r4,16,0,15
-	addi	r6,r3,-4
-	cmplwi	0,r5,4
-	blt	7f
-	stwu	r4,4(r6)
-	beqlr
-	andi.	r0,r6,3
-	add	r5,r0,r5
-	subf	r6,r0,r6
-	rlwinm	r0,r5,32-2,2,31
-	mtctr	r0
-	bdz	6f
-1:	stwu	r4,4(r6)
-	bdnz	1b
-6:	andi.	r5,r5,3
-7:	cmpwi	0,r5,0
-	beqlr
-	mtctr	r5
-	addi	r6,r6,3
-8:	stbu	r4,1(r6)
-	bdnz	8b
-	blr
-
-	.globl	bcopy
-bcopy:
-	mr	r6,r3
-	mr	r3,r4
-	mr	r4,r6
-	b	memcpy
-
-	.globl	memmove
-memmove:
-	cmplw	0,r3,r4
-	bgt	backwards_memcpy
-	/* fall through */
-
-	.globl	memcpy
-memcpy:
-	rlwinm.	r7,r5,32-3,3,31		/* r0 = r5 >> 3 */
-	addi	r6,r3,-4
-	addi	r4,r4,-4
-	beq	2f			/* if less than 8 bytes to do */
-	andi.	r0,r6,3			/* get dest word aligned */
-	mtctr	r7
-	bne	5f
-1:	lwz	r7,4(r4)
-	lwzu	r8,8(r4)
-	stw	r7,4(r6)
-	stwu	r8,8(r6)
-	bdnz	1b
-	andi.	r5,r5,7
-2:	cmplwi	0,r5,4
-	blt	3f
-	lwzu	r0,4(r4)
-	addi	r5,r5,-4
-	stwu	r0,4(r6)
-3:	cmpwi	0,r5,0
-	beqlr
-	mtctr	r5
-	addi	r4,r4,3
-	addi	r6,r6,3
-4:	lbzu	r0,1(r4)
-	stbu	r0,1(r6)
-	bdnz	4b
-	blr
-5:	subfic	r0,r0,4
-	mtctr	r0
-6:	lbz	r7,4(r4)
-	addi	r4,r4,1
-	stb	r7,4(r6)
-	addi	r6,r6,1
-	bdnz	6b
-	subf	r5,r0,r5
-	rlwinm.	r7,r5,32-3,3,31
-	beq	2b
-	mtctr	r7
-	b	1b
-
-	.globl	backwards_memcpy
-backwards_memcpy:
-	rlwinm.	r7,r5,32-3,3,31		/* r0 = r5 >> 3 */
-	add	r6,r3,r5
-	add	r4,r4,r5
-	beq	2f
-	andi.	r0,r6,3
-	mtctr	r7
-	bne	5f
-1:	lwz	r7,-4(r4)
-	lwzu	r8,-8(r4)
-	stw	r7,-4(r6)
-	stwu	r8,-8(r6)
-	bdnz	1b
-	andi.	r5,r5,7
-2:	cmplwi	0,r5,4
-	blt	3f
-	lwzu	r0,-4(r4)
-	subi	r5,r5,4
-	stwu	r0,-4(r6)
-3:	cmpwi	0,r5,0
-	beqlr
-	mtctr	r5
-4:	lbzu	r0,-1(r4)
-	stbu	r0,-1(r6)
-	bdnz	4b
-	blr
-5:	mtctr	r0
-6:	lbzu	r7,-1(r4)
-	stbu	r7,-1(r6)
-	bdnz	6b
-	subf	r5,r0,r5
-	rlwinm.	r7,r5,32-3,3,31
-	beq	2b
-	mtctr	r7
-	b	1b
-
-	.globl	memcmp
-memcmp:
-	cmpwi	0,r5,0
-	blelr
-	mtctr	r5
-	addi	r6,r3,-1
-	addi	r4,r4,-1
-1:	lbzu	r3,1(r6)
-	lbzu	r0,1(r4)
-	subf.	r3,r0,r3
-	bdnzt	2,1b
-	blr
diff -Nru a/arch/ppc64/boot/main.c b/arch/ppc64/boot/main.c
--- a/arch/ppc64/boot/main.c	Sun Feb 23 22:25:27 2003
+++ b/arch/ppc64/boot/main.c	Sun Feb 23 22:25:27 2003
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) Paul Mackerras 1997.
  *
- * Updates for PPC64 by Todd Inglett & Dave Engebretsen.
+ * Updates for PPC64 by Todd Inglett, Dave Engebretsen & Peter Bergner.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -9,31 +9,31 @@
  * 2 of the License, or (at your option) any later version.
  */
 #define __KERNEL__
+#include "ppc32-types.h"
 #include "zlib.h"
+#include <linux/elf.h>
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <asm/bootinfo.h>
 
-#undef DEBUG
-
 void memmove(void *dst, void *im, int len);
 
 extern void *finddevice(const char *);
 extern int getprop(void *, const char *, void *, int);
+extern void printk(char *fmt, ...);
 extern void printf(const char *fmt, ...);
 extern int sprintf(char *buf, const char *fmt, ...);
 void gunzip(void *, int, unsigned char *, int *);
 void *claim(unsigned int, unsigned int, unsigned int);
-void flush_cache(void *, int);
+void flush_cache(void *, unsigned long);
 void pause(void);
+extern void exit(void);
+
 static struct bi_record *make_bi_recs(unsigned long);
 
 #define RAM_START	0x00000000
 #define RAM_END		(64<<20)
 
-#define BOOT_START	((unsigned long)_start)
-#define BOOT_END	((unsigned long)_end)
-
 /* Value picked to match that used by yaboot */
 #define PROG_START	0x01400000
 
@@ -42,18 +42,26 @@
 char *avail_high;
 unsigned int heap_use;
 unsigned int heap_max;
-unsigned long initrd_start = 0;
-unsigned long initrd_size = 0;
 
 extern char _end[];
-extern char image_data[];
-extern int image_len;
-extern char initrd_data[];
-extern int initrd_len;
-extern char sysmap_data[];
-extern int sysmap_len;
-extern int uncompressed_size;
-extern long vmlinux_end;
+extern char _vmlinux_start[];
+extern char _vmlinux_end[];
+extern char _sysmap_start[];
+extern char _sysmap_end[];
+extern char _initrd_start[];
+extern char _initrd_end[];
+extern unsigned long vmlinux_filesize;
+extern unsigned long vmlinux_memsize;
+
+struct addr_range {
+	unsigned long addr;
+	unsigned long size;
+	unsigned long memsize;
+};
+struct addr_range vmlinux = {0, 0, 0};
+struct addr_range vmlinuz = {0, 0, 0};
+struct addr_range sysmap  = {0, 0, 0};
+struct addr_range initrd  = {0, 0, 0};
 
 static char scratch[128<<10];	/* 128kB of scratch space for gunzip */
 
@@ -62,66 +70,130 @@
                                 void *,
 				struct bi_record *);
 
+
+int (*prom)(void *);
+
+void *chosen_handle;
+void *stdin;
+void *stdout;
+void *stderr;
+
+
 void
-chrpboot(unsigned long a1, unsigned long a2, void *prom)
+start(unsigned long a1, unsigned long a2, void *promptr)
 {
-	unsigned len;
-	void *dst = (void *)-1;
-	unsigned long claim_addr;
-	unsigned char *im;
+	unsigned long i, claim_addr, claim_size;
 	extern char _start;
 	struct bi_record *bi_recs;
 	kernel_entry_t kernel_entry;
-    
-	printf("chrpboot starting: loaded at 0x%x\n\r", (unsigned)&_start);
+	Elf64_Ehdr *elf64;
+	Elf64_Phdr *elf64ph;
+
+	prom = (int (*)(void *)) promptr;
+	chosen_handle = finddevice("/chosen");
+	if (chosen_handle == (void *) -1)
+		exit();
+	if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
+		exit();
+	stderr = stdout;
+	if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
+		exit();
+
+	printf("zImage starting: loaded at 0x%x\n\r", (unsigned)&_start);
+
+#if 0
+	sysmap.size = (unsigned long)(_sysmap_end - _sysmap_start);
+	sysmap.memsize = sysmap.size;
+	if ( sysmap.size > 0 ) {
+		sysmap.addr = (RAM_END - sysmap.size) & ~0xFFF;
+		claim(sysmap.addr, RAM_END - sysmap.addr, 0);
+		printf("initial ramdisk moving 0x%lx <- 0x%lx (%lx bytes)\n\r",
+		       sysmap.addr, (unsigned long)_sysmap_start, sysmap.size);
+		memcpy((void *)sysmap.addr, (void *)_sysmap_start, sysmap.size);
+	}
+#endif
 
-	if (initrd_len) {
-		initrd_size = initrd_len;
-		initrd_start = (RAM_END - initrd_size) & ~0xFFF;
+	initrd.size = (unsigned long)(_initrd_end - _initrd_start);
+	initrd.memsize = initrd.size;
+	if ( initrd.size > 0 ) {
+		initrd.addr = (RAM_END - initrd.size) & ~0xFFF;
 		a1 = a2 = 0;
-		claim(initrd_start, RAM_END - initrd_start, 0);
+		claim(initrd.addr, RAM_END - initrd.addr, 0);
 		printf("initial ramdisk moving 0x%lx <- 0x%lx (%lx bytes)\n\r",
-		       initrd_start, (unsigned long)initrd_data, initrd_size);
-		memcpy((void *)initrd_start, (void *)initrd_data, initrd_size);
+		       initrd.addr, (unsigned long)_initrd_start, initrd.size);
+		memcpy((void *)initrd.addr, (void *)_initrd_start, initrd.size);
 	}
 
-	im = image_data;
-	len = image_len;
-	uncompressed_size = PAGE_ALIGN(uncompressed_size);
+	vmlinuz.addr = (unsigned long)_vmlinux_start;
+	vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start);
+	vmlinux.addr = (unsigned long)(void *)-1;
+	vmlinux.size = PAGE_ALIGN(vmlinux_filesize);
+	vmlinux.memsize = vmlinux_memsize;
 
+	claim_size = vmlinux.memsize /* PPPBBB: + fudge for bi_recs */;
 	for(claim_addr = PROG_START; 
 	    claim_addr <= PROG_START * 8; 
 	    claim_addr += 0x100000) {
 #ifdef DEBUG
 		printf("    trying: 0x%08lx\n\r", claim_addr);
 #endif
-		dst = claim(claim_addr, uncompressed_size, 0);
-		if (dst != (void *)-1) break;
+		vmlinux.addr = (unsigned long)claim(claim_addr, claim_size, 0);
+		if ((void *)vmlinux.addr != (void *)-1) break;
 	}
-	if (dst == (void *)-1) {
+	if ((void *)vmlinux.addr == (void *)-1) {
 		printf("claim error, can't allocate kernel memory\n\r");
-		return;
+		exit();
 	}
 
-	if (im[0] == 0x1f && im[1] == 0x8b) {
+	/* PPPBBB: should kernel always be gziped? */
+	if (*(unsigned short *)vmlinuz.addr == 0x1f8b) {
 		avail_ram = scratch;
 		begin_avail = avail_high = avail_ram;
 		end_avail = scratch + sizeof(scratch);
-		printf("gunzipping (0x%x <- 0x%x:0x%0x)...",
-		       (unsigned)dst, (unsigned)im, (unsigned)im+len);
-		gunzip(dst, uncompressed_size, im, &len);
-		printf("done %u bytes\n\r", len);
+		printf("gunzipping (0x%lx <- 0x%lx:0x%0lx)...",
+		       vmlinux.addr, vmlinuz.addr, vmlinuz.addr+vmlinuz.size);
+		gunzip((void *)vmlinux.addr, vmlinux.size,
+			(unsigned char *)vmlinuz.addr, (int *)&vmlinuz.size);
+		printf("done %lu bytes\n\r", vmlinuz.size);
 		printf("%u bytes of heap consumed, max in use %u\n\r",
 		       (unsigned)(avail_high - begin_avail), heap_max);
 	} else {
-		memmove(dst, im, len);
+		memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,vmlinuz.size);
+	}
+
+	/* Skip over the ELF header */
+	elf64 = (Elf64_Ehdr *)vmlinux.addr;
+	if ( elf64->e_ident[EI_MAG0]  != ELFMAG0	||
+	     elf64->e_ident[EI_MAG1]  != ELFMAG1	||
+	     elf64->e_ident[EI_MAG2]  != ELFMAG2	||
+	     elf64->e_ident[EI_MAG3]  != ELFMAG3	||
+	     elf64->e_ident[EI_CLASS] != ELFCLASS64	||
+	     elf64->e_ident[EI_DATA]  != ELFDATA2MSB	||
+	     elf64->e_type            != ET_EXEC	||
+	     elf64->e_machine         != EM_PPC64 )
+	{
+		printf("Error: not a valid PPC64 ELF file!\n\r");
+		exit();
+	}
+
+	elf64ph = (Elf64_Phdr *)((unsigned long)elf64 +
+				(unsigned long)elf64->e_phoff);
+	for(i=0; i < (unsigned int)elf64->e_phnum ;i++,elf64ph++) {
+		if (elf64ph->p_type == PT_LOAD && elf64ph->p_offset != 0)
+			break;
 	}
+#ifdef DEBUG
+	printf("... skipping 0x%lx bytes of ELF header\n\r",
+			(unsigned long)elf64ph->p_offset);
+#endif
+	vmlinux.addr += (unsigned long)elf64ph->p_offset;
+	vmlinux.size -= (unsigned long)elf64ph->p_offset;
 
-	flush_cache(dst, len);
+	flush_cache((void *)vmlinux.addr, vmlinux.memsize);
 
-	bi_recs = make_bi_recs((unsigned long)dst + vmlinux_end);
+	bi_recs = make_bi_recs(vmlinux.addr + vmlinux.memsize);
 
-	kernel_entry = (kernel_entry_t)dst;
+	kernel_entry = (kernel_entry_t)vmlinux.addr;
 #ifdef DEBUG
 	printf( "kernel:\n\r"
 		"        entry addr = 0x%lx\n\r"
@@ -135,9 +207,9 @@
 
 	kernel_entry( a1, a2, prom, bi_recs );
 
-	printf("returned?\n\r");
+	printf("Error: Linux kernel returned to zImage bootloader!\n\r");
 
-	pause();
+	exit();
 }
 
 static struct bi_record *
@@ -162,21 +234,19 @@
 	rec->data[0] = PLATFORM_PSERIES;
 	rec->data[1] = 1;
 
-	if ( initrd_size > 0 ) {
+	if ( initrd.size > 0 ) {
 		rec = bi_rec_alloc(rec, 2);
 		rec->tag = BI_INITRD;
-		rec->data[0] = initrd_start;
-		rec->data[1] = initrd_size;
+		rec->data[0] = initrd.addr;
+		rec->data[1] = initrd.size;
 	}
 
-#if 0
-	if ( sysmap_len > 0 ) {
+	if ( sysmap.size > 0 ) {
 		rec = bi_rec_alloc(rec, 2);
 		rec->tag = BI_SYSMAP;
-		rec->data[0] = (unsigned long)sysmap_data;
-		rec->data[1] = sysmap_len;
+		rec->data[0] = (unsigned long)sysmap.addr;
+		rec->data[1] = (unsigned long)sysmap.size;
 	}
-#endif
 
 	rec = bi_rec_alloc(rec, 1);
 	rec->tag = BI_LAST;
diff -Nru a/arch/ppc64/boot/ppc32-types.h b/arch/ppc64/boot/ppc32-types.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc64/boot/ppc32-types.h	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,30 @@
+#ifndef _PPC64_TYPES_H
+#define _PPC64_TYPES_H
+
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+typedef __signed__ long long __s64;
+typedef unsigned long long __u64;
+
+typedef signed char s8;
+typedef unsigned char u8;
+
+typedef signed short s16;
+typedef unsigned short u16;
+
+typedef signed int s32;
+typedef unsigned int u32;
+
+typedef signed long long s64;
+typedef unsigned long long u64;
+
+#define BITS_PER_LONG 32
+
+#endif /* _PPC64_TYPES_H */
diff -Nru a/arch/ppc64/boot/prom.c b/arch/ppc64/boot/prom.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc64/boot/prom.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,636 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <stdarg.h>
+#include <linux/types.h>
+#include <linux/string.h>
+#include <linux/ctype.h>
+
+#include <asm/div64.h>
+
+int (*prom)(void *);
+
+void *chosen_handle;
+void *stdin;
+void *stdout;
+void *stderr;
+
+void exit(void);
+void *finddevice(const char *name);
+int getprop(void *phandle, const char *name, void *buf, int buflen);
+void chrpboot(int a1, int a2, void *prom);	/* in main.c */
+
+void printk(char *fmt, ...);
+
+int
+write(void *handle, void *ptr, int nb)
+{
+	struct prom_args {
+		char *service;
+		int nargs;
+		int nret;
+		void *ihandle;
+		void *addr;
+		int len;
+		int actual;
+	} args;
+
+	args.service = "write";
+	args.nargs = 3;
+	args.nret = 1;
+	args.ihandle = handle;
+	args.addr = ptr;
+	args.len = nb;
+	args.actual = -1;
+	(*prom)(&args);
+	return args.actual;
+}
+
+int
+read(void *handle, void *ptr, int nb)
+{
+	struct prom_args {
+		char *service;
+		int nargs;
+		int nret;
+		void *ihandle;
+		void *addr;
+		int len;
+		int actual;
+	} args;
+
+	args.service = "read";
+	args.nargs = 3;
+	args.nret = 1;
+	args.ihandle = handle;
+	args.addr = ptr;
+	args.len = nb;
+	args.actual = -1;
+	(*prom)(&args);
+	return args.actual;
+}
+
+void
+exit()
+{
+	struct prom_args {
+		char *service;
+	} args;
+
+	for (;;) {
+		args.service = "exit";
+		(*prom)(&args);
+	}
+}
+
+void
+pause(void)
+{
+	struct prom_args {
+		char *service;
+	} args;
+
+	args.service = "enter";
+	(*prom)(&args);
+}
+
+void *
+finddevice(const char *name)
+{
+	struct prom_args {
+		char *service;
+		int nargs;
+		int nret;
+		const char *devspec;
+		void *phandle;
+	} args;
+
+	args.service = "finddevice";
+	args.nargs = 1;
+	args.nret = 1;
+	args.devspec = name;
+	args.phandle = (void *) -1;
+	(*prom)(&args);
+	return args.phandle;
+}
+
+void *
+claim(unsigned long virt, unsigned long size, unsigned long align)
+{
+	struct prom_args {
+		char *service;
+		int nargs;
+		int nret;
+		unsigned int virt;
+		unsigned int size;
+		unsigned int align;
+		void *ret;
+	} args;
+
+	args.service = "claim";
+	args.nargs = 3;
+	args.nret = 1;
+	args.virt = virt;
+	args.size = size;
+	args.align = align;
+	(*prom)(&args);
+	return args.ret;
+}
+
+int
+getprop(void *phandle, const char *name, void *buf, int buflen)
+{
+	struct prom_args {
+		char *service;
+		int nargs;
+		int nret;
+		void *phandle;
+		const char *name;
+		void *buf;
+		int buflen;
+		int size;
+	} args;
+
+	args.service = "getprop";
+	args.nargs = 4;
+	args.nret = 1;
+	args.phandle = phandle;
+	args.name = name;
+	args.buf = buf;
+	args.buflen = buflen;
+	args.size = -1;
+	(*prom)(&args);
+	return args.size;
+}
+
+int
+putc(int c, void *f)
+{
+	char ch = c;
+
+	if (c == '\n')
+		putc('\r', f);
+	return write(f, &ch, 1) == 1? c: -1;
+}
+
+int
+putchar(int c)
+{
+	return putc(c, stdout);
+}
+
+int
+fputs(char *str, void *f)
+{
+	int n = strlen(str);
+
+	return write(f, str, n) == n? 0: -1;
+}
+
+int
+readchar(void)
+{
+	char ch;
+
+	for (;;) {
+		switch (read(stdin, &ch, 1)) {
+		case 1:
+			return ch;
+		case -1:
+			printk("read(stdin) returned -1\r\n");
+			return -1;
+		}
+	}
+}
+
+static char line[256];
+static char *lineptr;
+static int lineleft;
+
+int
+getchar(void)
+{
+	int c;
+
+	if (lineleft == 0) {
+		lineptr = line;
+		for (;;) {
+			c = readchar();
+			if (c == -1 || c == 4)
+				break;
+			if (c == '\r' || c == '\n') {
+				*lineptr++ = '\n';
+				putchar('\n');
+				break;
+			}
+			switch (c) {
+			case 0177:
+			case '\b':
+				if (lineptr > line) {
+					putchar('\b');
+					putchar(' ');
+					putchar('\b');
+					--lineptr;
+				}
+				break;
+			case 'U' & 0x1F:
+				while (lineptr > line) {
+					putchar('\b');
+					putchar(' ');
+					putchar('\b');
+					--lineptr;
+				}
+				break;
+			default:
+				if (lineptr >= &line[sizeof(line) - 1])
+					putchar('\a');
+				else {
+					putchar(c);
+					*lineptr++ = c;
+				}
+			}
+		}
+		lineleft = lineptr - line;
+		lineptr = line;
+	}
+	if (lineleft == 0)
+		return -1;
+	--lineleft;
+	return *lineptr++;
+}
+
+
+
+/* String functions lifted from lib/vsprintf.c and lib/ctype.c */
+unsigned char _ctype[] = {
+_C,_C,_C,_C,_C,_C,_C,_C,			/* 0-7 */
+_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,		/* 8-15 */
+_C,_C,_C,_C,_C,_C,_C,_C,			/* 16-23 */
+_C,_C,_C,_C,_C,_C,_C,_C,			/* 24-31 */
+_S|_SP,_P,_P,_P,_P,_P,_P,_P,			/* 32-39 */
+_P,_P,_P,_P,_P,_P,_P,_P,			/* 40-47 */
+_D,_D,_D,_D,_D,_D,_D,_D,			/* 48-55 */
+_D,_D,_P,_P,_P,_P,_P,_P,			/* 56-63 */
+_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,	/* 64-71 */
+_U,_U,_U,_U,_U,_U,_U,_U,			/* 72-79 */
+_U,_U,_U,_U,_U,_U,_U,_U,			/* 80-87 */
+_U,_U,_U,_P,_P,_P,_P,_P,			/* 88-95 */
+_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,	/* 96-103 */
+_L,_L,_L,_L,_L,_L,_L,_L,			/* 104-111 */
+_L,_L,_L,_L,_L,_L,_L,_L,			/* 112-119 */
+_L,_L,_L,_P,_P,_P,_P,_C,			/* 120-127 */
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,		/* 128-143 */
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,		/* 144-159 */
+_S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,   /* 160-175 */
+_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,       /* 176-191 */
+_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,       /* 192-207 */
+_U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */
+_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */
+_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */
+
+size_t strnlen(const char * s, size_t count)
+{
+	const char *sc;
+
+	for (sc = s; count-- && *sc != '\0'; ++sc)
+		/* nothing */;
+	return sc - s;
+}
+
+unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
+{
+	unsigned long result = 0,value;
+
+	if (!base) {
+		base = 10;
+		if (*cp == '0') {
+			base = 8;
+			cp++;
+			if ((*cp == 'x') && isxdigit(cp[1])) {
+				cp++;
+				base = 16;
+			}
+		}
+	}
+	while (isxdigit(*cp) &&
+	       (value = isdigit(*cp) ? *cp-'0' : toupper(*cp)-'A'+10) < base) {
+		result = result*base + value;
+		cp++;
+	}
+	if (endp)
+		*endp = (char *)cp;
+	return result;
+}
+
+long simple_strtol(const char *cp,char **endp,unsigned int base)
+{
+	if(*cp=='-')
+		return -simple_strtoul(cp+1,endp,base);
+	return simple_strtoul(cp,endp,base);
+}
+
+static int skip_atoi(const char **s)
+{
+	int i=0;
+
+	while (isdigit(**s))
+		i = i*10 + *((*s)++) - '0';
+	return i;
+}
+
+#define ZEROPAD	1		/* pad with zero */
+#define SIGN	2		/* unsigned/signed long */
+#define PLUS	4		/* show plus */
+#define SPACE	8		/* space if plus */
+#define LEFT	16		/* left justified */
+#define SPECIAL	32		/* 0x */
+#define LARGE	64		/* use 'ABCDEF' instead of 'abcdef' */
+
+static char * number(char * str, long long num, int base, int size, int precision, int type)
+{
+	char c,sign,tmp[66];
+	const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
+	int i;
+
+	if (type & LARGE)
+		digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+	if (type & LEFT)
+		type &= ~ZEROPAD;
+	if (base < 2 || base > 36)
+		return 0;
+	c = (type & ZEROPAD) ? '0' : ' ';
+	sign = 0;
+	if (type & SIGN) {
+		if (num < 0) {
+			sign = '-';
+			num = -num;
+			size--;
+		} else if (type & PLUS) {
+			sign = '+';
+			size--;
+		} else if (type & SPACE) {
+			sign = ' ';
+			size--;
+		}
+	}
+	if (type & SPECIAL) {
+		if (base == 16)
+			size -= 2;
+		else if (base == 8)
+			size--;
+	}
+	i = 0;
+	if (num == 0)
+		tmp[i++]='0';
+	else while (num != 0)
+		tmp[i++] = digits[do_div(num,base)];
+	if (i > precision)
+		precision = i;
+	size -= precision;
+	if (!(type&(ZEROPAD+LEFT)))
+		while(size-->0)
+			*str++ = ' ';
+	if (sign)
+		*str++ = sign;
+	if (type & SPECIAL) {
+		if (base==8)
+			*str++ = '0';
+		else if (base==16) {
+			*str++ = '0';
+			*str++ = digits[33];
+		}
+	}
+	if (!(type & LEFT))
+		while (size-- > 0)
+			*str++ = c;
+	while (i < precision--)
+		*str++ = '0';
+	while (i-- > 0)
+		*str++ = tmp[i];
+	while (size-- > 0)
+		*str++ = ' ';
+	return str;
+}
+
+/* Forward decl. needed for IP address printing stuff... */
+int sprintf(char * buf, const char *fmt, ...);
+
+int vsprintf(char *buf, const char *fmt, va_list args)
+{
+	int len;
+	unsigned long long num;
+	int i, base;
+	char * str;
+	const char *s;
+
+	int flags;		/* flags to number() */
+
+	int field_width;	/* width of output field */
+	int precision;		/* min. # of digits for integers; max
+				   number of chars for from string */
+	int qualifier;		/* 'h', 'l', or 'L' for integer fields */
+	                        /* 'z' support added 23/7/1999 S.H.    */
+				/* 'z' changed to 'Z' --davidm 1/25/99 */
+
+	
+	for (str=buf ; *fmt ; ++fmt) {
+		if (*fmt != '%') {
+			*str++ = *fmt;
+			continue;
+		}
+			
+		/* process flags */
+		flags = 0;
+		repeat:
+			++fmt;		/* this also skips first '%' */
+			switch (*fmt) {
+				case '-': flags |= LEFT; goto repeat;
+				case '+': flags |= PLUS; goto repeat;
+				case ' ': flags |= SPACE; goto repeat;
+				case '#': flags |= SPECIAL; goto repeat;
+				case '0': flags |= ZEROPAD; goto repeat;
+				}
+		
+		/* get field width */
+		field_width = -1;
+		if (isdigit(*fmt))
+			field_width = skip_atoi(&fmt);
+		else if (*fmt == '*') {
+			++fmt;
+			/* it's the next argument */
+			field_width = va_arg(args, int);
+			if (field_width < 0) {
+				field_width = -field_width;
+				flags |= LEFT;
+			}
+		}
+
+		/* get the precision */
+		precision = -1;
+		if (*fmt == '.') {
+			++fmt;	
+			if (isdigit(*fmt))
+				precision = skip_atoi(&fmt);
+			else if (*fmt == '*') {
+				++fmt;
+				/* it's the next argument */
+				precision = va_arg(args, int);
+			}
+			if (precision < 0)
+				precision = 0;
+		}
+
+		/* get the conversion qualifier */
+		qualifier = -1;
+		if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt =='Z') {
+			qualifier = *fmt;
+			++fmt;
+		}
+
+		/* default base */
+		base = 10;
+
+		switch (*fmt) {
+		case 'c':
+			if (!(flags & LEFT))
+				while (--field_width > 0)
+					*str++ = ' ';
+			*str++ = (unsigned char) va_arg(args, int);
+			while (--field_width > 0)
+				*str++ = ' ';
+			continue;
+
+		case 's':
+			s = va_arg(args, char *);
+			if (!s)
+				s = "<NULL>";
+
+			len = strnlen(s, precision);
+
+			if (!(flags & LEFT))
+				while (len < field_width--)
+					*str++ = ' ';
+			for (i = 0; i < len; ++i)
+				*str++ = *s++;
+			while (len < field_width--)
+				*str++ = ' ';
+			continue;
+
+		case 'p':
+			if (field_width == -1) {
+				field_width = 2*sizeof(void *);
+				flags |= ZEROPAD;
+			}
+			str = number(str,
+				(unsigned long) va_arg(args, void *), 16,
+				field_width, precision, flags);
+			continue;
+
+
+		case 'n':
+			if (qualifier == 'l') {
+				long * ip = va_arg(args, long *);
+				*ip = (str - buf);
+			} else if (qualifier == 'Z') {
+				size_t * ip = va_arg(args, size_t *);
+				*ip = (str - buf);
+			} else {
+				int * ip = va_arg(args, int *);
+				*ip = (str - buf);
+			}
+			continue;
+
+		case '%':
+			*str++ = '%';
+			continue;
+
+		/* integer number formats - set up the flags and "break" */
+		case 'o':
+			base = 8;
+			break;
+
+		case 'X':
+			flags |= LARGE;
+		case 'x':
+			base = 16;
+			break;
+
+		case 'd':
+		case 'i':
+			flags |= SIGN;
+		case 'u':
+			break;
+
+		default:
+			*str++ = '%';
+			if (*fmt)
+				*str++ = *fmt;
+			else
+				--fmt;
+			continue;
+		}
+		if (qualifier == 'L')
+			num = va_arg(args, long long);
+		else if (qualifier == 'l') {
+			num = va_arg(args, unsigned long);
+			if (flags & SIGN)
+				num = (signed long) num;
+		} else if (qualifier == 'Z') {
+			num = va_arg(args, size_t);
+		} else if (qualifier == 'h') {
+			num = (unsigned short) va_arg(args, int);
+			if (flags & SIGN)
+				num = (signed short) num;
+		} else {
+			num = va_arg(args, unsigned int);
+			if (flags & SIGN)
+				num = (signed int) num;
+		}
+		str = number(str, num, base, field_width, precision, flags);
+	}
+	*str = '\0';
+	return str-buf;
+}
+
+int sprintf(char * buf, const char *fmt, ...)
+{
+	va_list args;
+	int i;
+
+	va_start(args, fmt);
+	i=vsprintf(buf,fmt,args);
+	va_end(args);
+	return i;
+}
+
+static char sprint_buf[1024];
+
+void
+printk(char *fmt, ...)
+{
+	va_list args;
+	int n;
+
+	va_start(args, fmt);
+	n = vsprintf(sprint_buf, fmt, args);
+	va_end(args);
+	write(stdout, sprint_buf, n);
+}
+
+int
+printf(char *fmt, ...)
+{
+	va_list args;
+	int n;
+
+	va_start(args, fmt);
+	n = vsprintf(sprint_buf, fmt, args);
+	va_end(args);
+	write(stdout, sprint_buf, n);
+	return n;
+}
diff -Nru a/arch/ppc64/boot/string.S b/arch/ppc64/boot/string.S
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc64/boot/string.S	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * NOTE: this code runs in 32 bit mode and is packaged as ELF32.
+ */
+
+#include <asm/ppc_asm.h>
+
+	.text
+	.globl	strcpy
+strcpy:
+	addi	r5,r3,-1
+	addi	r4,r4,-1
+1:	lbzu	r0,1(r4)
+	cmpwi	0,r0,0
+	stbu	r0,1(r5)
+	bne	1b
+	blr
+
+	.globl	strncpy
+strncpy:
+	cmpwi	0,r5,0
+	beqlr
+	mtctr	r5
+	addi	r6,r3,-1
+	addi	r4,r4,-1
+1:	lbzu	r0,1(r4)
+	cmpwi	0,r0,0
+	stbu	r0,1(r6)
+	bdnzf	2,1b		/* dec ctr, branch if ctr != 0 && !cr0.eq */
+	blr
+
+	.globl	strcat
+strcat:
+	addi	r5,r3,-1
+	addi	r4,r4,-1
+1:	lbzu	r0,1(r5)
+	cmpwi	0,r0,0
+	bne	1b
+	addi	r5,r5,-1
+1:	lbzu	r0,1(r4)
+	cmpwi	0,r0,0
+	stbu	r0,1(r5)
+	bne	1b
+	blr
+
+	.globl	strcmp
+strcmp:
+	addi	r5,r3,-1
+	addi	r4,r4,-1
+1:	lbzu	r3,1(r5)
+	cmpwi	1,r3,0
+	lbzu	r0,1(r4)
+	subf.	r3,r0,r3
+	beqlr	1
+	beq	1b
+	blr
+
+	.globl	strlen
+strlen:
+	addi	r4,r3,-1
+1:	lbzu	r0,1(r4)
+	cmpwi	0,r0,0
+	bne	1b
+	subf	r3,r3,r4
+	blr
+
+	.globl	memset
+memset:
+	rlwimi	r4,r4,8,16,23
+	rlwimi	r4,r4,16,0,15
+	addi	r6,r3,-4
+	cmplwi	0,r5,4
+	blt	7f
+	stwu	r4,4(r6)
+	beqlr
+	andi.	r0,r6,3
+	add	r5,r0,r5
+	subf	r6,r0,r6
+	rlwinm	r0,r5,32-2,2,31
+	mtctr	r0
+	bdz	6f
+1:	stwu	r4,4(r6)
+	bdnz	1b
+6:	andi.	r5,r5,3
+7:	cmpwi	0,r5,0
+	beqlr
+	mtctr	r5
+	addi	r6,r6,3
+8:	stbu	r4,1(r6)
+	bdnz	8b
+	blr
+
+	.globl	bcopy
+bcopy:
+	mr	r6,r3
+	mr	r3,r4
+	mr	r4,r6
+	b	memcpy
+
+	.globl	memmove
+memmove:
+	cmplw	0,r3,r4
+	bgt	backwards_memcpy
+	/* fall through */
+
+	.globl	memcpy
+memcpy:
+	rlwinm.	r7,r5,32-3,3,31		/* r0 = r5 >> 3 */
+	addi	r6,r3,-4
+	addi	r4,r4,-4
+	beq	2f			/* if less than 8 bytes to do */
+	andi.	r0,r6,3			/* get dest word aligned */
+	mtctr	r7
+	bne	5f
+1:	lwz	r7,4(r4)
+	lwzu	r8,8(r4)
+	stw	r7,4(r6)
+	stwu	r8,8(r6)
+	bdnz	1b
+	andi.	r5,r5,7
+2:	cmplwi	0,r5,4
+	blt	3f
+	lwzu	r0,4(r4)
+	addi	r5,r5,-4
+	stwu	r0,4(r6)
+3:	cmpwi	0,r5,0
+	beqlr
+	mtctr	r5
+	addi	r4,r4,3
+	addi	r6,r6,3
+4:	lbzu	r0,1(r4)
+	stbu	r0,1(r6)
+	bdnz	4b
+	blr
+5:	subfic	r0,r0,4
+	mtctr	r0
+6:	lbz	r7,4(r4)
+	addi	r4,r4,1
+	stb	r7,4(r6)
+	addi	r6,r6,1
+	bdnz	6b
+	subf	r5,r0,r5
+	rlwinm.	r7,r5,32-3,3,31
+	beq	2b
+	mtctr	r7
+	b	1b
+
+	.globl	backwards_memcpy
+backwards_memcpy:
+	rlwinm.	r7,r5,32-3,3,31		/* r0 = r5 >> 3 */
+	add	r6,r3,r5
+	add	r4,r4,r5
+	beq	2f
+	andi.	r0,r6,3
+	mtctr	r7
+	bne	5f
+1:	lwz	r7,-4(r4)
+	lwzu	r8,-8(r4)
+	stw	r7,-4(r6)
+	stwu	r8,-8(r6)
+	bdnz	1b
+	andi.	r5,r5,7
+2:	cmplwi	0,r5,4
+	blt	3f
+	lwzu	r0,-4(r4)
+	subi	r5,r5,4
+	stwu	r0,-4(r6)
+3:	cmpwi	0,r5,0
+	beqlr
+	mtctr	r5
+4:	lbzu	r0,-1(r4)
+	stbu	r0,-1(r6)
+	bdnz	4b
+	blr
+5:	mtctr	r0
+6:	lbzu	r7,-1(r4)
+	stbu	r7,-1(r6)
+	bdnz	6b
+	subf	r5,r0,r5
+	rlwinm.	r7,r5,32-3,3,31
+	beq	2b
+	mtctr	r7
+	b	1b
+
+	.globl	memcmp
+memcmp:
+	cmpwi	0,r5,0
+	blelr
+	mtctr	r5
+	addi	r6,r3,-1
+	addi	r4,r4,-1
+1:	lbzu	r3,1(r6)
+	lbzu	r0,1(r4)
+	subf.	r3,r0,r3
+	bdnzt	2,1b
+	blr
+
+
+/*
+ * Flush the dcache and invalidate the icache for a range of addresses.
+ *
+ * flush_cache(addr, len)
+ */
+	.global	flush_cache
+flush_cache:
+	addi	4,4,0x1f	/* len = (len + 0x1f) / 0x20 */
+	rlwinm.	4,4,27,5,31
+	mtctr	4
+	beqlr
+1:	dcbf	0,3
+	icbi	0,3
+	addi	3,3,0x20
+	bdnz	1b
+	sync
+	isync
+	blr
+
diff -Nru a/arch/ppc64/boot/zImage.lds b/arch/ppc64/boot/zImage.lds
--- a/arch/ppc64/boot/zImage.lds	Sun Feb 23 22:25:21 2003
+++ b/arch/ppc64/boot/zImage.lds	Sun Feb 23 22:25:21 2003
@@ -58,6 +58,27 @@
     *(.dynamic)
     CONSTRUCTORS
   }
+
+  . = ALIGN(4096);
+  _vmlinux_start =  .;
+  .kernel:vmlinux : { *(.kernel:vmlinux) }
+  _vmlinux_end =  .;
+
+  . = ALIGN(4096);
+  _dotconfig_start =  .;
+  .kernel:.config : { *(.kernel:.config) }
+  _dotconfig_end =  .;
+
+  . = ALIGN(4096);
+  _sysmap_start =  .;
+  .kernel:System.map : { *(.kernel:System.map) }
+  _sysmap_end =  .;
+
+  . = ALIGN(4096);
+  _initrd_start =  .;
+  .kernel:initrd : { *(.kernel:initrd) }
+  _initrd_end =  .;
+
   . = ALIGN(4096);
   _edata  =  .;
   PROVIDE (edata = .);
diff -Nru a/arch/ppc64/defconfig b/arch/ppc64/defconfig
--- a/arch/ppc64/defconfig	Sun Feb 23 22:25:22 2003
+++ b/arch/ppc64/defconfig	Sun Feb 23 22:25:22 2003
@@ -46,6 +46,7 @@
 # CONFIG_HMT is not set
 # CONFIG_DISCONTIGMEM is not set
 # CONFIG_RTAS_FLASH is not set
+CONFIG_SCANLOG=y
 CONFIG_PPC_RTAS=y
 
 #
@@ -54,7 +55,6 @@
 CONFIG_PCI=y
 CONFIG_KCORE_ELF=y
 CONFIG_BINFMT_ELF=y
-CONFIG_BINFMT_ELF32=y
 # CONFIG_BINFMT_MISC is not set
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
@@ -137,7 +137,6 @@
 # CONFIG_SCSI_CPQFCTS is not set
 # CONFIG_SCSI_DMX3191D is not set
 # CONFIG_SCSI_EATA is not set
-# CONFIG_SCSI_EATA_DMA is not set
 # CONFIG_SCSI_EATA_PIO is not set
 # CONFIG_SCSI_FUTURE_DOMAIN is not set
 # CONFIG_SCSI_GDTH is not set
@@ -267,6 +266,7 @@
 # CONFIG_SUNGEM is not set
 CONFIG_NET_VENDOR_3COM=y
 CONFIG_VORTEX=y
+# CONFIG_TYPHOON is not set
 
 #
 # Tulip family network device support
diff -Nru a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
--- a/arch/ppc64/kernel/Makefile	Sun Feb 23 22:25:26 2003
+++ b/arch/ppc64/kernel/Makefile	Sun Feb 23 22:25:26 2003
@@ -27,7 +27,6 @@
 
 obj-$(CONFIG_RTAS_FLASH)	+= rtas_flash.o
 obj-$(CONFIG_SMP)		+= smp.o
-obj-$(CONFIG_PROFILING)		+= profile.o
 obj-$(CONFIG_MODULES)		+= module.o ppc_ksyms.o
 obj-$(CONFIG_PPC_RTAS)		+= rtas-proc.o
 obj-$(CONFIG_SCANLOG)		+= scanlog.o
diff -Nru a/arch/ppc64/kernel/align.c b/arch/ppc64/kernel/align.c
--- a/arch/ppc64/kernel/align.c	Sun Feb 23 22:25:27 2003
+++ b/arch/ppc64/kernel/align.c	Sun Feb 23 22:25:27 2003
@@ -180,7 +180,7 @@
 
 #define SWAP(a, b)	(t = (a), (a) = (b), (b) = t)
 
-unsigned static inline make_dsisr( unsigned instr )
+static inline unsigned make_dsisr(unsigned instr)
 {
 	unsigned dsisr;
 	
diff -Nru a/arch/ppc64/kernel/entry.S b/arch/ppc64/kernel/entry.S
--- a/arch/ppc64/kernel/entry.S	Sun Feb 23 22:25:21 2003
+++ b/arch/ppc64/kernel/entry.S	Sun Feb 23 22:25:21 2003
@@ -22,7 +22,7 @@
 
 #include <linux/config.h>
 #include <linux/errno.h>
-#include <linux/sys.h>
+#include <asm/unistd.h>
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
@@ -301,6 +301,8 @@
 	REST_8GPRS(14, r1)
 	REST_10GPRS(22, r1)
 
+	/* convert old thread to its task_struct for return value */
+	addi	r3,r3,-THREAD
 	ld	r7,_NIP(r1)	/* Return to _switch caller in new task */
 	mtlr	r7
 	addi	r1,r1,SWITCH_FRAME_SIZE
@@ -391,6 +393,11 @@
 	stb	r0,PACAPROCENABLED(r13)
 #endif
 
+	mfmsr	r0
+	li	r2, MSR_RI
+	andc	r0,r0,r2
+	mtmsrd	r0
+
 	ld	r0,_MSR(r1)
 	mtspr	SRR1,r0
 
@@ -487,8 +494,9 @@
 	
         li      r9,1
         rldicr  r9,r9,MSR_SF_LG,(63-MSR_SF_LG)
-	ori	r9,r9,MSR_IR|MSR_DR|MSR_FE0|MSR_FE1|MSR_FP|MSR_RI
+	ori	r9,r9,MSR_IR|MSR_DR|MSR_FE0|MSR_FE1|MSR_FP
 	andc	r6,r0,r9
+	ori	r6,r6,MSR_RI
 	sync				/* disable interrupts so SRR0/1 */
 	mtmsrd	r0			/* don't get trashed */
 
diff -Nru a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
--- a/arch/ppc64/kernel/head.S	Sun Feb 23 22:25:24 2003
+++ b/arch/ppc64/kernel/head.S	Sun Feb 23 22:25:24 2003
@@ -189,12 +189,20 @@
 	std	r22,EX_SRR0(r21);	/* Save SRR0 in exc. frame    */ \
 	mfspr   r23,SRR1;               /* machine state at interrupt */ \
 	std	r23,EX_SRR1(r21);	/* Save SRR1 in exc. frame    */ \
+                                                                         \
+	mfspr   r23,DAR;                /* Save DAR in exc. frame      */ \
+	std	r23,EX_DAR(r21);	                                  \
+	mfspr	r23,DSISR;		/* Save DSISR in exc. frame    */ \
+	stw	r23,EX_DSISR(r21);	                                  \
+	mfspr	r23,SPRG2;		/* Save r20 in exc. frame      */ \
+	std	r23,EX_R20(r21);	                                  \
+                                                                         \
 	clrrdi  r22,r20,60;             /* Get 0xc part of the vaddr  */ \
 	ori	r22,r22,(label)@l;      /* add in the vaddr offset    */ \
 		                        /*   assumes *_common < 16b   */ \
 	mfmsr   r23;                                                     \
 	rotldi  r23,r23,4;                                               \
-	ori     r23,r23,0x30B;          /* Set IR, DR, SF, ISF, HV    */ \
+	ori     r23,r23,0x32B;          /* Set IR, DR, RI, SF, ISF, HV*/ \
 	rotldi  r23,r23,60;             /* for generic handlers       */ \
 	mtspr   SRR0,r22;                                                \
 	mtspr   SRR1,r23;                                                \
@@ -231,16 +239,10 @@
  * frame on entry, r23 contains the saved CR, and relocation is on.
  */
 #define EXCEPTION_PROLOG_COMMON                                           \
-	mfspr	r22,SPRG2;		/* Save r20 in exc. frame      */ \
-	std	r22,EX_R20(r21);	                                  \
 	mfspr	r22,SPRG1;		/* Save r21 in exc. frame      */ \
 	std	r22,EX_R21(r21);	                                  \
-	mfspr   r22,DAR;                /* Save DAR in exc. frame      */ \
-	std	r22,EX_DAR(r21);	                                  \
 	std     r21,PACAEXCSP(r20);     /* update exception stack ptr  */ \
 		                        /*   iff no protection flt     */ \
-	mfspr	r22,DSISR;		/* Save DSISR in exc. frame    */ \
-	stw	r22,EX_DSISR(r21);	                                  \
 	ld	r22,EX_SRR1(r21);	/* Get SRR1 from exc. frame    */ \
 	andi.   r22,r22,MSR_PR;         /* Set CR for later branch     */ \
 	mr      r22,r1;                 /* Save r1                     */ \
@@ -337,8 +339,8 @@
  * Start of pSeries system interrupt routines
  */
 	. = 0x100
-	.globl __start_interupts
-__start_interupts:
+	.globl __start_interrupts
+__start_interrupts:
 
 	STD_EXCEPTION_PSERIES( 0x100, SystemReset )
 	STD_EXCEPTION_PSERIES( 0x200, MachineCheck )
@@ -367,7 +369,7 @@
 	. = 0x4000
 	.globl __end_interrupts
 	.globl __start_naca
-__end_interupts:
+__end_interrupts:
 __start_naca:
 #ifdef CONFIG_PPC_ISERIES
 	.llong itVpdAreas
@@ -556,6 +558,12 @@
 	REST_GPR(0, r1)
 	REST_8GPRS(2, r1)
 	REST_4GPRS(10, r1)
+
+	mfmsr	r20
+	li	r21, MSR_RI
+	andc	r20,r20,r21
+	mtmsrd	r20
+
 	mtspr   SRR1,r23
 	mtspr   SRR0,r22
 	REST_4GPRS(20, r1)
@@ -977,6 +985,12 @@
 	lwz	r23,EX_CCR(r21)		/* get saved CR */
 	/* note that this is almost identical to maskable_exception_exit */
 	mtcr    r23                     /* restore CR */
+
+	mfmsr	r22
+	li	r23, MSR_RI
+	andc	r22,r22,r23
+	mtmsrd	r22
+
 	ld	r22,EX_SRR0(r21)	/* Get SRR0 from exc. frame */
 	ld	r23,EX_SRR1(r21)	/* Get SRR1 from exc. frame */
 	mtspr	SRR0,r22
@@ -1076,6 +1090,12 @@
 	lwz	r23,EX_CCR(r21)		/* get saved CR */
 	/* note that this is almost identical to maskable_exception_exit */
 	mtcr    r23                     /* restore CR */
+
+	mfmsr	r22
+	li	r23, MSR_RI
+	andc	r22,r22,r23
+	mtmsrd	r22
+
 	ld	r22,EX_SRR0(r21)	/* Get SRR0 from exc. frame */
 	ld	r23,EX_SRR1(r21)	/* Get SRR1 from exc. frame */
 	mtspr	SRR0,r22
@@ -1189,7 +1209,6 @@
  * At entry, r3 = this processor's number (in Linux terms, not hardware).
  */
 _GLOBAL(pseries_secondary_smp_init)
-
 	/* turn on 64-bit mode */
 	bl	.enable_64b_mode
 	isync
@@ -1543,15 +1562,23 @@
 	sc				/* HvCall_setASR */
 #else
 	/* set the ASR */
-	addi  r3,0,0x4000     /* r3 = ptr to naca */
-	lhz   r3,PLATFORM(r3) /* r3 = platform flags */
-	cmpldi r3,PLATFORM_PSERIES_LPAR
-	bne   98f
-	li	r3,H_SET_ASR  /* hcall = H_SET_ASR */
-	HSC     			    /* Invoking hcall */
-	b     99f
-98:             /* This is not a hypervisor machine */
-	mtasr	r4			/* set the stab location            */
+	addi	r3,0,0x4000     /* r3 = ptr to naca */
+	lhz   	r3,PLATFORM(r3) /* r3 = platform flags */
+	cmpldi 	r3,PLATFORM_PSERIES_LPAR
+	bne   	98f
+	mfspr	r3,PVR
+	srwi	r3,r3,16
+	cmpwi	r3,0x37         /* SStar  */
+	beq	97f
+	cmpwi	r3,0x36         /* IStar  */
+	beq	97f
+	cmpwi	r3,0x34         /* Pulsar */
+	bne	98f
+97:	li	r3,H_SET_ASR    /* hcall = H_SET_ASR */
+	HSC     		/* Invoking hcall */
+	b	99f
+98:                             /* !(rpa hypervisor) || !(star)  */
+	mtasr	r4	        /* set the stab location         */
 99:
 #endif
 	li	r7,0
@@ -1689,15 +1716,23 @@
 	ori	r4,r3,1			/* turn on valid bit                */
 	
 	/* set the ASR */
-	addi  r3,0,0x4000     /* r3 = ptr to naca */
-	lhz   r3,PLATFORM(r3) /* r3 = platform flags */
-	cmpldi r3,PLATFORM_PSERIES_LPAR
-	bne   98f
-	li	r3,H_SET_ASR  /* hcall = H_SET_ASR */
-	HSC     			    /* Invoking hcall */
-	b     99f
-98:                 /* This is not a hypervisor machine */
-	mtasr	r4			/* set the stab location            */
+	addi	r3,0,0x4000     /* r3 = ptr to naca */
+	lhz   	r3,PLATFORM(r3) /* r3 = platform flags */
+	cmpldi 	r3,PLATFORM_PSERIES_LPAR
+	bne   	98f
+	mfspr	r3,PVR
+	srwi	r3,r3,16
+	cmpwi	r3,0x37         /* SStar */
+	beq	97f
+	cmpwi	r3,0x36         /* IStar  */
+	beq	97f
+	cmpwi	r3,0x34         /* Pulsar */
+	bne	98f
+97:	li	r3,H_SET_ASR    /* hcall = H_SET_ASR */
+	HSC     	        /* Invoking hcall */
+	b     	99f
+98:                             /* !(rpa hypervisor) || !(star) */
+	mtasr	r4	        /* set the stab location         */
 99:
 	mfspr	r6,SPRG3
 	ld	r3,PACASTABREAL(r6)     /* restore r3 for stab_initialize */
diff -Nru a/arch/ppc64/kernel/htab.c b/arch/ppc64/kernel/htab.c
--- a/arch/ppc64/kernel/htab.c	Sun Feb 23 22:25:24 2003
+++ b/arch/ppc64/kernel/htab.c	Sun Feb 23 22:25:24 2003
@@ -46,6 +46,7 @@
 #include <asm/io.h>
 #include <asm/eeh.h>
 #include <asm/tlb.h>
+#include <asm/cacheflush.h>
 
 /*
  * Note:  pte   --> Linux PTE
@@ -347,6 +348,9 @@
 				goto repeat;
                         }
 		}
+
+		if (unlikely(slot == -2))
+			panic("hash_page: pte_insert failed\n");
 
 		pte_val(new_pte) |= (slot<<12) & _PAGE_GROUP_IX;
 
diff -Nru a/arch/ppc64/kernel/ioctl32.c b/arch/ppc64/kernel/ioctl32.c
--- a/arch/ppc64/kernel/ioctl32.c	Sun Feb 23 22:25:27 2003
+++ b/arch/ppc64/kernel/ioctl32.c	Sun Feb 23 22:25:27 2003
@@ -99,6 +99,7 @@
 
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci.h>
+#include <net/bluetooth/rfcomm.h>
 
 #include <linux/usb.h>
 #include <linux/usbdevice_fs.h>
@@ -3633,6 +3634,15 @@
 	return sys_ioctl(fd, BLKGETSIZE64, arg);
 }
 
+/* Bluetooth ioctls */
+#define HCIUARTSETPROTO	_IOW('U', 200, int)
+#define HCIUARTGETPROTO	_IOR('U', 201, int)
+
+#define BNEPCONNADD     _IOW('B', 200, int)
+#define BNEPCONNDEL     _IOW('B', 201, int)
+#define BNEPGETCONNLIST	_IOR('B', 210, int)
+#define BNEPGETCONNINFO	_IOR('B', 211, int)
+
 struct ioctl_trans {
 	unsigned long cmd;
 	unsigned long handler;
@@ -4241,6 +4251,17 @@
 COMPATIBLE_IOCTL(HCISETACLMTU),
 COMPATIBLE_IOCTL(HCISETSCOMTU),
 COMPATIBLE_IOCTL(HCIINQUIRY),
+COMPATIBLE_IOCTL(HCIUARTSETPROTO),
+COMPATIBLE_IOCTL(HCIUARTGETPROTO),
+COMPATIBLE_IOCTL(RFCOMMCREATEDEV),
+COMPATIBLE_IOCTL(RFCOMMRELEASEDEV),
+COMPATIBLE_IOCTL(RFCOMMGETDEVLIST),
+COMPATIBLE_IOCTL(RFCOMMGETDEVINFO),
+COMPATIBLE_IOCTL(RFCOMMSTEALDLC),
+COMPATIBLE_IOCTL(BNEPCONNADD),
+COMPATIBLE_IOCTL(BNEPCONNDEL),
+COMPATIBLE_IOCTL(BNEPGETCONNLIST),
+COMPATIBLE_IOCTL(BNEPGETCONNINFO),
 COMPATIBLE_IOCTL(PCIIOC_CONTROLLER),
 COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO),
 COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM),
diff -Nru a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
--- a/arch/ppc64/kernel/misc.S	Sun Feb 23 22:25:26 2003
+++ b/arch/ppc64/kernel/misc.S	Sun Feb 23 22:25:26 2003
@@ -743,10 +743,6 @@
 	.llong .sys_epoll_wait
 	.llong .sys_remap_file_pages
 
-	.rept NR_syscalls-239
-		.llong .sys_ni_syscall
-	.endr
-
 	.balign 8
 _GLOBAL(sys_call_table)
 	.llong .sys_restart_syscall	/* 0 */
@@ -989,7 +985,3 @@
 	.llong .sys_epoll_ctl
 	.llong .sys_epoll_wait
 	.llong .sys_remap_file_pages
-
-	.rept NR_syscalls-239
-		.llong .sys_ni_syscall
-	.endr
diff -Nru a/arch/ppc64/kernel/open_pic.c b/arch/ppc64/kernel/open_pic.c
--- a/arch/ppc64/kernel/open_pic.c	Sun Feb 23 22:25:25 2003
+++ b/arch/ppc64/kernel/open_pic.c	Sun Feb 23 22:25:25 2003
@@ -555,14 +555,15 @@
 	if (OpenPIC == NULL)
 		return;
 
-	request_irq(openpic_vec_ipi,
-		    openpic_ipi_action, 0, "IPI0 (call function)", 0);
-	request_irq(openpic_vec_ipi+1,
-		    openpic_ipi_action, 0, "IPI1 (reschedule)", 0);
-	request_irq(openpic_vec_ipi+2,
-		    openpic_ipi_action, 0, "IPI2 (invalidate tlb)", 0);
-	request_irq(openpic_vec_ipi+3,
-		    openpic_ipi_action, 0, "IPI3 (xmon break)", 0);
+	/* IPIs are marked SA_INTERRUPT as they must run with irqs disabled */
+	request_irq(openpic_vec_ipi, openpic_ipi_action, SA_INTERRUPT,
+		    "IPI0 (call function)", 0);
+	request_irq(openpic_vec_ipi+1, openpic_ipi_action, SA_INTERRUPT,
+		   "IPI1 (reschedule)", 0);
+	request_irq(openpic_vec_ipi+2, openpic_ipi_action, SA_INTERRUPT,
+		   "IPI2 (invalidate tlb)", 0);
+	request_irq(openpic_vec_ipi+3, openpic_ipi_action, SA_INTERRUPT,
+		   "IPI3 (xmon break)", 0);
 
 	for ( i = 0; i < OPENPIC_NUM_IPI ; i++ )
 		openpic_enable_ipi(openpic_vec_ipi+i);
@@ -754,17 +755,12 @@
 #ifdef CONFIG_SMP
 static void openpic_end_ipi(unsigned int irq_nr)
 {
-	/* IPIs are marked IRQ_PER_CPU. This has the side effect of
+	/*
+	 * IPIs are marked IRQ_PER_CPU. This has the side effect of
 	 * preventing the IRQ_PENDING/IRQ_INPROGRESS logic from
 	 * applying to them. We EOI them late to avoid re-entering.
-	 * however, I'm wondering if we could simply let them have the
-	 * SA_INTERRUPT flag and let them execute with all interrupts OFF.
-	 * This would have the side effect of either running cross-CPU
-	 * functions with interrupts off, or we can re-enable them explicitely
-	 * with a local_irq_enable() in smp_call_function_interrupt(), since
-	 * smp_call_function() is protected by a spinlock.
-	 * Or maybe we shouldn't set the IRQ_PER_CPU flag on cross-CPU
-	 * function calls IPI at all but that would make a special case.
+	 * We mark IPI's with SA_INTERRUPT as they must run with
+	 * irqs disabled.
 	 */
 	openpic_eoi();
 }
diff -Nru a/arch/ppc64/kernel/pSeries_lpar.c b/arch/ppc64/kernel/pSeries_lpar.c
--- a/arch/ppc64/kernel/pSeries_lpar.c	Sun Feb 23 22:25:27 2003
+++ b/arch/ppc64/kernel/pSeries_lpar.c	Sun Feb 23 22:25:27 2003
@@ -460,8 +460,13 @@
 	if (lpar_rc == H_PTEG_Full)
 		return -1;
 
+	/*
+	 * Since we try and ioremap PHBs we dont own, the pte insert
+	 * will fail. However we must catch the failure in hash_page
+	 * or we will loop forever, so return -2 in this case.
+	 */
 	if (lpar_rc != H_Success)
-		panic("Bad return code from pte enter rc = %lx\n", lpar_rc);
+		return -2;
 
 	return slot;
 }
diff -Nru a/arch/ppc64/kernel/ppc_ksyms.c b/arch/ppc64/kernel/ppc_ksyms.c
--- a/arch/ppc64/kernel/ppc_ksyms.c	Sun Feb 23 22:25:22 2003
+++ b/arch/ppc64/kernel/ppc_ksyms.c	Sun Feb 23 22:25:22 2003
@@ -232,8 +232,3 @@
 #endif
 
 EXPORT_SYMBOL(tb_ticks_per_usec);
-
-#ifdef CONFIG_PROFILING
-EXPORT_SYMBOL_GPL(register_profile_notifier);
-EXPORT_SYMBOL_GPL(unregister_profile_notifier);
-#endif
diff -Nru a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c
--- a/arch/ppc64/kernel/process.c	Sun Feb 23 22:25:25 2003
+++ b/arch/ppc64/kernel/process.c	Sun Feb 23 22:25:25 2003
@@ -82,11 +82,12 @@
 	return 1;
 }
 
-void
-__switch_to(struct task_struct *prev, struct task_struct *new)
+struct task_struct *__switch_to(struct task_struct *prev,
+				struct task_struct *new)
 {
 	struct thread_struct *new_thread, *old_thread;
 	unsigned long flags;
+	struct task_struct *last;
 
 #ifdef CONFIG_SMP
 	/* avoid complexity of lazy save/restore of fpu
@@ -106,8 +107,9 @@
 	old_thread = &current->thread;
 
 	local_irq_save(flags);
-	_switch(old_thread, new_thread);
+	last = _switch(old_thread, new_thread);
 	local_irq_restore(flags);
+	return last;
 }
 
 static void show_tsk_stack(struct task_struct *p, unsigned long sp);
@@ -237,22 +239,30 @@
 /*
  * Set up a thread for executing a new program
  */
-void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp)
+void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp)
 {
-	/* NIP is *really* a pointer to the function descriptor for
+	unsigned long entry, toc, load_addr = regs->gpr[2];
+
+	/* fdptr is a relocated pointer to the function descriptor for
          * the elf _start routine.  The first entry in the function
          * descriptor is the entry address of _start and the second
          * entry is the TOC value we need to use.
          */
-	unsigned long *entry = (unsigned long *)nip;
-	unsigned long *toc   = entry + 1;
-
 	set_fs(USER_DS);
-	memset(regs->gpr, 0, sizeof(regs->gpr));
-	memset(&regs->ctr, 0, 4 * sizeof(regs->ctr));
-	__get_user(regs->nip, entry);
+	__get_user(entry, (unsigned long *)fdptr);
+	__get_user(toc, (unsigned long *)fdptr+1);
+
+	/* Check whether the e_entry function descriptor entries
+	 * need to be relocated before we can use them.
+	 */
+	if ( load_addr != 0 ) {
+		entry += load_addr;
+		toc   += load_addr;
+	}
+
+	regs->nip = entry;
 	regs->gpr[1] = sp;
-	__get_user(regs->gpr[2], toc);
+	regs->gpr[2] = toc;
 	regs->msr = MSR_USER64;
 	if (last_task_used_math == current)
 		last_task_used_math = 0;
diff -Nru a/arch/ppc64/kernel/profile.c b/arch/ppc64/kernel/profile.c
--- a/arch/ppc64/kernel/profile.c	Sun Feb 23 22:25:24 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,42 +0,0 @@
-/*
- *	linux/arch/i386/kernel/profile.c
- *
- *	(C) 2002 John Levon <levon@movementarian.org>
- *
- */
-
-#include <linux/profile.h>
-#include <linux/spinlock.h>
-#include <linux/notifier.h>
-#include <linux/irq.h>
-#include <asm/hw_irq.h> 
- 
-static struct notifier_block * profile_listeners;
-static rwlock_t profile_lock = RW_LOCK_UNLOCKED;
- 
-int register_profile_notifier(struct notifier_block * nb)
-{
-	int err;
-	write_lock_irq(&profile_lock);
-	err = notifier_chain_register(&profile_listeners, nb);
-	write_unlock_irq(&profile_lock);
-	return err;
-}
-
-
-int unregister_profile_notifier(struct notifier_block * nb)
-{
-	int err;
-	write_lock_irq(&profile_lock);
-	err = notifier_chain_unregister(&profile_listeners, nb);
-	write_unlock_irq(&profile_lock);
-	return err;
-}
-
-
-void ppc64_profile_hook(struct pt_regs * regs)
-{
-	read_lock(&profile_lock);
-	notifier_call_chain(&profile_listeners, 0, regs);
-	read_unlock(&profile_lock);
-}
diff -Nru a/arch/ppc64/kernel/signal32.c b/arch/ppc64/kernel/signal32.c
--- a/arch/ppc64/kernel/signal32.c	Sun Feb 23 22:25:26 2003
+++ b/arch/ppc64/kernel/signal32.c	Sun Feb 23 22:25:26 2003
@@ -29,6 +29,8 @@
 #include <asm/unistd.h>
 #include <asm/cacheflush.h>
 
+#define DEBUG_SIG 0
+
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 /* 
  * These are the flags in the MSR that the user is allowed to change
diff -Nru a/arch/ppc64/kernel/sys32.S b/arch/ppc64/kernel/sys32.S
--- a/arch/ppc64/kernel/sys32.S	Sun Feb 23 22:25:26 2003
+++ b/arch/ppc64/kernel/sys32.S	Sun Feb 23 22:25:26 2003
@@ -1,5 +1,5 @@
 /* 
- * sys32.S: I-cache tricks for 32-bit compatability layer simple
+ * sys32.S: I-cache tricks for 32-bit compatibility layer simple
  *          conversions.
  *
  * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
diff -Nru a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
--- a/arch/ppc64/kernel/sys_ppc32.c	Sun Feb 23 22:25:25 2003
+++ b/arch/ppc64/kernel/sys_ppc32.c	Sun Feb 23 22:25:25 2003
@@ -812,7 +812,7 @@
 	return sys_sysfs((int)option, arg1, arg2);
 }
 
-/* Handle adjtimex compatability. */
+/* Handle adjtimex compatibility. */
 struct timex32 {
 	u32 modes;
 	s32 offset, freq, maxerror, esterror;
diff -Nru a/arch/ppc64/kernel/syscalls.c b/arch/ppc64/kernel/syscalls.c
--- a/arch/ppc64/kernel/syscalls.c	Sun Feb 23 22:25:25 2003
+++ b/arch/ppc64/kernel/syscalls.c	Sun Feb 23 22:25:25 2003
@@ -44,7 +44,6 @@
 #include <asm/time.h>
 
 extern unsigned long wall_jiffies;
-#define USEC_PER_SEC (1000000)
 
 void
 check_bugs(void)
diff -Nru a/arch/ppc64/kernel/time.c b/arch/ppc64/kernel/time.c
--- a/arch/ppc64/kernel/time.c	Sun Feb 23 22:25:26 2003
+++ b/arch/ppc64/kernel/time.c	Sun Feb 23 22:25:26 2003
@@ -77,7 +77,6 @@
 #endif
 
 #define XSEC_PER_SEC (1024*1024)
-#define USEC_PER_SEC (1000000)
 
 unsigned long tb_ticks_per_jiffy;
 unsigned long tb_ticks_per_usec;
@@ -110,11 +109,8 @@
 	unsigned long nip;
 	extern unsigned long prof_cpu_mask;
 	extern char _stext;
-#ifdef CONFIG_PROFILING
-	extern void ppc64_profile_hook(struct pt_regs *);
 
-	ppc64_profile_hook(regs);
-#endif
+	profile_hook(regs);
 
 	if (user_mode(regs))
 		return;
diff -Nru a/arch/ppc64/kernel/xics.c b/arch/ppc64/kernel/xics.c
--- a/arch/ppc64/kernel/xics.c	Sun Feb 23 22:25:24 2003
+++ b/arch/ppc64/kernel/xics.c	Sun Feb 23 22:25:24 2003
@@ -15,6 +15,7 @@
 #include <linux/irq.h>
 #include <linux/smp.h>
 #include <linux/interrupt.h>
+#include <linux/signal.h>
 #include <asm/prom.h>
 #include <asm/io.h>
 #include <asm/pgtable.h>
@@ -423,8 +424,11 @@
 	}
 
 #ifdef CONFIG_SMP
-	real_irq_to_virt_map[XICS_IPI] = virt_irq_to_real_map[XICS_IPI] = XICS_IPI;
-	request_irq(XICS_IPI + XICS_IRQ_OFFSET, xics_ipi_action, 0, "IPI", 0);
+	real_irq_to_virt_map[XICS_IPI] = virt_irq_to_real_map[XICS_IPI] =
+		XICS_IPI;
+	/* IPIs are marked SA_INTERRUPT as they must run with irqs disabled */
+	request_irq(XICS_IPI + XICS_IRQ_OFFSET, xics_ipi_action, SA_INTERRUPT,
+		    "IPI", 0);
 	irq_desc[XICS_IPI+XICS_IRQ_OFFSET].status |= IRQ_PER_CPU;
 #endif
 	ppc64_boot_msg(0x21, "XICS Done");
diff -Nru a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c
--- a/arch/ppc64/mm/init.c	Sun Feb 23 22:25:25 2003
+++ b/arch/ppc64/mm/init.c	Sun Feb 23 22:25:25 2003
@@ -233,6 +233,7 @@
 
 		hpteg = ((hash & htab_data.htab_hash_mask)*HPTES_PER_GROUP);
 
+		/* Panic if a pte grpup is full */
 		if (ppc_md.hpte_insert(hpteg, va, pa >> PAGE_SHIFT, 0,
 				       _PAGE_NO_CACHE|_PAGE_GUARDED|PP_RWXX,
 				       1, 0) == -1) {
diff -Nru a/arch/ppc64/oprofile/timer_int.c b/arch/ppc64/oprofile/timer_int.c
--- a/arch/ppc64/oprofile/timer_int.c	Sun Feb 23 22:25:27 2003
+++ b/arch/ppc64/oprofile/timer_int.c	Sun Feb 23 22:25:27 2003
@@ -13,6 +13,7 @@
 #include <linux/smp.h>
 #include <linux/irq.h>
 #include <linux/oprofile.h>
+#include <linux/profile.h>
 #include <asm/ptrace.h>
  
 static int timer_notify(struct notifier_block * self, unsigned long val, void * data)
diff -Nru a/arch/ppc64/xmon/ansidecl.h b/arch/ppc64/xmon/ansidecl.h
--- a/arch/ppc64/xmon/ansidecl.h	Sun Feb 23 22:25:23 2003
+++ b/arch/ppc64/xmon/ansidecl.h	Sun Feb 23 22:25:23 2003
@@ -1,4 +1,4 @@
-/* ANSI and traditional C compatability macros
+/* ANSI and traditional C compatibility macros
    Copyright 1991, 1992 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
diff -Nru a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
--- a/arch/s390/kernel/entry.S	Sun Feb 23 22:25:22 2003
+++ b/arch/s390/kernel/entry.S	Sun Feb 23 22:25:22 2003
@@ -757,8 +757,8 @@
         la      %r2,SP_PTREGS(%r15) # address of register-save area
         sr      %r3,%r3
         icm     %r3,3,__LC_SUBCHANNEL_NR   # load subchannel nr & extend to int
-        l       %r4,__LC_IO_INT_PARM       # load interuption parm
-	l       %r5,__LC_IO_INT_WORD       # load interuption word
+        l       %r4,__LC_IO_INT_PARM       # load interruption parm
+	l       %r5,__LC_IO_INT_WORD       # load interruption word
         basr    %r14,%r1          # branch to standard irq handler
 
 io_return:
diff -Nru a/arch/s390x/kernel/entry.S b/arch/s390x/kernel/entry.S
--- a/arch/s390x/kernel/entry.S	Sun Feb 23 22:25:22 2003
+++ b/arch/s390x/kernel/entry.S	Sun Feb 23 22:25:22 2003
@@ -781,8 +781,8 @@
         GET_THREAD_INFO                # load pointer to task_struct to R9
         la      %r2,SP_PTREGS(%r15)    # address of register-save area
 	llgh    %r3,__LC_SUBCHANNEL_NR # load subchannel number
-        llgf    %r4,__LC_IO_INT_PARM   # load interuption parm
-        llgf    %r5,__LC_IO_INT_WORD   # load interuption word
+        llgf    %r4,__LC_IO_INT_PARM   # load interruption parm
+        llgf    %r5,__LC_IO_INT_WORD   # load interruption word
 	brasl   %r14,do_IRQ            # call standard irq handler
 
 io_return:
diff -Nru a/arch/s390x/kernel/linux32.c b/arch/s390x/kernel/linux32.c
--- a/arch/s390x/kernel/linux32.c	Sun Feb 23 22:25:25 2003
+++ b/arch/s390x/kernel/linux32.c	Sun Feb 23 22:25:25 2003
@@ -3578,7 +3578,7 @@
 	return ret;
 }
 
-/* Handle adjtimex compatability. */
+/* Handle adjtimex compatibility. */
 
 struct timex32 {
 	u32 modes;
diff -Nru a/arch/sparc/Kconfig b/arch/sparc/Kconfig
--- a/arch/sparc/Kconfig	Sun Feb 23 22:25:21 2003
+++ b/arch/sparc/Kconfig	Sun Feb 23 22:25:21 2003
@@ -136,34 +136,20 @@
 config ISA
 	bool
 	help
-	  Find out whether you have ISA slots on your motherboard.  ISA is the
-	  name of a bus system, i.e. the way the CPU talks to the other stuff
-	  inside your box.  Other bus systems are PCI, EISA, MicroChannel
-	  (MCA) or VESA.  ISA is an older system, now being displaced by PCI;
-	  newer boards don't support it.  If you have ISA, say Y, otherwise N.
+	  ISA is found on Espresso only and is not supported currently.
+	  Say N
 
 config EISA
 	bool
-	---help---
-	  The Extended Industry Standard Architecture (EISA) bus was
-	  developed as an open alternative to the IBM MicroChannel bus.
-
-	  The EISA bus provided some of the features of the IBM MicroChannel
-	  bus while maintaining backward compatibility with cards made for
-	  the older ISA bus.  The EISA bus saw limited use between 1988 and
-	  1995 when it was made obsolete by the PCI bus.
-
-	  Say Y here if you are building a kernel for an EISA-based machine.
-
-	  Otherwise, say N.
+	help
+	  EISA is not supported.
+	  Say N
 
 config MCA
 	bool
 	help
-	  MicroChannel Architecture is found in some IBM PS/2 machines and
-	  laptops.  It is a bus system similar to PCI or ISA. See
-	  <file:Documentation/mca.txt> (and especially the web page given
-	  there) before attempting to build an MCA bus kernel.
+	  EISA is not supported.
+	  Say N
 
 config PCMCIA
 	tristate
@@ -242,8 +228,8 @@
 config SUN4
 	bool "Support for SUN4 machines (disables SUN4[CDM] support)"
 	help
-	  Say Y here if, and only if, your machine is a Sun4. Note that
-	  a kernel compiled with this option will run only on Sun4.
+	  Say Y here if, and only if, your machine is a sun4. Note that
+	  a kernel compiled with this option will run only on sun4.
 	  (And the current version will probably work only on sun4/330.)
 
 if !SUN4
@@ -251,15 +237,9 @@
 config PCI
 	bool "Support for PCI and PS/2 keyboard/mouse"
 	help
-	  Find out whether you have a PCI motherboard. PCI is the name of a
-	  bus system, i.e. the way the CPU talks to the other stuff inside
-	  your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or
-	  VESA. If you have PCI, say Y, otherwise N.
-
-	  The PCI-HOWTO, available from
-	  <http://www.linuxdoc.org/docs.html#howto>, contains valuable
-	  information about which PCI hardware does work under Linux and which
-	  doesn't.
+	  CONFIG_PCI is needed for all JavaStation's (including MrCoffee),
+	  CP-1200, JavaEngine-1, Corona, Red October, and Serengeti SGSC.
+	  All of these platforms are extremely obscure, so say N if unsure.
 
 source "drivers/pci/Kconfig"
 
diff -Nru a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
--- a/arch/sparc/kernel/sparc_ksyms.c	Sun Feb 23 22:25:21 2003
+++ b/arch/sparc/kernel/sparc_ksyms.c	Sun Feb 23 22:25:21 2003
@@ -55,6 +55,8 @@
 #include <asm/a.out.h>
 #include <asm/io-unit.h>
 
+extern spinlock_t rtc_lock;
+
 struct poll {
 	int fd;
 	short events;
@@ -152,6 +154,7 @@
 
 EXPORT_SYMBOL(udelay);
 EXPORT_SYMBOL(ndelay);
+EXPORT_SYMBOL(rtc_lock);
 EXPORT_SYMBOL(mostek_lock);
 EXPORT_SYMBOL(mstk48t02_regs);
 #if CONFIG_SUN_AUXIO
diff -Nru a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
--- a/arch/sparc/kernel/time.c	Sun Feb 23 22:25:24 2003
+++ b/arch/sparc/kernel/time.c	Sun Feb 23 22:25:24 2003
@@ -47,6 +47,7 @@
 
 u64 jiffies_64;
 
+spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
 enum sparc_clock_type sp_clock_typ;
 spinlock_t mostek_lock = SPIN_LOCK_UNLOCKED;
 unsigned long mstk48t02_regs = 0UL;
diff -Nru a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
--- a/arch/sparc64/kernel/Makefile	Sun Feb 23 22:25:22 2003
+++ b/arch/sparc64/kernel/Makefile	Sun Feb 23 22:25:22 2003
@@ -3,6 +3,7 @@
 #
 
 EXTRA_AFLAGS := -ansi
+CFLAGS += -Werror
 
 EXTRA_TARGETS	:= head.o init_task.o
 
@@ -15,7 +16,6 @@
 obj-$(CONFIG_PCI)	 += ebus.o isa.o pci_common.o pci_iommu.o \
 			    pci_psycho.o pci_sabre.o pci_schizo.o
 obj-$(CONFIG_SMP)	 += smp.o trampoline.o
-obj-$(CONFIG_PROFILING)  += profile.o
 obj-$(CONFIG_SPARC32_COMPAT) += sys32.o sys_sparc32.o signal32.o ioctl32.o
 obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o
 obj-$(CONFIG_BINFMT_AOUT32) += binfmt_aout32.o
diff -Nru a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c
--- a/arch/sparc64/kernel/ioctl32.c	Sun Feb 23 22:25:26 2003
+++ b/arch/sparc64/kernel/ioctl32.c	Sun Feb 23 22:25:26 2003
@@ -97,6 +97,7 @@
 
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci.h>
+#include <net/bluetooth/rfcomm.h>
 
 #include <linux/usb.h>
 #include <linux/usbdevice_fs.h>
@@ -4264,6 +4265,15 @@
 	return sys_ioctl(fd, BLKGETSIZE64, arg);
 }
 
+/* Bluetooth ioctls */
+#define HCIUARTSETPROTO	_IOW('U', 200, int)
+#define HCIUARTGETPROTO	_IOR('U', 201, int)
+
+#define BNEPCONNADD     _IOW('B', 200, int)
+#define BNEPCONNDEL     _IOW('B', 201, int)
+#define BNEPGETCONNLIST	_IOR('B', 210, int)
+#define BNEPGETCONNINFO	_IOR('B', 211, int)
+
 struct ioctl_trans {
 	unsigned int cmd;
 	unsigned int handler;
@@ -4277,7 +4287,7 @@
 
 IOCTL_TABLE_START
 /* List here exlicitly which ioctl's are known to have
- * compatable types passed or none at all...
+ * compatible types passed or none at all...
  */
 /* Big T */
 COMPATIBLE_IOCTL(TCGETA)
@@ -4957,6 +4967,17 @@
 COMPATIBLE_IOCTL(HCISETACLMTU)
 COMPATIBLE_IOCTL(HCISETSCOMTU)
 COMPATIBLE_IOCTL(HCIINQUIRY)
+COMPATIBLE_IOCTL(HCIUARTSETPROTO)
+COMPATIBLE_IOCTL(HCIUARTGETPROTO)
+COMPATIBLE_IOCTL(RFCOMMCREATEDEV)
+COMPATIBLE_IOCTL(RFCOMMRELEASEDEV)
+COMPATIBLE_IOCTL(RFCOMMGETDEVLIST)
+COMPATIBLE_IOCTL(RFCOMMGETDEVINFO)
+COMPATIBLE_IOCTL(RFCOMMSTEALDLC)
+COMPATIBLE_IOCTL(BNEPCONNADD)
+COMPATIBLE_IOCTL(BNEPCONNDEL)
+COMPATIBLE_IOCTL(BNEPGETCONNLIST)
+COMPATIBLE_IOCTL(BNEPGETCONNINFO)
 /* Misc. */
 COMPATIBLE_IOCTL(0x41545900)		/* ATYIO_CLKR */
 COMPATIBLE_IOCTL(0x41545901)		/* ATYIO_CLKW */
diff -Nru a/arch/sparc64/kernel/profile.c b/arch/sparc64/kernel/profile.c
--- a/arch/sparc64/kernel/profile.c	Sun Feb 23 22:25:22 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,42 +0,0 @@
-/* arch/sparc64/kernel/profile.c
- *
- * Almost entirely copied from ppc64 which is:
- * (C) 2002 John Levon <levon@movementarian.org>
- */
-
-#include <linux/profile.h>
-#include <linux/spinlock.h>
-#include <linux/notifier.h>
-#include <asm/irq.h>
-
-static struct notifier_block *profile_listeners;
-static rwlock_t profile_lock = RW_LOCK_UNLOCKED;
-
-int register_profile_notifier(struct notifier_block *nb)
-{
-	int err;
-
-	write_lock_irq(&profile_lock);
-	err = notifier_chain_register(&profile_listeners, nb);
-	write_unlock_irq(&profile_lock);
-
-	return err;
-}
-
-int unregister_profile_notifier(struct notifier_block *nb)
-{
-	int err;
-
-	write_lock_irq(&profile_lock);
-	err = notifier_chain_unregister(&profile_listeners, nb);
-	write_unlock_irq(&profile_lock);
-
-	return err;
-}
-
-void sparc64_profile_hook(struct pt_regs *regs)
-{
-	read_lock(&profile_lock);
-	notifier_call_chain(&profile_listeners, 0, regs);
-	read_unlock(&profile_lock);
-}
diff -Nru a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
--- a/arch/sparc64/kernel/signal.c	Sun Feb 23 22:25:24 2003
+++ b/arch/sparc64/kernel/signal.c	Sun Feb 23 22:25:24 2003
@@ -185,7 +185,7 @@
 	err |= __put_user(regs->u_regs[UREG_G4], &((*grp)[MC_G4]));
 	err |= __put_user(regs->u_regs[UREG_G5], &((*grp)[MC_G5]));
 	err |= __put_user(regs->u_regs[UREG_G6], &((*grp)[MC_G6]));
-	err |= __put_user(regs->u_regs[UREG_G6], &((*grp)[MC_G7]));
+	err |= __put_user(regs->u_regs[UREG_G7], &((*grp)[MC_G7]));
 	err |= __put_user(regs->u_regs[UREG_I0], &((*grp)[MC_O0]));
 	err |= __put_user(regs->u_regs[UREG_I1], &((*grp)[MC_O1]));
 	err |= __put_user(regs->u_regs[UREG_I2], &((*grp)[MC_O2]));
@@ -404,8 +404,8 @@
 	err |= copy_from_user(regs->u_regs, sf->regs.u_regs, sizeof(regs->u_regs));
 
 	/* User can only change condition codes in %tstate. */
-	regs->tstate &= ~(TSTATE_ICC);
-	regs->tstate |= (tstate & TSTATE_ICC);
+	regs->tstate &= ~(TSTATE_ICC | TSTATE_XCC);
+	regs->tstate |= (tstate & (TSTATE_ICC | TSTATE_XCC));
 
 	err |= __get_user(fpu_save, &sf->fpu_save);
 	if (fpu_save)
diff -Nru a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
--- a/arch/sparc64/kernel/smp.c	Sun Feb 23 22:25:21 2003
+++ b/arch/sparc64/kernel/smp.c	Sun Feb 23 22:25:21 2003
@@ -209,6 +209,174 @@
 	panic("SMP bolixed\n");
 }
 
+static unsigned long current_tick_offset;
+
+/* This stick register synchronization scheme is taken entirely from
+ * the ia64 port, see arch/ia64/kernel/smpboot.c for details and credit.
+ *
+ * The only change I've made is to rework it so that the master
+ * initiates the synchonization instead of the slave. -DaveM
+ */
+
+#define MASTER	0
+#define SLAVE	(SMP_CACHE_BYTES/sizeof(unsigned long))
+
+#define NUM_ROUNDS	64	/* magic value */
+#define NUM_ITERS	5	/* likewise */
+
+static spinlock_t itc_sync_lock = SPIN_LOCK_UNLOCKED;
+static unsigned long go[SLAVE + 1];
+
+#define DEBUG_STICK_SYNC	0
+
+static inline unsigned long get_stick(void)
+{
+	unsigned long val;
+
+	__asm__ __volatile__("rd	%%asr24, %0"
+			     : "=r" (val));
+	return val;
+}
+
+static inline long get_delta (long *rt, long *master)
+{
+	unsigned long best_t0 = 0, best_t1 = ~0UL, best_tm = 0;
+	unsigned long tcenter, t0, t1, tm;
+	unsigned long i;
+
+	for (i = 0; i < NUM_ITERS; i++) {
+		t0 = get_stick();
+		go[MASTER] = 1;
+		membar("#StoreLoad");
+		while (!(tm = go[SLAVE]))
+			membar("#LoadLoad");
+		go[SLAVE] = 0;
+		membar("#StoreStore");
+		t1 = get_stick();
+
+		if (t1 - t0 < best_t1 - best_t0)
+			best_t0 = t0, best_t1 = t1, best_tm = tm;
+	}
+
+	*rt = best_t1 - best_t0;
+	*master = best_tm - best_t0;
+
+	/* average best_t0 and best_t1 without overflow: */
+	tcenter = (best_t0/2 + best_t1/2);
+	if (best_t0 % 2 + best_t1 % 2 == 2)
+		tcenter++;
+	return tcenter - best_tm;
+}
+
+static void adjust_stick(long adj)
+{
+	unsigned long tmp, pstate;
+
+	__asm__ __volatile__(
+		"rdpr	%%pstate, %0\n\t"
+		"ba,pt	%%xcc, 1f\n\t"
+		" wrpr	%0, %4, %%pstate\n\t"
+		".align	16\n\t"
+		"1:nop\n\t"
+		"rd	%%asr24, %1\n\t"
+		"add	%1, %2, %1\n\t"
+		"wr	%1, 0x0, %%asr24\n\t"
+		"add	%1, %3, %1\n\t"
+		"wr	%1, 0x0, %%asr25\n\t"
+		"wrpr	%0, 0x0, %%pstate"
+		: "=&r" (pstate), "=&r" (tmp)
+		: "r" (adj), "r" (current_tick_offset),
+		  "i" (PSTATE_IE));
+}
+
+void smp_synchronize_stick_client(void)
+{
+	long i, delta, adj, adjust_latency = 0, done = 0;
+	unsigned long flags, rt, master_time_stamp, bound;
+#if DEBUG_STICK_SYNC
+	struct {
+		long rt;	/* roundtrip time */
+		long master;	/* master's timestamp */
+		long diff;	/* difference between midpoint and master's timestamp */
+		long lat;	/* estimate of itc adjustment latency */
+	} t[NUM_ROUNDS];
+#endif
+
+	go[MASTER] = 1;
+
+	while (go[MASTER])
+		membar("#LoadLoad");
+
+	local_irq_save(flags);
+	{
+		for (i = 0; i < NUM_ROUNDS; i++) {
+			delta = get_delta(&rt, &master_time_stamp);
+			if (delta == 0) {
+				done = 1;	/* let's lock on to this... */
+				bound = rt;
+			}
+
+			if (!done) {
+				if (i > 0) {
+					adjust_latency += -delta;
+					adj = -delta + adjust_latency/4;
+				} else
+					adj = -delta;
+
+				adjust_stick(adj);
+			}
+#if DEBUG_STICK_SYNC
+			t[i].rt = rt;
+			t[i].master = master_time_stamp;
+			t[i].diff = delta;
+			t[i].lat = adjust_latency/4;
+#endif
+		}
+	}
+	local_irq_restore(flags);
+
+#if DEBUG_STICK_SYNC
+	for (i = 0; i < NUM_ROUNDS; i++)
+		printk("rt=%5ld master=%5ld diff=%5ld adjlat=%5ld\n",
+		       t[i].rt, t[i].master, t[i].diff, t[i].lat);
+#endif
+
+	printk(KERN_INFO "CPU %d: synchronized STICK with master CPU (last diff %ld cycles,"
+	       "maxerr %lu cycles)\n", smp_processor_id(), delta, rt);
+}
+
+static void smp_start_sync_stick_client(int cpu);
+
+static void smp_synchronize_one_stick(int cpu)
+{
+	unsigned long flags, i;
+
+	go[MASTER] = 0;
+
+	smp_start_sync_stick_client(cpu);
+
+	/* wait for client to be ready */
+	while (!go[MASTER])
+		membar("#LoadLoad");
+
+	/* now let the client proceed into his loop */
+	go[MASTER] = 0;
+	membar("#StoreLoad");
+
+	spin_lock_irqsave(&itc_sync_lock, flags);
+	{
+		for (i = 0; i < NUM_ROUNDS*NUM_ITERS; i++) {
+			while (!go[MASTER])
+				membar("#LoadLoad");
+			go[MASTER] = 0;
+			membar("#StoreStore");
+			go[SLAVE] = get_stick();
+			membar("#StoreLoad");
+		}
+	}
+	spin_unlock_irqrestore(&itc_sync_lock, flags);
+}
+
 extern struct prom_cpuinfo linux_cpus[NR_CPUS];
 
 extern unsigned long sparc64_cpu_startup;
@@ -470,6 +638,15 @@
 	/* NOTE: Caller runs local copy on master. */
 }
 
+extern unsigned long xcall_sync_stick;
+
+static void smp_start_sync_stick_client(int cpu)
+{
+	smp_cross_call_masked(&xcall_sync_stick,
+			      0, 0, 0,
+			      (1UL << cpu));
+}
+
 /* Send cross call to all processors except self. */
 #define smp_cross_call(func, ctx, data1, data2) \
 	smp_cross_call_masked(func, ctx, data1, data2, cpu_online_map)
@@ -928,8 +1105,6 @@
 
 extern void sparc64_do_profile(struct pt_regs *regs);
 
-static unsigned long current_tick_offset;
-
 #define prof_multiplier(__cpu)		cpu_data[(__cpu)].multiplier
 #define prof_counter(__cpu)		cpu_data[(__cpu)].counter
 
@@ -1260,8 +1435,12 @@
 		set_bit(cpu, &smp_commenced_mask);
 		while (!test_bit(cpu, &cpu_online_map))
 			mb();
-		if (!test_bit(cpu, &cpu_online_map))
+		if (!test_bit(cpu, &cpu_online_map)) {
 			ret = -ENODEV;
+		} else {
+			if (SPARC64_USE_STICK)
+				smp_synchronize_one_stick(cpu);
+		}
 	}
 	return ret;
 }
diff -Nru a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
--- a/arch/sparc64/kernel/sparc64_ksyms.c	Sun Feb 23 22:25:26 2003
+++ b/arch/sparc64/kernel/sparc64_ksyms.c	Sun Feb 23 22:25:26 2003
@@ -374,8 +374,3 @@
 
 /* for ns8703 */
 EXPORT_SYMBOL(ns87303_lock);
-
-#ifdef CONFIG_PROFILING
-EXPORT_SYMBOL_GPL(register_profile_notifier);
-EXPORT_SYMBOL_GPL(unregister_profile_notifier);
-#endif
diff -Nru a/arch/sparc64/kernel/sunos_ioctl32.c b/arch/sparc64/kernel/sunos_ioctl32.c
--- a/arch/sparc64/kernel/sunos_ioctl32.c	Sun Feb 23 22:25:26 2003
+++ b/arch/sparc64/kernel/sunos_ioctl32.c	Sun Feb 23 22:25:26 2003
@@ -1,5 +1,5 @@
 /* $Id: sunos_ioctl32.c,v 1.11 2000/07/30 23:12:24 davem Exp $
- * sunos_ioctl32.c: SunOS ioctl compatability on sparc64.
+ * sunos_ioctl32.c: SunOS ioctl compatibility on sparc64.
  *
  * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
  * Copyright (C) 1995, 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
diff -Nru a/arch/sparc64/kernel/sys32.S b/arch/sparc64/kernel/sys32.S
--- a/arch/sparc64/kernel/sys32.S	Sun Feb 23 22:25:22 2003
+++ b/arch/sparc64/kernel/sys32.S	Sun Feb 23 22:25:22 2003
@@ -1,5 +1,5 @@
 /* $Id: sys32.S,v 1.12 2000/03/24 04:17:37 davem Exp $
- * sys32.S: I-cache tricks for 32-bit compatability layer simple
+ * sys32.S: I-cache tricks for 32-bit compatibility layer simple
  *          conversions.
  *
  * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
diff -Nru a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
--- a/arch/sparc64/kernel/sys_sparc32.c	Sun Feb 23 22:25:25 2003
+++ b/arch/sparc64/kernel/sys_sparc32.c	Sun Feb 23 22:25:25 2003
@@ -3528,7 +3528,7 @@
 	return ret;
 }
 
-/* Handle adjtimex compatability. */
+/* Handle adjtimex compatibility. */
 
 struct timex32 {
 	u32 modes;
diff -Nru a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
--- a/arch/sparc64/kernel/sys_sunos32.c	Sun Feb 23 22:25:25 2003
+++ b/arch/sparc64/kernel/sys_sunos32.c	Sun Feb 23 22:25:25 2003
@@ -1,5 +1,5 @@
 /* $Id: sys_sunos32.c,v 1.64 2002/02/09 19:49:31 davem Exp $
- * sys_sunos32.c: SunOS binary compatability layer on sparc64.
+ * sys_sunos32.c: SunOS binary compatibility layer on sparc64.
  *
  * Copyright (C) 1995, 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
  * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
diff -Nru a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
--- a/arch/sparc64/kernel/systbls.S	Sun Feb 23 22:25:24 2003
+++ b/arch/sparc64/kernel/systbls.S	Sun Feb 23 22:25:24 2003
@@ -47,7 +47,7 @@
 	.word sys_nis_syscall, sys32_setreuid16, sys32_setregid16, sys_rename, sys_truncate
 /*130*/	.word sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall, sys_nis_syscall
 	.word sys_nis_syscall, sys_mkdir, sys_rmdir, sys32_utimes, sys_stat64
-/*140*/	.word sys32_sendfile64, sys_nis_syscall, sys_futex, sys_gettid, sys32_getrlimit
+/*140*/	.word sys32_sendfile64, sys_nis_syscall, compat_sys_futex, sys_gettid, sys32_getrlimit
 	.word sys32_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write
 /*150*/	.word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
 	.word sys32_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount
diff -Nru a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
--- a/arch/sparc64/kernel/time.c	Sun Feb 23 22:25:24 2003
+++ b/arch/sparc64/kernel/time.c	Sun Feb 23 22:25:24 2003
@@ -88,11 +88,8 @@
 {
 	unsigned long pc = regs->tpc;
 	unsigned long o7 = regs->u_regs[UREG_RETPC];
-#ifdef CONFIG_PROFILING
-	extern void sparc64_profile_hook(struct pt_regs *);
 
-	sparc64_profile_hook(regs);
-#endif
+	profile_hook(regs);
 
 	if (user_mode(regs))
 		return;
diff -Nru a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile
--- a/arch/sparc64/lib/Makefile	Sun Feb 23 22:25:21 2003
+++ b/arch/sparc64/lib/Makefile	Sun Feb 23 22:25:21 2003
@@ -3,6 +3,7 @@
 #
 
 EXTRA_AFLAGS := -ansi
+CFLAGS += -Werror
 
 L_TARGET = lib.a
 obj-y := PeeCeeI.o blockops.o debuglocks.o strlen.o strncmp.o \
diff -Nru a/arch/sparc64/mm/Makefile b/arch/sparc64/mm/Makefile
--- a/arch/sparc64/mm/Makefile	Sun Feb 23 22:25:26 2003
+++ b/arch/sparc64/mm/Makefile	Sun Feb 23 22:25:26 2003
@@ -3,6 +3,7 @@
 #
 
 EXTRA_AFLAGS := -ansi
+CFLAGS += -Werror
 
 obj-y    := ultra.o fault.o init.o generic.o extable.o
 
diff -Nru a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S
--- a/arch/sparc64/mm/ultra.S	Sun Feb 23 22:25:25 2003
+++ b/arch/sparc64/mm/ultra.S	Sun Feb 23 22:25:25 2003
@@ -557,6 +557,24 @@
 	nop
 	nop
 
+	/* This runs in a very controlled environment, so we do
+	 * not need to worry about BH races etc.
+	 */
+	.globl		xcall_sync_stick
+xcall_sync_stick:
+	rdpr		%pstate, %g2
+	wrpr		%g2, PSTATE_IG | PSTATE_AG, %pstate
+	rdpr		%pil, %g2
+	wrpr		%g0, 15, %pil
+	sethi		%hi(109f), %g7
+	b,pt		%xcc, etrap_irq
+109:	 or		%g7, %lo(109b), %g7
+	call		smp_synchronize_stick_client
+	 nop
+	clr		%l6
+	b		rtrap_xcall
+	 ldx		[%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
+
 	/* NOTE: This is SPECIAL!!  We do etrap/rtrap however
 	 *       we choose to deal with the "BH's run with
 	 *       %pil==15" problem (described in asm/pil.h)
diff -Nru a/arch/sparc64/oprofile/timer_int.c b/arch/sparc64/oprofile/timer_int.c
--- a/arch/sparc64/oprofile/timer_int.c	Sun Feb 23 22:25:25 2003
+++ b/arch/sparc64/oprofile/timer_int.c	Sun Feb 23 22:25:25 2003
@@ -13,6 +13,7 @@
 #include <linux/smp.h>
 #include <linux/irq.h>
 #include <linux/oprofile.h>
+#include <linux/profile.h>
 #include <asm/ptrace.h>
  
 static int timer_notify(struct notifier_block * self, unsigned long val, void * data)
diff -Nru a/arch/sparc64/prom/Makefile b/arch/sparc64/prom/Makefile
--- a/arch/sparc64/prom/Makefile	Sun Feb 23 22:25:26 2003
+++ b/arch/sparc64/prom/Makefile	Sun Feb 23 22:25:26 2003
@@ -4,6 +4,7 @@
 #
 
 EXTRA_AFLAGS := -ansi
+CFLAGS += -Werror
 
 L_TARGET = lib.a
 obj-y   := bootstr.o devops.o init.o memory.o misc.o \
diff -Nru a/arch/um/include/sysdep-i386/checksum.h b/arch/um/include/sysdep-i386/checksum.h
--- a/arch/um/include/sysdep-i386/checksum.h	Sun Feb 23 22:25:22 2003
+++ b/arch/um/include/sysdep-i386/checksum.h	Sun Feb 23 22:25:22 2003
@@ -60,7 +60,7 @@
 
 /*
  * These are the old (and unsafe) way of doing checksums, a warning message 
- * will be printed if they are used and an exeption occurs.
+ * will be printed if they are used and an exception occurs.
  *
  * these functions should go away after some time.
  */
diff -Nru a/arch/v850/Kconfig b/arch/v850/Kconfig
--- a/arch/v850/Kconfig	Sun Feb 23 22:25:24 2003
+++ b/arch/v850/Kconfig	Sun Feb 23 22:25:24 2003
@@ -133,6 +133,11 @@
 	  depends RTE_CB
 	  default y
 
+   config RTE_CB_MULTI_DBTRAP
+   	  bool "Pass illegal insn trap / dbtrap to kernel"
+	  depends RTE_CB_MULTI
+	  default n
+
    config RTE_CB_MA1_KSRAM
    	  bool "Kernel in SRAM (limits size of kernel)"
 	  depends RTE_CB_MA1 && RTE_CB_MULTI
diff -Nru a/arch/v850/kernel/bug.c b/arch/v850/kernel/bug.c
--- a/arch/v850/kernel/bug.c	Sun Feb 23 22:25:25 2003
+++ b/arch/v850/kernel/bug.c	Sun Feb 23 22:25:25 2003
@@ -1,8 +1,8 @@
 /*
  * arch/v850/kernel/bug.c -- Bug reporting functions
  *
- *  Copyright (C) 2001,02  NEC Corporation
- *  Copyright (C) 2001,02  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2001,02,03  NEC Electronics Corporation
+ *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
  *
  * This file is subject to the terms and conditions of the GNU General
  * Public License.  See the file COPYING in the main directory of this
@@ -37,12 +37,6 @@
 	printk (KERN_CRIT
 		"unimplemented trap %d called at 0x%08lx, pid %d!\n",
 		trap_num, regs->pc, current->pid);
-	return -ENOSYS;
-}
-
-int debug_trap (struct pt_regs *regs)
-{
-	printk (KERN_CRIT "debug trap at 0x%08lx!\n", regs->pc);
 	return -ENOSYS;
 }
 
diff -Nru a/arch/v850/kernel/entry.S b/arch/v850/kernel/entry.S
--- a/arch/v850/kernel/entry.S	Sun Feb 23 22:25:26 2003
+++ b/arch/v850/kernel/entry.S	Sun Feb 23 22:25:26 2003
@@ -2,8 +2,8 @@
  * arch/v850/kernel/entry.S -- Low-level system-call handling, trap handlers,
  *	and context-switching
  *
- *  Copyright (C) 2001,02  NEC Corporation
- *  Copyright (C) 2001,02  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2001,02,03  NEC Electronics Corporation
+ *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
  *
  * This file is subject to the terms and conditions of the GNU General
  * Public License.  See the file COPYING in the main directory of this
@@ -38,27 +38,27 @@
 	sst.w	r6, PTO+PT_GPR(6)[ep];					      \
 	sst.w	r7, PTO+PT_GPR(7)[ep];					      \
 	sst.w	r8, PTO+PT_GPR(8)[ep];					      \
-	sst.w	r9, PTO+PT_GPR(9)[ep];
+	sst.w	r9, PTO+PT_GPR(9)[ep]
 /* Restore argument registers from the struct pt_regs pointed to by EP.  */
 #define RESTORE_ARG_REGS						      \
 	sld.w	PTO+PT_GPR(6)[ep], r6;					      \
 	sld.w	PTO+PT_GPR(7)[ep], r7;					      \
 	sld.w	PTO+PT_GPR(8)[ep], r8;					      \
-	sld.w	PTO+PT_GPR(9)[ep], r9;
+	sld.w	PTO+PT_GPR(9)[ep], r9
 
 /* Save value return registers to the struct pt_regs pointed to by EP.  */
 #define SAVE_RVAL_REGS							      \
 	sst.w	r10, PTO+PT_GPR(10)[ep];				      \
-	sst.w	r11, PTO+PT_GPR(11)[ep];
+	sst.w	r11, PTO+PT_GPR(11)[ep]
 /* Restore value return registers from the struct pt_regs pointed to by EP.  */
 #define RESTORE_RVAL_REGS						      \
 	sld.w	PTO+PT_GPR(10)[ep], r10;				      \
-	sld.w	PTO+PT_GPR(11)[ep], r11;
+	sld.w	PTO+PT_GPR(11)[ep], r11
 
 
 #define SAVE_CALL_CLOBBERED_REGS_BEFORE_ARGS				      \
 	sst.w	r1, PTO+PT_GPR(1)[ep];					      \
-	sst.w	r5, PTO+PT_GPR(5)[ep];
+	sst.w	r5, PTO+PT_GPR(5)[ep]
 #define SAVE_CALL_CLOBBERED_REGS_AFTER_RVAL				      \
 	sst.w	r12, PTO+PT_GPR(12)[ep];				      \
 	sst.w	r13, PTO+PT_GPR(13)[ep];				      \
@@ -67,10 +67,10 @@
 	sst.w	r16, PTO+PT_GPR(16)[ep];				      \
 	sst.w	r17, PTO+PT_GPR(17)[ep];				      \
 	sst.w	r18, PTO+PT_GPR(18)[ep];				      \
-	sst.w	r19, PTO+PT_GPR(19)[ep];
+	sst.w	r19, PTO+PT_GPR(19)[ep]
 #define RESTORE_CALL_CLOBBERED_REGS_BEFORE_ARGS				      \
 	sld.w	PTO+PT_GPR(1)[ep], r1;					      \
-	sld.w	PTO+PT_GPR(5)[ep], r5;
+	sld.w	PTO+PT_GPR(5)[ep], r5
 #define RESTORE_CALL_CLOBBERED_REGS_AFTER_RVAL				      \
 	sld.w	PTO+PT_GPR(12)[ep], r12;				      \
 	sld.w	PTO+PT_GPR(13)[ep], r13;				      \
@@ -79,40 +79,34 @@
 	sld.w	PTO+PT_GPR(16)[ep], r16;				      \
 	sld.w	PTO+PT_GPR(17)[ep], r17;				      \
 	sld.w	PTO+PT_GPR(18)[ep], r18;				      \
-	sld.w	PTO+PT_GPR(19)[ep], r19;
+	sld.w	PTO+PT_GPR(19)[ep], r19
 
 /* Save `call clobbered' registers to the struct pt_regs pointed to by EP.  */
 #define SAVE_CALL_CLOBBERED_REGS					      \
 	SAVE_CALL_CLOBBERED_REGS_BEFORE_ARGS;				      \
 	SAVE_ARG_REGS;							      \
 	SAVE_RVAL_REGS;							      \
-	SAVE_CALL_CLOBBERED_REGS_AFTER_RVAL;
+	SAVE_CALL_CLOBBERED_REGS_AFTER_RVAL
 /* Restore `call clobbered' registers from the struct pt_regs pointed to
    by EP.  */
 #define RESTORE_CALL_CLOBBERED_REGS					      \
 	RESTORE_CALL_CLOBBERED_REGS_BEFORE_ARGS;			      \
 	RESTORE_ARG_REGS;						      \
 	RESTORE_RVAL_REGS;						      \
-	RESTORE_CALL_CLOBBERED_REGS_AFTER_RVAL;
+	RESTORE_CALL_CLOBBERED_REGS_AFTER_RVAL
 
 /* Save `call clobbered' registers except for the return-value registers
    to the struct pt_regs pointed to by EP.  */
 #define SAVE_CALL_CLOBBERED_REGS_NO_RVAL				      \
 	SAVE_CALL_CLOBBERED_REGS_BEFORE_ARGS;				      \
 	SAVE_ARG_REGS;							      \
-	SAVE_CALL_CLOBBERED_REGS_AFTER_RVAL;
+	SAVE_CALL_CLOBBERED_REGS_AFTER_RVAL
 /* Restore `call clobbered' registers except for the return-value registers
    from the struct pt_regs pointed to by EP.  */
 #define RESTORE_CALL_CLOBBERED_REGS_NO_RVAL				      \
 	RESTORE_CALL_CLOBBERED_REGS_BEFORE_ARGS;			      \
 	RESTORE_ARG_REGS;						      \
-	RESTORE_CALL_CLOBBERED_REGS_AFTER_RVAL;
-
-/* Zero `call clobbered' registers except for the return-value registers.  */
-#define ZERO_CALL_CLOBBERED_REGS_NO_RVAL				      \
-	mov	r0, r1;   mov	r0, r5;					      \
-	mov	r0, r12;  mov	r0, r13;  mov	r0, r14;  mov	r0, r15;      \
-	mov	r0, r16;  mov	r0, r17;  mov	r0, r18;  mov	r0, r19;
+	RESTORE_CALL_CLOBBERED_REGS_AFTER_RVAL
 
 /* Save `call saved' registers to the struct pt_regs pointed to by EP.  */
 #define SAVE_CALL_SAVED_REGS						      \
@@ -126,7 +120,7 @@
 	sst.w	r26, PTO+PT_GPR(26)[ep];				      \
 	sst.w	r27, PTO+PT_GPR(27)[ep];				      \
 	sst.w	r28, PTO+PT_GPR(28)[ep];				      \
-	sst.w	r29, PTO+PT_GPR(29)[ep];
+	sst.w	r29, PTO+PT_GPR(29)[ep]
 /* Restore `call saved' registers from the struct pt_regs pointed to by EP.  */
 #define RESTORE_CALL_SAVED_REGS						      \
 	sld.w	PTO+PT_GPR(2)[ep], r2;					      \
@@ -139,68 +133,53 @@
 	sld.w	PTO+PT_GPR(26)[ep], r26;				      \
 	sld.w	PTO+PT_GPR(27)[ep], r27;				      \
 	sld.w	PTO+PT_GPR(28)[ep], r28;				      \
-	sld.w	PTO+PT_GPR(29)[ep], r29;
+	sld.w	PTO+PT_GPR(29)[ep], r29
+
 
+/* Save the PC stored in the special register SAVEREG to the struct pt_regs
+   pointed to by EP.  r19 is clobbered.  */
+#define SAVE_PC(savereg)						      \
+	stsr	SR_ ## savereg, r19;					      \
+	sst.w	r19, PTO+PT_PC[ep]
+/* Restore the PC from the struct pt_regs pointed to by EP, to the special
+   register SAVEREG.  LP is clobbered (it is used as a scratch register
+   because the POP_STATE macro restores it, and this macro is usually used
+   inside POP_STATE).  */
+#define RESTORE_PC(savereg)						      \
+	sld.w	PTO+PT_PC[ep], lp;					      \
+	ldsr	lp, SR_ ## savereg
+/* Save the PSW register stored in the special register SAVREG to the
+   struct pt_regs pointed to by EP r19 is clobbered.  */
+#define SAVE_PSW(savereg)						      \
+	stsr	SR_ ## savereg, r19;					      \
+	sst.w	r19, PTO+PT_PSW[ep]
+/* Restore the PSW register from the struct pt_regs pointed to by EP, to
+   the special register SAVEREG.  LP is clobbered (it is used as a scratch
+   register because the POP_STATE macro restores it, and this macro is
+   usually used inside POP_STATE).  */
+#define RESTORE_PSW(savereg)						      \
+	sld.w	PTO+PT_PSW[ep], lp;					      \
+	ldsr	lp, SR_ ## savereg
 
-/* Save system registers to the struct pt_regs pointed to by REG.  
+/* Save CTPC/CTPSW/CTBP registers to the struct pt_regs pointed to by REG.  
    r19 is clobbered.  */
-#define SAVE_SYS_REGS							      \
-	stsr	SR_EIPC, r19;	/* user's PC, before interrupt */	      \
-	sst.w	r19, PTO+PT_PC[ep];					      \
-	stsr	SR_EIPSW, r19;	/* & PSW (XXX save this?) */		      \
-	sst.w	r19, PTO+PT_PSW[ep];					      \
-	stsr	SR_CTPC, r19;	/* (XXX maybe not used in kernel?) */	      \
+#define SAVE_CT_REGS							      \
+	stsr	SR_CTPC, r19;						      \
 	sst.w	r19, PTO+PT_CTPC[ep];					      \
-	stsr	SR_CTPSW, r19;	/* " */					      \
+	stsr	SR_CTPSW, r19;						      \
 	sst.w	r19, PTO+PT_CTPSW[ep];					      \
-	stsr	SR_CTBP, r19;	/* " */					      \
-	sst.w	r19, PTO+PT_CTBP[ep];
-/* Restore system registers from the struct pt_regs pointed to by EP.  
+	stsr	SR_CTBP, r19;						      \
+	sst.w	r19, PTO+PT_CTBP[ep]
+/* Restore CTPC/CTPSW/CTBP registers from the struct pt_regs pointed to by EP.
    LP is clobbered (it is used as a scratch register because the POP_STATE
    macro restores it, and this macro is usually used inside POP_STATE).  */
-#define RESTORE_SYS_REGS						      \
-	sld.w	PTO+PT_PC[ep], lp;					      \
-	ldsr	lp, SR_EIPC;	/* user's PC, before interrupt */	      \
-	sld.w	PTO+PT_PSW[ep], lp;					      \
-	ldsr	lp, SR_EIPSW;	/* & PSW (XXX save this?) */		      \
+#define RESTORE_CT_REGS							      \
 	sld.w	PTO+PT_CTPC[ep], lp;					      \
-	ldsr	lp, SR_CTPC;	/* (XXX maybe not used in kernel?) */	      \
+	ldsr	lp, SR_CTPC;						      \
 	sld.w	PTO+PT_CTPSW[ep], lp;					      \
-	ldsr	lp, SR_CTPSW;	/* " */					      \
+	ldsr	lp, SR_CTPSW;						      \
 	sld.w	PTO+PT_CTBP[ep], lp;					      \
-	ldsr	lp, SR_CTBP;	/* " */
-
-
-/* Save system registers to the struct pt_regs pointed to by REG.  This is a
-   NMI-specific version, because NMIs save the PC/PSW in a different place
-   than other interrupt requests.  r19 is clobbered.  */
-#define SAVE_SYS_REGS_FOR_NMI						      \
-	stsr	SR_FEPC, r19;	/* user's PC, before NMI */		      \
-	sst.w	r19, PTO+PT_PC[ep];					      \
-	stsr	SR_FEPSW, r19;	/* & PSW (XXX save this?) */		      \
-	sst.w	r19, PTO+PT_PSW[ep];					      \
-	stsr	SR_CTPC, r19;	/* (XXX maybe not used in kernel?) */	      \
-	sst.w	r19, PTO+PT_CTPC[ep];					      \
-	stsr	SR_CTPSW, r19;	/* " */					      \
-	sst.w	r19, PTO+PT_CTPSW[ep];					      \
-	stsr	SR_CTBP, r19;	/* " */					      \
-	sst.w	r19, PTO+PT_CTBP[ep];
-/* Restore system registers from the struct pt_regs pointed to by EP.  This is
-   a NMI-specific version, because NMIs save the PC/PSW in a different place
-   than other interrupt requests.  LP is clobbered (it is used as a scratch
-   register because the POP_STATE macro restores it, and this macro is usually
-   used inside POP_STATE).  */
-#define RESTORE_SYS_REGS_FOR_NMI					      \
-	ldsr	lp, SR_FEPC;	/* user's PC, before NMI */		      \
-	sld.w	PTO+PT_PC[ep], lp;					      \
-	ldsr	lp, SR_FEPSW;	/* & PSW (XXX save this?) */		      \
-	sld.w	PTO+PT_PSW[ep], lp;					      \
-	ldsr	lp, SR_CTPC;	/* (XXX maybe not used in kernel?) */	      \
-	sld.w	PTO+PT_CTPC[ep], lp;					      \
-	ldsr	lp, SR_CTPSW;	/* " */					      \
-	sld.w	PTO+PT_CTPSW[ep], lp;					      \
-	ldsr	lp, SR_CTBP;	/* " */					      \
-	sld.w	PTO+PT_CTBP[ep], lp;
+	ldsr	lp, SR_CTBP
 
 
 /* Push register state, except for the stack pointer, on the stack in the form
@@ -213,7 +192,7 @@
 	mov	sp, ep;							      \
 	sst.w	gp, PTO+PT_GPR(GPR_GP)[ep];				      \
 	sst.w	lp, PTO+PT_GPR(GPR_LP)[ep];				      \
-	type ## _STATE_SAVER;
+	type ## _STATE_SAVER
 /* Pop a register state, except for the stack pointer, from the struct pt_regs
    on the stack.  */
 #define POP_STATE(type)							      \
@@ -222,161 +201,175 @@
 	sld.w	PTO+PT_GPR(GPR_GP)[ep], gp;				      \
 	sld.w	PTO+PT_GPR(GPR_LP)[ep], lp;				      \
 	sld.w	PTO+PT_GPR(GPR_EP)[ep], ep;				      \
-	addi	STATE_SAVE_SIZE, sp, sp; /* Clean up our stack space.  */
+	addi	STATE_SAVE_SIZE, sp, sp /* Clean up our stack space.  */
 
 
-/* Switch to the kernel stack if necessary, and push register state on
-   the stack in the form of a struct pt_regs.  Also load the current
-   task pointer if switching from user mode.  The stack-pointer (r3)
-   should have already been saved to the memory location SP_SAVE_LOC
-   (the reason for this is that the interrupt vectors may be beyond a
-   22-bit signed offset jump from the actual interrupt handler, and this
-   allows them to save the stack-pointer and use that register to do an
-   indirect jump).  This macro makes sure that `special' registers,
-   system registers, and the stack pointer are saved; TYPE identifies
-   the set of extra registers to be saved as well.  SYSCALL_NUM is the
-   register in which the system-call number this state is for is stored
-   (r0 if this isn't a system call).  Interrupts should already be
-   disabled when calling this.  */
+/* Switch to the kernel stack if necessary, and push register state on the
+   stack in the form of a struct pt_regs.  Also load the current task
+   pointer if switching from user mode.  The stack-pointer (r3) should have
+   already been saved to the memory location SP_SAVE_LOC (the reason for
+   this is that the interrupt vectors may be beyond a 22-bit signed offset
+   jump from the actual interrupt handler, and this allows them to save the
+   stack-pointer and use that register to do an indirect jump).  This macro
+   makes sure that `special' registers, system registers, and the stack
+   pointer are saved; TYPE identifies the set of extra registers to be
+   saved as well.  SYSCALL_NUM is the register in which the system-call
+   number this state is for is stored (r0 if this isn't a system call).
+   Interrupts should already be disabled when calling this.  */
 #define SAVE_STATE(type, syscall_num, sp_save_loc)			      \
-        tst1	0, KM;			/* See if already in kernel mode.  */ \
+	tst1	0, KM;			/* See if already in kernel mode.  */ \
 	bz	1f;							      \
-        /* Kernel-mode state save.  */					      \
-	ld.w	sp_save_loc, sp;	/* Reload kernel stack-pointer.  */   \
-	st.w	sp, (PT_GPR(GPR_SP)-PT_SIZE)[sp]; /* Save original SP. */     \
-        PUSH_STATE(type);						      \
-	mov	1, r19;			/* Was in kernel-mode.  */	      \
-        sst.w	r19, PTO+PT_KERNEL_MODE[ep]; /* [ep is set by PUSH_STATE] */  \
-        br	2f;							      \
-1:      /* User-mode state save.  */					      \
-        ld.w    KSP, sp;		/* Switch to kernel stack.  */	      \
-        PUSH_STATE(type);						      \
-        sst.w	r0, PTO+PT_KERNEL_MODE[ep]; /* Was in user-mode.  */	      \
-        ld.w    sp_save_loc, r19;				              \
-	sst.w	r19, PTO+PT_GPR(GPR_SP)[ep]; /* Store user SP.  */	      \
-	mov	1, r19;							      \
-	st.b	r19, KM;		/* Now we're in kernel-mode.  */      \
+	ld.w	sp_save_loc, sp;	/* ... yes, use saved SP.  */	      \
+	br	2f;							      \
+1:	ld.w	KSP, sp;		/* ... no, switch to kernel stack. */ \
+2:	PUSH_STATE(type);						      \
+	ld.b	KM, r19;		/* Remember old kernel-mode.  */      \
+	sst.w	r19, PTO+PT_KERNEL_MODE[ep];				      \
+	ld.w	sp_save_loc, r19;	/* Remember old SP.  */		      \
+	sst.w	r19, PTO+PT_GPR(GPR_SP)[ep];				      \
+	mov	1, r19;			/* Now definitely in kernel-mode. */  \
+	st.b	r19, KM;						      \
 	GET_CURRENT_TASK(CURRENT_TASK);	/* Fetch the current task pointer. */ \
-2:      /* Save away the syscall number.  */				      \
-        sst.w	syscall_num, PTO+PT_SYSCALL[ep]
+	/* Save away the syscall number.  */				      \
+	sst.w	syscall_num, PTO+PT_SYSCALL[ep]
 
 
 /* Save register state not normally saved by PUSH_STATE for TYPE.  */
 #define SAVE_EXTRA_STATE(type)						      \
         mov	sp, ep;							      \
-	type ## _EXTRA_STATE_SAVER;
+	type ## _EXTRA_STATE_SAVER
 /* Restore register state not normally restored by POP_STATE for TYPE.  */
 #define RESTORE_EXTRA_STATE(type)					      \
         mov	sp, ep;							      \
-	type ## _EXTRA_STATE_RESTORER;
+	type ## _EXTRA_STATE_RESTORER
 
 /* Save any call-clobbered registers not normally saved by PUSH_STATE
    for TYPE.  */
 #define SAVE_EXTRA_STATE_FOR_FUNCALL(type)				      \
         mov	sp, ep;							      \
-	type ## _FUNCALL_EXTRA_STATE_SAVER;
+	type ## _FUNCALL_EXTRA_STATE_SAVER
 /* Restore any call-clobbered registers not normally restored by POP_STATE for
    TYPE.  */
 #define RESTORE_EXTRA_STATE_FOR_FUNCALL(type)				      \
         mov	sp, ep;							      \
-	type ## _FUNCALL_EXTRA_STATE_RESTORER;
+	type ## _FUNCALL_EXTRA_STATE_RESTORER
 
 
-/* These are extra_state_saver/restorer values for a user trap.  Note that we
-   save the argument registers so that restarted syscalls will function
-   properly (otherwise it wouldn't be necessary), and we must _not_ restore
-   the return-value registers (so that traps can return a value!), but there
-   are various options for what happens to other call-clobbered registers,
-   selected by preprocessor conditionals.  */
-
-#if TRAPS_PRESERVE_CALL_CLOBBERED_REGS
-   
-/* Traps save/restore all call-clobbered registers (except for rval regs).  */
-#define TRAP_STATE_SAVER						      \
-     SAVE_CALL_CLOBBERED_REGS_NO_RVAL;					      \
-     SAVE_SYS_REGS
-#define TRAP_STATE_RESTORER						      \
-     RESTORE_CALL_CLOBBERED_REGS_NO_RVAL;				      \
-     RESTORE_SYS_REGS
-
-#else /* !TRAPS_PRESERVE_CALL_CLOBBERED_REGS */
+/* These are extra_state_saver/restorer values for a user trap.  Note
+   that we save the argument registers so that restarted syscalls will
+   function properly (otherwise it wouldn't be necessary), and we must
+   _not_ restore the return-value registers (so that traps can return a
+   value!), but call-clobbered registers are not saved at all, as the
+   caller of the syscall function should have saved them.  */
 
+#define TRAP_RET reti
 /* Traps don't save call-clobbered registers (but do still save arg regs).  */
 #define TRAP_STATE_SAVER						      \
-     SAVE_ARG_REGS;							      \
-     SAVE_SYS_REGS
-
-#if TRAPS_ZERO_CALL_CLOBBERED_REGS
-   
-/* Traps zero call-clobbered registers (except for arg/rval regs) before
-   returning from a system call, to avoid any internal values from leaking out
-   of the kernel.  */
-#define TRAP_STATE_RESTORER						      \
-     ZERO_CALL_CLOBBERED_REGS_NO_ARGS_NO_RVAL;				      \
-     RESTORE_ARG_REGS;							      \
-     RESTORE_SYS_REGS
-
-#else /* !TRAPS_ZERO_CALL_CLOBBERED_REGS */
-   
+	SAVE_ARG_REGS;							      \
+	SAVE_PC(EIPC)
 /* When traps return, they just leave call-clobbered registers (except for arg
    regs) with whatever value they have from the kernel.  */
 #define TRAP_STATE_RESTORER						      \
-     RESTORE_ARG_REGS;							      \
-     RESTORE_SYS_REGS
-
-#endif /* TRAPS_ZERO_CALL_CLOBBERED_REGS */
-#endif /* TRAPS_PRESERVE_CALL_CLOBBERED_REGS */
-
-/* Save registers not normally saved by traps.  */
+	RESTORE_ARG_REGS;						      \
+	RESTORE_PC(EIPC)
+/* Save registers not normally saved by traps.  We need to save r12, even
+   though it's nominally call-clobbered, because it's used when restarting
+   a system call (the signal-handling path uses SAVE_EXTRA_STATE, and
+   expects r12 to be restored when the trap returns).  Similarly, we must
+   save the PSW, so that it's at least in a known state in the the pt_regs
+   structure.  */
 #define TRAP_EXTRA_STATE_SAVER						      \
-   SAVE_RVAL_REGS;							      \
-   SAVE_CALL_SAVED_REGS
+	SAVE_RVAL_REGS;							      \
+	sst.w	r12, PTO+PT_GPR(12)[ep];				      \
+	SAVE_CALL_SAVED_REGS;						      \
+	SAVE_PSW(EIPSW);						      \
+	SAVE_CT_REGS
 #define TRAP_EXTRA_STATE_RESTORER					      \
-   RESTORE_RVAL_REGS;							      \
-   RESTORE_CALL_SAVED_REGS
+	RESTORE_RVAL_REGS;						      \
+	sld.w	PTO+PT_GPR(12)[ep], r12;				      \
+	RESTORE_CALL_SAVED_REGS;					      \
+	RESTORE_PSW(EIPSW);						      \
+	RESTORE_CT_REGS
 #define TRAP_FUNCALL_EXTRA_STATE_SAVER					      \
-   SAVE_RVAL_REGS
+	SAVE_RVAL_REGS
 #define TRAP_FUNCALL_EXTRA_STATE_RESTORER				      \
-   RESTORE_RVAL_REGS
-
+	RESTORE_RVAL_REGS
 
 /* Register saving/restoring for maskable interrupts.  */
+#define IRQ_RET reti
 #define IRQ_STATE_SAVER							      \
-   SAVE_CALL_CLOBBERED_REGS;						      \
-   SAVE_SYS_REGS
+	SAVE_CALL_CLOBBERED_REGS;					      \
+	SAVE_PC(EIPC);							      \
+	SAVE_PSW(EIPSW)
 #define IRQ_STATE_RESTORER						      \
-   RESTORE_CALL_CLOBBERED_REGS;						      \
-   RESTORE_SYS_REGS
+	RESTORE_CALL_CLOBBERED_REGS;					      \
+	RESTORE_PC(EIPC);						      \
+	RESTORE_PSW(EIPSW)
 #define IRQ_EXTRA_STATE_SAVER						      \
-   SAVE_CALL_SAVED_REGS
+	SAVE_CALL_SAVED_REGS;						      \
+	SAVE_CT_REGS
 #define IRQ_EXTRA_STATE_RESTORER					      \
-   RESTORE_CALL_SAVED_REGS
+	RESTORE_CALL_SAVED_REGS;					      \
+	RESTORE_CT_REGS
 #define IRQ_FUNCALL_EXTRA_STATE_SAVER       /* nothing */
 #define IRQ_FUNCALL_EXTRA_STATE_RESTORER    /* nothing */
 
 /* Register saving/restoring for non-maskable interrupts.  */
+#define NMI_RET reti
 #define NMI_STATE_SAVER							      \
-   SAVE_CALL_CLOBBERED_REGS;						      \
-   SAVE_SYS_REGS_FOR_NMI
+	SAVE_CALL_CLOBBERED_REGS;					      \
+	SAVE_PC(FEPC);							      \
+	SAVE_PSW(FEPSW);
 #define NMI_STATE_RESTORER						      \
-   RESTORE_CALL_CLOBBERED_REGS;						      \
-   RESTORE_SYS_REGS_FOR_NMI
+	RESTORE_CALL_CLOBBERED_REGS;					      \
+	RESTORE_PC(FEPC);						      \
+	RESTORE_PSW(FEPSW);
 #define NMI_EXTRA_STATE_SAVER						      \
-   SAVE_CALL_SAVED_REGS
+	SAVE_CALL_SAVED_REGS;						      \
+	SAVE_CT_REGS
 #define NMI_EXTRA_STATE_RESTORER					      \
-   RESTORE_CALL_SAVED_REGS
+	RESTORE_CALL_SAVED_REGS;					      \
+	RESTORE_CT_REGS
 #define NMI_FUNCALL_EXTRA_STATE_SAVER       /* nothing */
 #define NMI_FUNCALL_EXTRA_STATE_RESTORER    /* nothing */
-   
-/* Register saving/restoring for a context switch.  We don't need to save too
-   many registers, because context-switching looks like a function call (via
-   the function `switch_thread'), so callers will save any call-clobbered
-   registers themselves.  The stack pointer and return value are handled by
-   switch_thread itself.  */
+
+/* Register saving/restoring for debug traps.  */
+#define DBTRAP_RET .long 0x014607E0 /* `dbret', but gas doesn't support it. */
+#define DBTRAP_STATE_SAVER						      \
+	SAVE_CALL_CLOBBERED_REGS;					      \
+	SAVE_PC(DBPC);							      \
+	SAVE_PSW(DBPSW)
+#define DBTRAP_STATE_RESTORER						      \
+	RESTORE_CALL_CLOBBERED_REGS;					      \
+	RESTORE_PC(DBPC);						      \
+	RESTORE_PSW(DBPSW)
+#define DBTRAP_EXTRA_STATE_SAVER					      \
+	SAVE_CALL_SAVED_REGS;						      \
+	SAVE_CT_REGS
+#define DBTRAP_EXTRA_STATE_RESTORER					      \
+	RESTORE_CALL_SAVED_REGS;					      \
+	RESTORE_CT_REGS
+#define DBTRAP_FUNCALL_EXTRA_STATE_SAVER       /* nothing */
+#define DBTRAP_FUNCALL_EXTRA_STATE_RESTORER    /* nothing */
+
+/* Register saving/restoring for a context switch.  We don't need to save
+   too many registers, because context-switching looks like a function call
+   (via the function `switch_thread'), so callers will save any
+   call-clobbered registers themselves.  We do need to save the CT regs, as
+   they're normally not saved during kernel entry (the kernel doesn't use
+   them).  We save PSW so that interrupt-status state will correctly follow
+   each thread (mostly NMI vs. normal-IRQ/trap), though for the most part
+   it doesn't matter since threads are always in almost exactly the same
+   processor state during a context switch.  The stack pointer and return
+   value are handled by switch_thread itself.  */
 #define SWITCH_STATE_SAVER						      \
-   SAVE_CALL_SAVED_REGS
+	SAVE_CALL_SAVED_REGS;						      \
+	SAVE_PSW(PSW);							      \
+	SAVE_CT_REGS
 #define SWITCH_STATE_RESTORER						      \
-   RESTORE_CALL_SAVED_REGS
+	RESTORE_CALL_SAVED_REGS;					      \
+	RESTORE_PSW(PSW);						      \
+	RESTORE_CT_REGS
 
 
 /* Restore register state from the struct pt_regs on the stack, switch back
@@ -400,24 +393,27 @@
 	andi	_TIF_SIGPENDING, r19, r0;				      \
 	bnz	4f;			/* Signals to handle, handle them */  \
 									      \
-/* Finally, return to user state.  */					      \
+/* Return to user state.  */					   	      \
 1:	st.b	r0, KM;			/* Now officially in user state. */   \
-	POP_STATE(type);						      \
-	st.w	sp, KSP;		/* Save the kernel stack pointer. */  \
-	ld.w    PT_GPR(GPR_SP)-PT_SIZE[sp], sp;				      \
-					/* Restore user stack pointer. */     \
-	reti;								      \
 									      \
-/* Return to kernel state.  */						      \
+/* Final return.  The stack-pointer fiddling is not needed when returning     \
+   to kernel-mode, but they don't hurt, and this way we can share the	      \
+   (somtimes rather lengthy) POP_STATE macro.  */			      \
 2:	POP_STATE(type);						      \
-	reti;								      \
+	st.w	sp, KSP;		/* Save the kernel stack pointer. */  \
+	ld.w    PT_GPR(GPR_SP)-PT_SIZE[sp], sp; /* Restore stack pointer. */  \
+	type ## _RET;			/* Return from the trap/interrupt. */ \
 									      \
 /* Call the scheduler before returning from a syscall/trap. */		      \
 3:	SAVE_EXTRA_STATE_FOR_FUNCALL(type); /* Prepare for funcall. */	      \
 	jarl	CSYM(schedule), lp;	/* Call scheduler */		      \
 	di;				/* The scheduler enables interrupts */\
 	RESTORE_EXTRA_STATE_FOR_FUNCALL(type);				      \
-	br	1b;							      \
+	GET_CURRENT_THREAD(r18);					      \
+	ld.w	TI_FLAGS[r18], r19;					      \
+	andi	_TIF_SIGPENDING, r19, r0;				      \
+	bz	1b;			/* No signals, return.  */	      \
+	/* Signals to handle, fall through to handle them.  */		      \
 									      \
 /* Handle a signal return.  */						      \
 4:      /* Not all registers are saved by the normal trap/interrupt entry     \
@@ -428,13 +424,13 @@
 	   complete register state.  Here we save anything not saved by	      \
 	   the normal entry sequence, so that it may be safely restored	      \
 	   (in a possibly modified form) after do_signal returns.  */	      \
-        SAVE_EXTRA_STATE(type)		/* Save state not saved by entry. */  \
+        SAVE_EXTRA_STATE(type);		/* Save state not saved by entry. */  \
 	movea	PTO, sp, r6;		/* Arg 1: struct pt_regs *regs */     \
 	mov	r0, r7;			/* Arg 2: sigset_t *oldset */	      \
 	jarl	CSYM(do_signal), lp;	/* Handle any signals */	      \
 	di;				/* sig handling enables interrupts */ \
         RESTORE_EXTRA_STATE(type);	/* Restore extra regs.  */	      \
-	br	1b;
+	br	1b
 
 
 /* Jump to the appropriate function for the system call number in r12
@@ -454,7 +450,7 @@
 	jmp	[r12];							      \
 	/* The syscall number is invalid, return an error.  */		      \
 1:	addi	-ENOSYS, r0, r10;					      \
-	jmp	[lp];
+	jmp	[lp]
 
 
 	.text
@@ -469,7 +465,7 @@
  * beyond a 22-bit signed offset jump from the actual interrupt handler, and
  * this allows them to save the stack-pointer and use that register to do an
  * indirect jump).
- *	
+ *
  * Syscall protocol:
  *   Syscall number in r12, args in r6-r9
  *   Return value in r10
@@ -537,18 +533,15 @@
 	st.w	r13, 16[sp]		// arg 5
 	st.w	r14, 20[sp]		// arg 6
 
-#if !TRAPS_PRESERVE_CALL_CLOBBERED_REGS
 	// Make sure r13 and r14 are preserved, in case we have to restart a
 	// system call because of a signal (ep has already been set by caller).
 	st.w	r13, PTO+PT_GPR(13)[sp]
 	st.w	r14, PTO+PT_GPR(13)[sp]
 	mov	hilo(ret_from_long_syscall), lp
-#endif /* !TRAPS_PRESERVE_CALL_CLOBBERED_REGS */
 
 	MAKE_SYS_CALL			// Jump to the syscall function.
 END(syscall_long)	
 
-#if !TRAPS_PRESERVE_CALL_CLOBBERED_REGS
 /* Entry point used to return from a long syscall.  Only needed to restore
    r13/r14 if the general trap mechanism doesnt' do so.  */
 L_ENTRY(ret_from_long_syscall):
@@ -556,7 +549,6 @@
 	ld.w	PTO+PT_GPR(13)[sp], r14
 	br	ret_from_trap		// The rest is the same as other traps
 END(ret_from_long_syscall)
-#endif /* !TRAPS_PRESERVE_CALL_CLOBBERED_REGS */
 
 
 /* These syscalls need access to the struct pt_regs on the stack, so we
@@ -564,14 +556,11 @@
 
 L_ENTRY(sys_fork_wrapper):
 #ifdef CONFIG_MMU
-	// Save state not saved by entry.  This is actually slight overkill;
-	// it's actually only necessary to save any state restored by
-	// switch_thread that's not saved by the trap entry.
-	SAVE_EXTRA_STATE(TRAP)		// Save state not saved by entry.
 	addi	SIGCHLD, r0, r6		// Arg 0: flags
 	ld.w	PTO+PT_GPR(GPR_SP)[sp], r7 // Arg 1: child SP (use parent's)
 	movea	PTO, sp, r8		// Arg 2: parent context
-	jr	CSYM(fork_common)	// Do real work (tail-call).
+	mov	hilo(CSYM(fork_common)), r18// Where the real work gets done
+	br	save_extra_state_tramp	// Save state and go there
 #else
 	// fork almost works, enough to trick you into looking elsewhere :-(
 	addi	-EINVAL, r0, r10
@@ -580,60 +569,66 @@
 END(sys_fork_wrapper)
 
 L_ENTRY(sys_vfork_wrapper):
-	// Save state not saved by entry.  This is actually slight overkill;
-	// it's actually only necessary to save any state restored by
-	// switch_thread that's not saved by the trap entry.
-	SAVE_EXTRA_STATE(TRAP)		// Save state not saved by entry.
 	addi	CLONE_VFORK | CLONE_VM | SIGCHLD, r0, r6 // Arg 0: flags
 	ld.w	PTO+PT_GPR(GPR_SP)[sp], r7 // Arg 1: child SP (use parent's)
 	movea	PTO, sp, r8		// Arg 2: parent context
-	jr	CSYM(fork_common)	// Do real work (tail-call).
+	mov	hilo(CSYM(fork_common)), r18// Where the real work gets done
+	br	save_extra_state_tramp	// Save state and go there
 END(sys_vfork_wrapper)
 
 L_ENTRY(sys_clone_wrapper):
-	// Save state not saved by entry.  This is actually slight overkill;
-	// it's actually only necessary to save any state restored by
-	// switch_thread that's not saved by the trap entry.
-	SAVE_EXTRA_STATE(TRAP)		// Save state not saved by entry.
 	ld.w	PTO+PT_GPR(GPR_SP)[sp], r19 // parent's stack pointer
         cmp	r7, r0			// See if child SP arg (arg 1) is 0.
 	cmov	z, r19, r7, r7		// ... and use the parent's if so. 
 	movea	PTO, sp, r8		// Arg 2: parent context
-	jr	CSYM(fork_common)	// Do real work (tail-call).
+	mov	hilo(CSYM(fork_common)), r18// Where the real work gets done
+	br	save_extra_state_tramp	// Save state and go there
 END(sys_clone_wrapper)
 
+
 L_ENTRY(sys_execve_wrapper):
 	movea	PTO, sp, r9		// add user context as 4th arg
 	jr	CSYM(sys_execve)	// Do real work (tail-call).
 END(sys_execve_wrapper)
 
+
 L_ENTRY(sys_sigsuspend_wrapper):
-        SAVE_EXTRA_STATE(TRAP)		// Save state not saved by entry.
 	movea	PTO, sp, r7		// add user context as 2nd arg
-	jarl	CSYM(sys_sigsuspend), lp// Do real work.
+	mov	hilo(CSYM(sys_sigsuspend)), r18	// syscall function
+	jarl	save_extra_state_tramp, lp	// Save state and do it
 	br	restore_extra_regs_and_ret_from_trap
 END(sys_sigsuspend_wrapper)
 L_ENTRY(sys_rt_sigsuspend_wrapper):
-        SAVE_EXTRA_STATE(TRAP)		// Save state not saved by entry.
 	movea	PTO, sp, r8		// add user context as 3rd arg
-	jarl	CSYM(sys_rt_sigsuspend), lp	// Do real work.
+	mov	hilo(CSYM(sys_rt_sigsuspend)), r18	// syscall function
+	jarl	save_extra_state_tramp, lp	// Save state and do it
 	br	restore_extra_regs_and_ret_from_trap
 END(sys_rt_sigsuspend_wrapper)
 
 L_ENTRY(sys_sigreturn_wrapper):
-        SAVE_EXTRA_STATE(TRAP)		// Save state not saved by entry.
 	movea	PTO, sp, r6		// add user context as 1st arg
-	jarl	CSYM(sys_sigreturn), lp	// Do real work.
+	mov	hilo(CSYM(sys_sigreturn)), r18	// syscall function
+	jarl	save_extra_state_tramp, lp	// Save state and do it
 	br	restore_extra_regs_and_ret_from_trap
 END(sys_sigreturn_wrapper)
 L_ENTRY(sys_rt_sigreturn_wrapper):
         SAVE_EXTRA_STATE(TRAP)		// Save state not saved by entry.
 	movea	PTO, sp, r6		// add user context as 1st arg
-	jarl	CSYM(sys_rt_sigreturn), lp	// Do real work.
+	mov	hilo(CSYM(sys_rt_sigreturn)), r18	// syscall function
+	jarl	save_extra_state_tramp, lp	// Save state and do it
 	br	restore_extra_regs_and_ret_from_trap
 END(sys_rt_sigreturn_wrapper)
 
 
+/* Save any state not saved by SAVE_STATE(TRAP), and jump to r18.
+   It's main purpose is to share the rather lengthy code sequence that
+   SAVE_STATE expands into among the above wrapper functions.  */
+L_ENTRY(save_extra_state_tramp):
+	SAVE_EXTRA_STATE(TRAP)		// Save state not saved by entry.
+	jmp	[r18]			// Do the work the caller wants
+END(save_extra_state_tramp)
+
+
 /*
  * Hardware maskable interrupts.
  *
@@ -658,37 +653,40 @@
 	shr	20, r6			// shift back, and remove lower nibble
 	add	-8, r6			// remove bias for irqs
 
-	// If the IRQ index is negative, it's actually one of the exception
-	// traps below 0x80 (currently, the illegal instruction trap, and
-	// the `debug trap').  Handle these separately.
-	bn	exception
-
 	// Call the high-level interrupt handling code.
 	jarl	CSYM(handle_irq), lp
-	// fall through
 
-/* Entry point used to return from an interrupt (also used by exception
-   handlers, below).  */
-ret_from_irq:
 	RETURN(IRQ)
+END(irq)
 
-exception:
-	mov	hilo(ret_from_irq), lp	// where the handler should return
 	
-	cmp	-2, r6
-	bne	1f
-	// illegal instruction exception
-	addi	SIGILL, r0, r6		// Arg 0: signal number
-	mov	CURRENT_TASK, r7	// Arg 1: task
-	jr	CSYM(force_sig)		// tail call
+/*
+ * Debug trap / illegal-instruction exception
+ *
+ * The stack-pointer (r3) should have already been saved to the memory
+ * location ENTRY_SP (the reason for this is that the interrupt vectors may be
+ * beyond a 22-bit signed offset jump from the actual interrupt handler, and
+ * this allows them to save the stack-pointer and use that register to do an
+ * indirect jump).
+ */
+G_ENTRY(dbtrap):
+	SAVE_STATE (DBTRAP, r0, ENTRY_SP)// Save registers. 
 
-1:	cmp	-1, r6
-	bne	bad_trap_wrapper
-	// `dbtrap' exception
-	movea	PTO, sp, r6		// Arg 0: user regs
-	jr	CSYM(debug_trap)	// tail call
+	/* Look to see if the preceding instruction was is a dbtrap or not,
+	   to decide which signal we should use.  */
+	stsr	SR_DBPC, r19		// PC following trapping insn
+	ld.hu	-2[r19], r19
+	mov	SIGTRAP, r6
+	ori	0xf840, r0, r20		// DBTRAP insn
+	cmp	r19, r20		// Was this trap caused by DBTRAP?
+	cmov	ne, SIGILL, r6, r6	// Choose signal appropriately
 
-END(irq)
+	/* Raise the desired signal.  */
+	mov	CURRENT_TASK, r7	// Arg 1: task
+	jarl	CSYM(force_sig), lp	// tail call
+
+	RETURN(DBTRAP)
+END(dbtrap)
 
 
 /*
@@ -711,7 +709,7 @@
 	   Call the generic IRQ handler, with two arguments, the IRQ number,
 	   and a pointer to the user registers, to handle the specifics.
 	   (we subtract one because the first NMI has code 1).  */
-	addi	FIRST_NMI - 1, r6, r6;
+	addi	FIRST_NMI - 1, r6, r6
 	jarl	CSYM(handle_irq), lp
 
 	RETURN(NMI)
diff -Nru a/arch/v850/kernel/init_task.c b/arch/v850/kernel/init_task.c
--- a/arch/v850/kernel/init_task.c	Sun Feb 23 22:25:22 2003
+++ b/arch/v850/kernel/init_task.c	Sun Feb 23 22:25:22 2003
@@ -1,8 +1,8 @@
 /*
  * arch/v850/kernel/init_task.c -- Initial task/thread structures
  *
- *  Copyright (C) 2002  NEC Corporation
- *  Copyright (C) 2002  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2002,03  NEC Electronics Corporation
+ *  Copyright (C) 2002,03  Miles Bader <miles@gnu.org>
  *
  * This file is subject to the terms and conditions of the GNU General
  * Public License.  See the file COPYING in the main directory of this
@@ -21,6 +21,7 @@
 static struct fs_struct init_fs = INIT_FS;
 static struct files_struct init_files = INIT_FILES;
 static struct signal_struct init_signals = INIT_SIGNALS (init_signals);
+static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
 struct mm_struct init_mm = INIT_MM (init_mm);
 
 /*
diff -Nru a/arch/v850/kernel/intv.S b/arch/v850/kernel/intv.S
--- a/arch/v850/kernel/intv.S	Sun Feb 23 22:25:24 2003
+++ b/arch/v850/kernel/intv.S	Sun Feb 23 22:25:24 2003
@@ -1,8 +1,8 @@
 /*
  * arch/v850/kernel/intv.S -- Interrupt vectors
  *
- *  Copyright (C) 2001,02  NEC Corporation
- *  Copyright (C) 2001,02  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2001,02,03  NEC Electronics Corporation
+ *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
  *
  * This file is subject to the terms and conditions of the GNU General
  * Public License.  See the file COPYING in the main directory of this
@@ -40,22 +40,19 @@
 	/* Generic interrupt vectors.  */
 	.section	.intv.common, "ax"
 	.balign	0x10
-	JUMP_TO_HANDLER (nmi, NMI_ENTRY_SP)	// NMI0
+	JUMP_TO_HANDLER (nmi, NMI_ENTRY_SP)	// 0x10 - NMI0
 	.balign	0x10
-	JUMP_TO_HANDLER (nmi, NMI_ENTRY_SP)	// NMI1
+	JUMP_TO_HANDLER (nmi, NMI_ENTRY_SP)	// 0x20 - NMI1
 	.balign	0x10
-	JUMP_TO_HANDLER (nmi, NMI_ENTRY_SP)	// NMI2
+	JUMP_TO_HANDLER (nmi, NMI_ENTRY_SP)	// 0x30 - NMI2
 	
 	.balign	0x10
-	JUMP_TO_HANDLER (trap, ENTRY_SP)	// TRAP0n
+	JUMP_TO_HANDLER (trap, ENTRY_SP)	// 0x40 - TRAP0n
 	.balign	0x10
-	JUMP_TO_HANDLER (trap, ENTRY_SP)	// TRAP1n
+	JUMP_TO_HANDLER (trap, ENTRY_SP)	// 0x50 - TRAP1n
 
 	.balign	0x10
-	JUMP_TO_HANDLER (irq, ENTRY_SP)		// illegal insn trap
-
-	.balign	0x10
-	JUMP_TO_HANDLER (irq, ENTRY_SP)		// DBTRAP insn
+	JUMP_TO_HANDLER (dbtrap, ENTRY_SP)	// 0x60 - Illegal op / DBTRAP insn
 
 
 	/* Hardware interrupt vectors.  */
diff -Nru a/arch/v850/kernel/irq.c b/arch/v850/kernel/irq.c
--- a/arch/v850/kernel/irq.c	Sun Feb 23 22:25:25 2003
+++ b/arch/v850/kernel/irq.c	Sun Feb 23 22:25:25 2003
@@ -1,8 +1,8 @@
 /*
  * arch/v850/kernel/irq.c -- High-level interrupt handling
  *
- *  Copyright (C) 2001,02  NEC Corporation
- *  Copyright (C) 2001,02  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2001,02,03  NEC Corporation
+ *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
  *  Copyright (C) 1994-2000  Ralf Baechle
  *  Copyright (C) 1992  Linus Torvalds
  *
@@ -713,3 +713,9 @@
 		base_irq += interval;
 	}
 }
+
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_SYSCTL)
+void init_irq_proc(void)
+{
+}
+#endif /* CONFIG_PROC_FS && CONFIG_SYSCTL */
diff -Nru a/arch/v850/kernel/process.c b/arch/v850/kernel/process.c
--- a/arch/v850/kernel/process.c	Sun Feb 23 22:25:22 2003
+++ b/arch/v850/kernel/process.c	Sun Feb 23 22:25:22 2003
@@ -1,8 +1,8 @@
 /*
  * arch/v850/kernel/process.c -- Arch-dependent process handling
  *
- *  Copyright (C) 2001,02  NEC Corporation
- *  Copyright (C) 2001,02  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2001,02,03  NEC Corporation
+ *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
  *
  * This file is subject to the terms and conditions of the GNU General
  * Public License.  See the file COPYING in the main directory of this
@@ -75,7 +75,9 @@
 
 	set_fs (KERNEL_DS);
 
-	/* Clone this thread.  */
+	/* Clone this thread.  Note that we don't pass the clone syscall's
+	   second argument -- it's ignored for calls from kernel mode (the
+	   child's SP is always set to the top of the kernel stack).  */
 	arg0 = flags | CLONE_VM;
 	syscall = __NR_clone;
 	asm volatile ("trap " SYSCALL_SHORT_TRAP
@@ -109,7 +111,8 @@
 		 struct task_struct *p, struct pt_regs *regs)
 {
 	/* Start pushing stuff from the top of the child's kernel stack.  */
-	unsigned long ksp = (unsigned long)p->thread_info + THREAD_SIZE;
+	unsigned long orig_ksp = (unsigned long)p->thread_info + THREAD_SIZE;
+	unsigned long ksp = orig_ksp;
 	/* We push two `state save' stack fames (see entry.S) on the new
 	   kernel stack:
 	     1) The innermost one is what switch_thread would have
@@ -137,6 +140,19 @@
 	   register (r31), so we make that the place where we want to
 	   jump when the child thread begins running.  */
 	child_switch_regs->gpr[GPR_LP] = (v850_reg_t)ret_from_fork;
+
+	if (regs->kernel_mode)
+		/* Since we're returning to kernel-mode, make sure the child's
+		   stored kernel stack pointer agrees with what the actual
+		   stack pointer will be at that point (the trap return code
+		   always restores the SP, even when returning to
+		   kernel-mode).  */
+		child_trap_regs->gpr[GPR_SP] = orig_ksp;
+	else
+		/* Set the child's user-mode stack-pointer (the name
+		   `stack_start' is a misnomer, it's just the initial SP
+		   value).  */
+		child_trap_regs->gpr[GPR_SP] = stack_start;
 
 	/* Thread state for the child (everything else is on the stack).  */
 	p->thread.ksp = ksp;
diff -Nru a/arch/v850/kernel/rte_cb_multi.c b/arch/v850/kernel/rte_cb_multi.c
--- a/arch/v850/kernel/rte_cb_multi.c	Sun Feb 23 22:25:23 2003
+++ b/arch/v850/kernel/rte_cb_multi.c	Sun Feb 23 22:25:23 2003
@@ -2,8 +2,8 @@
  * include/asm-v850/rte_multi.c -- Support for Multi debugger monitor ROM
  * 	on Midas lab RTE-CB series of evaluation boards
  *
- *  Copyright (C) 2001,02  NEC Corporation
- *  Copyright (C) 2001,02  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2001,02,03  NEC Corporation
+ *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
  *
  * This file is subject to the terms and conditions of the GNU General
  * Public License.  See the file COPYING in the main directory of this
@@ -23,6 +23,9 @@
    the table.  */
 static long multi_intv_install_table[] = {
 	0x40, 0x50,		/* trap vectors */
+#ifdef CONFIG_RTE_CB_MULTI_DBTRAP
+	0x60,			/* illegal insn / dbtrap */
+#endif
 	/* Note -- illegal insn trap is used by the debugger.  */
 	0xD0, 0xE0, 0xF0,	/* GINT1 - GINT3 */
 	0x240, 0x250, 0x260, 0x270, /* timer D interrupts */
@@ -52,7 +55,7 @@
 	register unsigned long jr_fixup = (char *)&_intv_start - (char *)dst;
 	register long *ii;
 
-	/* Copy interupt vectors as instructed by multi_intv_install_table. */
+	/* Copy interrupt vectors as instructed by multi_intv_install_table. */
 	for (ii = multi_intv_install_table; *ii >= 0; ii++) {
 		/* Copy 16-byte interrupt vector at offset *ii.  */
 		int boffs;
diff -Nru a/arch/v850/kernel/signal.c b/arch/v850/kernel/signal.c
--- a/arch/v850/kernel/signal.c	Sun Feb 23 22:25:27 2003
+++ b/arch/v850/kernel/signal.c	Sun Feb 23 22:25:27 2003
@@ -1,8 +1,8 @@
 /*
  * arch/v850/kernel/signal.c -- Signal handling
  *
- *  Copyright (C) 2001,02  NEC Corporation
- *  Copyright (C) 2001,02  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2001,02,03  NEC Electronics Corporation
+ *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
  *  Copyright (C) 1999,2000,2002  Niibe Yutaka & Kaz Kojima
  *  Copyright (C) 1991,1992  Linus Torvalds
  *
@@ -434,7 +434,7 @@
 handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
 	struct pt_regs * regs)
 {
-	struct k_sigaction *ka = &current->sig->action[sig-1];
+	struct k_sigaction *ka = &current->sighand->action[sig-1];
 
 	/* Are we from a system call? */
 	if (PT_REGS_SYSCALL (regs)) {
diff -Nru a/arch/v850/vmlinux.lds.S b/arch/v850/vmlinux.lds.S
--- a/arch/v850/vmlinux.lds.S	Sun Feb 23 22:25:25 2003
+++ b/arch/v850/vmlinux.lds.S	Sun Feb 23 22:25:25 2003
@@ -24,9 +24,12 @@
 	
 /* Interrupt vectors.  */
 #define INTV_CONTENTS							      \
+		. = ALIGN (0x10) ;					      \
 		__intv_start = . ;					      \
 			*(.intv.reset)	/* Reset vector */		      \
+		. = __intv_start + 0x10 ;				      \
 			*(.intv.common)	/* Vectors common to all v850e proc */\
+		. = __intv_start + 0x80 ;				      \
 			*(.intv.mach)	/* Machine-specific int. vectors.  */ \
 		__intv_end = . ;
 
diff -Nru a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
--- a/arch/x86_64/Kconfig	Sun Feb 23 22:25:25 2003
+++ b/arch/x86_64/Kconfig	Sun Feb 23 22:25:25 2003
@@ -204,7 +204,7 @@
 # someone write a better help text please.
 config K8_NUMA
        bool "K8 NUMA support"
-       depends on SMP
+       depends on SMP && NOT_WORKING
        help
 	  Enable NUMA (Non Unified Memory Architecture) support for
 	  AMD Opteron Multiprocessor systems. The kernel will try to allocate
diff -Nru a/arch/x86_64/boot/compressed/misc.c b/arch/x86_64/boot/compressed/misc.c
--- a/arch/x86_64/boot/compressed/misc.c	Sun Feb 23 22:25:24 2003
+++ b/arch/x86_64/boot/compressed/misc.c	Sun Feb 23 22:25:24 2003
@@ -329,84 +329,46 @@
 
 void check_cpu(void)
 {
-	int res = 0;
-        int tmp, flags;
+	unsigned before, after, flags;
+	unsigned a,b,c,d;
+	int isamd; 
+
+	/* check if the CPU supports CPUID. This is done by testing if the CPU
+	   supports changing the ID bit (21) in EFLAGS. */
+	asm("pushfl ; "		
+	    "popl %0 ; "		/* get EFLAGS */	
+	    "movl  %0,%1 ; "
+	    "xorl  $(1<<21),%0 ; "	/* toggle bit 21 */ 
+	    "pushl %0 ; " 
+	    "popfl ; "
+	    "pushfl ; " 		/* get EFLAGS again */
+	    "popl %0 " : "=r" (after), "=r" (before));
+	if (before == after) 
+		error("Your CPU doesn't support CPUID.");
+
+	/* check if it supports AMD extended cpuid reporting */
+	asm("cpuid" : "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "0" (0x80000000));
+
+	if (a < 0x80000001)
+		error("Your CPU doesn't support AMD extended CPUIDs.");
+
+	/* AuthenticAMD */
+	isamd = (b == 0x68747541) && (d == 0x69746e65) && (c == 0x444d4163);
 
-	asm volatile( " \n\
-	movl $3,%%edx		# at least 386 \n\
-	pushfl			# push EFLAGS \n\
-	popl %%eax		# get EFLAGS \n\
-	movl %%eax,%%ecx		# save original EFLAGS \n\
-	xorl $0x40000,%%eax	# flip AC bit in EFLAGS \n\
-	pushl %%eax		# copy to EFLAGS \n\
-	popfl			# set EFLAGS \n\
-	pushfl			# get new EFLAGS \n\
-	popl %%eax		# put it in eax \n\
-	xorl %%ecx,%%eax		# change in flags \n\
-	andl $0x40000,%%eax	# check if AC bit changed \n\
-	je 1f \n\
-\n\
-	movl $4,%%edx		# at least 486 \n\
-	movl %%ecx,%%eax \n\
-	xorl $0x200000,%%eax	# check ID flag \n\
-	pushl %%eax \n\
-	popfl			# if we are on a straight 486DX, SX, or \n\
-	pushfl			# 487SX we can't change it \n\
-	popl %%eax \n\
-	xorl %%ecx,%%eax \n\
-	pushl %%ecx		# restore original EFLAGS \n\
-	popfl \n\
-	andl $0x200000,%%eax \n\
-	je 1f \n\
-\n\
-	/* get vendor info */ \n\
-#	xorl %%eax,%%eax			# call CPUID with 0 -> return vendor ID \n\
-#	cpuid \n\
-#	movl $5, %%edx \n\
-#	cmpl $0x41757468,%%ebx		# check thats amd \n\
-#	jne 1f \n\
-\n\
-	mov $0x80000000,%%eax		# Is extended cpuid supported?\n\
-	cpuid\n\
-	test $0x80000000,%%eax\n\
-	movl $5, %%edx \n\
-	jz 1f\n\
-\n\
-	movl $0x80000001,%%eax \n\
-	cpuid \n\
-	andl $0x20000000,%%edx \n\
-	movl $6, %%edx \n\
-	jz 1f \n\
-\n\
-	movl $7, %%edx \n\
-1:" : "=d" (res) : : "eax", "ebx", "ecx" );
-
-	switch (res) {
-	case 3: puts( "386" );
-		break;
-	case 4: puts( "486" );
-		break;
-	case 5: puts( "no extended cpuid" );
-		break;
-	case 6: puts( "non-64bit 586+" );
-		break;
-	case 7: puts( "64bit" );
-		break;
-	default:puts( "internal error" );
-		break;
-	}
-	if (res !=7)
-		error( "Sorry, your CPU is not capable of running 64-bit kernel." );
         /* check required feature flags */ 
         /* see http://www.x86-64.org/lists/discuss/msg02971.html */
 #define REQUIRED_MASK1 ((1<<0)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<8)|(1<<11)| \
                                            (1<<13)|(1<<15)|(1<<24))
         
-        asm("cpuid" : "=d" (flags), "=a" (tmp) : "1" (0x80000001) : "ebx", "ecx"); 
+	asm("cpuid" : "=d" (flags), "=a" (a) : "1" (0x80000001) : "ebx", "ecx"); 
         flags &= REQUIRED_MASK1;
         flags ^= REQUIRED_MASK1; 
+	if (flags & (1<<9)) {
+		puts("WARNING: non APIC mode for long mode kernel is untested.");
+		puts("In case of trouble use 32bit kernel or enable APIC.");
+	}
         if (flags & (1<<0))
-                error("CPU misses x87"); 
+		error("CPU misses x87 FPU"); 
         if (flags & (1<<3)) 
                 error("CPU doesn't support page size extension (PSE)");
         if (flags & (1<<4))
@@ -425,11 +387,23 @@
                 error("CPU doesn't support CMOV"); 
         if (flags & (1<<24))
                 error("CPU doesn't support FXSAVE/FXRSTOR"); 
+	if (flags & (1<<29))
+		error("CPU doesn't support long mode");
+	
+#define SSE_MASK ((1<<25)|(1<<26))	
+	asm("cpuid" : "=d" (flags), "=a" (a) : "1" (1) : "ebx", "ecx"); 
+	if ((flags & SSE_MASK) != SSE_MASK && isamd) {
+		/* Only try this on AMD CPUs. */
+		/* Enable SSE in HWCFG MSR */
+		asm volatile("rdmsr" : "=d" (d), "=a" (flags) : "c" (0xc0010015));
+		flags &= ~(1<<15);
+		asm volatile("wrmsr" :: "d" (d), "a" (flags), "c" (0xc0010015));
+	} 
 
-#define REQUIRED_MASK2 ((1<<25)|(1<<26))        
-        asm("cpuid" : "=d" (flags), "=a" (tmp) : "1" (1) : "ebx", "ecx"); 
-        flags &= REQUIRED_MASK2; 
-        flags ^= REQUIRED_MASK2; 
+	/* Try again */
+	asm("cpuid" : "=d" (flags), "=a" (a) : "1" (1) : "ebx", "ecx"); 
+	flags &= SSE_MASK;
+	flags ^= SSE_MASK;
         if (flags & (1<<25))
                 error("CPU doesn't support SSE1");
         if (flags & (1<<26))
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	Sun Feb 23 22:25:24 2003
+++ b/arch/x86_64/ia32/ia32_ioctl.c	Sun Feb 23 22:25:24 2003
@@ -3593,7 +3593,7 @@
 
 IOCTL_TABLE_START
 /* List here explicitly which ioctl's are known to have
- * compatable types passed or none at all...
+ * compatible types passed or none at all...
  */
 /* Big T */
 COMPATIBLE_IOCTL(TCGETA)
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	Sun Feb 23 22:25:24 2003
+++ b/arch/x86_64/ia32/sys_ia32.c	Sun Feb 23 22:25:24 2003
@@ -1573,7 +1573,7 @@
 	return ret;
 }
 
-/* Handle adjtimex compatability. */
+/* Handle adjtimex compatibility. */
 
 struct timex32 {
 	u32 modes;
diff -Nru a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
--- a/arch/x86_64/kernel/Makefile	Sun Feb 23 22:25:25 2003
+++ b/arch/x86_64/kernel/Makefile	Sun Feb 23 22:25:25 2003
@@ -22,8 +22,6 @@
 obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o
 obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o
 obj-$(CONFIG_MODULES) += module.o
-obj-$(CONFIG_PROFILING)         += profile.o
-
 
 $(obj)/bootflag.c: 
 	@ln -sf ../../i386/kernel/bootflag.c $(obj)/bootflag.c
diff -Nru a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
--- a/arch/x86_64/kernel/apic.c	Sun Feb 23 22:25:22 2003
+++ b/arch/x86_64/kernel/apic.c	Sun Feb 23 22:25:22 2003
@@ -37,9 +37,19 @@
 
 int dont_enable_local_apic __initdata = 0;
 
-int prof_multiplier[NR_CPUS] = { 1, };
-int prof_old_multiplier[NR_CPUS] = { 1, };
-DEFINE_PER_CPU(int, prof_counter) =  1;
+static DEFINE_PER_CPU(int, prof_multiplier) = 1;
+static DEFINE_PER_CPU(int, prof_old_multiplier) = 1;
+static DEFINE_PER_CPU(int, prof_counter) = 1;
+
+void enable_NMI_through_LVT0 (void * dummy)
+{
+	unsigned int v, ver;
+	
+	ver = apic_read(APIC_LVR);
+	ver = GET_APIC_VERSION(ver);
+	v = APIC_DM_NMI;                        /* unmask and set to NMI */
+	apic_write_around(APIC_LVT0, v);
+}
 
 int get_maxlvt(void)
 {
@@ -47,8 +57,7 @@
 
 	v = apic_read(APIC_LVR);
 	ver = GET_APIC_VERSION(v);
-	/* 82489DXs do not report # of LVT entries. */
-	maxlvt = APIC_INTEGRATED(ver) ? GET_APIC_MAXLVT(v) : 2;
+	maxlvt = GET_APIC_MAXLVT(v);
 	return maxlvt;
 }
 
@@ -878,7 +887,7 @@
 	 * accordingly.
 	 */
 	for (i = 0; i < NR_CPUS; ++i)
-		prof_multiplier[i] = multiplier;
+		per_cpu(prof_multiplier, i) = multiplier;
 
 	return 0;
 }
@@ -910,11 +919,13 @@
 		 *
 		 * Interrupts are already masked off at this point.
 		 */
-		per_cpu(prof_counter, cpu) = prof_multiplier[cpu];
-		if (per_cpu(prof_counter, cpu) != prof_old_multiplier[cpu]) {
+		per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu);
+		if (per_cpu(prof_counter, cpu) != 
+		    per_cpu(prof_old_multiplier, cpu)) {
 			__setup_APIC_LVTT(calibration_result/
 					per_cpu(prof_counter, cpu));
-			prof_old_multiplier[cpu] = per_cpu(prof_counter, cpu);
+			per_cpu(prof_old_multiplier, cpu) =
+				per_cpu(prof_counter, cpu);
 		}
 
 #ifdef CONFIG_SMP
diff -Nru a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
--- a/arch/x86_64/kernel/entry.S	Sun Feb 23 22:25:23 2003
+++ b/arch/x86_64/kernel/entry.S	Sun Feb 23 22:25:23 2003
@@ -98,9 +98,8 @@
  * A newly forked process directly context switches into this.
  */ 	
 ENTRY(ret_from_fork)
-#if CONFIG_SMP || CONFIG_PREEMPT
+	movq %rax,%rdi		/* prev task, returned by __switch_to -> arg1 */
 	call schedule_tail
-#endif		
 	GET_THREAD_INFO(%rcx)
 	bt $TIF_SYSCALL_TRACE,threadinfo_flags(%rcx)
 	jc rff_trace
@@ -115,6 +114,7 @@
 rff_trace:
 	movq %rsp,%rdi
 	call syscall_trace
+	GET_THREAD_INFO(%rcx)	
 	jmp rff_action
 
 /*
@@ -569,7 +569,7 @@
         swapgs
 gs_change:     
         movl %edi,%gs   
-2:	sfence		/* workaround */
+2:	mfence		/* workaround */
 	swapgs
         popf
         ret
diff -Nru a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
--- a/arch/x86_64/kernel/io_apic.c	Sun Feb 23 22:25:24 2003
+++ b/arch/x86_64/kernel/io_apic.c	Sun Feb 23 22:25:24 2003
@@ -703,8 +703,10 @@
 
 void __init UNEXPECTED_IO_APIC(void)
 {
+#if 0
 	printk(KERN_WARNING " WARNING: unexpected IO-APIC, please mail\n");
 	printk(KERN_WARNING "          to linux-smp@vger.kernel.org\n");
+#endif
 }
 
 void __init print_IO_APIC(void)
@@ -1297,25 +1299,25 @@
  */
 
 static struct hw_interrupt_type ioapic_edge_irq_type = {
-	"IO-APIC-edge",
-	startup_edge_ioapic_irq,
-	shutdown_edge_ioapic_irq,
-	enable_edge_ioapic_irq,
-	disable_edge_ioapic_irq,
-	ack_edge_ioapic_irq,
-	end_edge_ioapic_irq,
-	set_ioapic_affinity,
+	.typename = "IO-APIC-edge",
+	.startup = startup_edge_ioapic_irq,
+	.shutdown = shutdown_edge_ioapic_irq,
+	.enable = enable_edge_ioapic_irq,
+	.disable = disable_edge_ioapic_irq,
+	.ack = ack_edge_ioapic_irq,
+	.end = end_edge_ioapic_irq,
+	.set_affinity = set_ioapic_affinity,
 };
 
 static struct hw_interrupt_type ioapic_level_irq_type = {
-	"IO-APIC-level",
-	startup_level_ioapic_irq,
-	shutdown_level_ioapic_irq,
-	enable_level_ioapic_irq,
-	disable_level_ioapic_irq,
-	mask_and_ack_level_ioapic_irq,
-	end_level_ioapic_irq,
-	set_ioapic_affinity,
+	.typename = "IO-APIC-level",
+	.startup = startup_level_ioapic_irq,
+	.shutdown = shutdown_level_ioapic_irq,
+	.enable = enable_level_ioapic_irq,
+	.disable = disable_level_ioapic_irq,
+	.ack = mask_and_ack_level_ioapic_irq,
+	.end = end_level_ioapic_irq,
+	.set_affinity = set_ioapic_affinity,
 };
 
 static inline void init_IO_APIC_traps(void)
@@ -1373,26 +1375,14 @@
 static void end_lapic_irq (unsigned int i) { /* nothing */ }
 
 static struct hw_interrupt_type lapic_irq_type = {
-	"local-APIC-edge",
-	NULL, /* startup_irq() not used for IRQ0 */
-	NULL, /* shutdown_irq() not used for IRQ0 */
-	enable_lapic_irq,
-	disable_lapic_irq,
-	ack_lapic_irq,
-	end_lapic_irq
+	.typename = "local-APIC-edge",
+	.startup = NULL, /* startup_irq() not used for IRQ0 */
+	.shutdown = NULL, /* shutdown_irq() not used for IRQ0 */
+	.enable = enable_lapic_irq,
+	.disable = disable_lapic_irq,
+	.ack = ack_lapic_irq,
+	.end = end_lapic_irq,
 };
-
-void enable_NMI_through_LVT0 (void * dummy)
-{
-	unsigned int v, ver;
-
-	ver = apic_read(APIC_LVR);
-	ver = GET_APIC_VERSION(ver);
-	v = APIC_DM_NMI;			/* unmask and set to NMI */
-	if (!APIC_INTEGRATED(ver))		/* 82489DX */
-		v |= APIC_LVT_LEVEL_TRIGGER;
-	apic_write_around(APIC_LVT0, v);
-}
 
 static void setup_nmi (void)
 {
diff -Nru a/arch/x86_64/kernel/ioport.c b/arch/x86_64/kernel/ioport.c
--- a/arch/x86_64/kernel/ioport.c	Sun Feb 23 22:25:22 2003
+++ b/arch/x86_64/kernel/ioport.c	Sun Feb 23 22:25:22 2003
@@ -53,7 +53,7 @@
 /*
  * this changes the io permissions bitmap in the current task.
  */
-asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
+asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
 {
 	struct thread_struct * t = &current->thread;
 	struct tss_struct * tss;
diff -Nru a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
--- a/arch/x86_64/kernel/mpparse.c	Sun Feb 23 22:25:23 2003
+++ b/arch/x86_64/kernel/mpparse.c	Sun Feb 23 22:25:23 2003
@@ -105,21 +105,12 @@
 	if (!(m->mpc_cpuflag & CPU_ENABLED))
 		return;
 
-	printk("Processor #%d %d:%d APIC version %d\n",
+	printk(KERN_INFO "Processor #%d %d:%d APIC version %d\n",
 		m->mpc_apicid,
 	       (m->mpc_cpufeature & CPU_FAMILY_MASK)>>8,
 	       (m->mpc_cpufeature & CPU_MODEL_MASK)>>4,
 		m->mpc_apicver);
 
-	if (m->mpc_featureflag&(1<<0))
-		Dprintk("    Floating point unit present.\n");
-	if (m->mpc_featureflag&(1<<7))
-		Dprintk("    Machine Exception supported.\n");
-	if (m->mpc_featureflag&(1<<8))
-		Dprintk("    64 bit compare & exchange supported.\n");
-	if (m->mpc_featureflag&(1<<9))
-		Dprintk("    Internal APIC present.\n");
-
 	if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) {
 		Dprintk("    Bootup CPU\n");
 		boot_cpu_id = m->mpc_apicid;
@@ -127,7 +118,7 @@
 	num_processors++;
 
 	if (m->mpc_apicid > MAX_APICS) {
-		printk("Processor #%d INVALID. (Max ID: %d).\n",
+		printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n",
 			m->mpc_apicid, MAX_APICS);
 		return;
 	}
@@ -138,7 +129,7 @@
 	 * Validate version
 	 */
 	if (ver == 0x0) {
-		printk("BIOS bug, APIC version is 0 for CPU#%d! fixing up to 0x10. (tell your hw vendor)\n", m->mpc_apicid);
+		printk(KERN_ERR "BIOS bug, APIC version is 0 for CPU#%d! fixing up to 0x10. (tell your hw vendor)\n", m->mpc_apicid);
 		ver = 0x10;
 	}
 	apic_version[m->mpc_apicid] = ver;
@@ -163,8 +154,7 @@
 	} else if (strncmp(str, "MCA", 3) == 0) {
 		mp_bus_id_to_type[m->mpc_busid] = MP_BUS_MCA;
 	} else {
-		printk("Unknown bustype %s\n", str);
-		panic("cannot handle bus - mail to linux-smp@vger.kernel.org");
+		printk(KERN_ERR "Unknown bustype %s\n", str);
 	}
 }
 
@@ -176,7 +166,7 @@
 	printk("I/O APIC #%d Version %d at 0x%X.\n",
 		m->mpc_apicid, m->mpc_apicver, m->mpc_apicaddr);
 	if (nr_ioapics >= MAX_IO_APICS) {
-		printk("Max # of I/O APICs (%d) exceeded (found %d).\n",
+		printk(KERN_ERR "Max # of I/O APICs (%d) exceeded (found %d).\n",
 			MAX_IO_APICS, nr_ioapics);
 		panic("Recompile kernel with bigger MAX_IO_APICS!.\n");
 	}
@@ -256,13 +246,13 @@
 	}
 	memcpy(str,mpc->mpc_oem,8);
 	str[8]=0;
-	printk("OEM ID: %s ",str);
+	printk(KERN_INFO "OEM ID: %s ",str);
 
 	memcpy(str,mpc->mpc_productid,12);
 	str[12]=0;
-	printk("Product ID: %s ",str);
+	printk(KERN_INFO "Product ID: %s ",str);
 
-	printk("APIC at: 0x%X\n",mpc->mpc_lapic);
+	printk(KERN_INFO "APIC at: 0x%X\n",mpc->mpc_lapic);
 
 	/* save the local APIC address, it might be non-default */
 	if (!acpi_lapic)
@@ -357,12 +347,12 @@
 	 *  If it does, we assume it's valid.
 	 */
 	if (mpc_default_type == 5) {
-		printk("ISA/PCI bus type with no IRQ information... falling back to ELCR\n");
+		printk(KERN_INFO "ISA/PCI bus type with no IRQ information... falling back to ELCR\n");
 
 		if (ELCR_trigger(0) || ELCR_trigger(1) || ELCR_trigger(2) || ELCR_trigger(13))
-			printk("ELCR contains invalid data... not using ELCR\n");
+			printk(KERN_ERR "ELCR contains invalid data... not using ELCR\n");
 		else {
-			printk("Using ELCR to identify PCI interrupts\n");
+			printk(KERN_INFO "Using ELCR to identify PCI interrupts\n");
 			ELCR_fallback = 1;
 		}
 	}
@@ -437,7 +427,7 @@
 	bus.mpc_busid = 0;
 	switch (mpc_default_type) {
 		default:
-			printk("???\nUnknown standard configuration %d\n",
+			printk(KERN_ERR "???\nUnknown standard configuration %d\n",
 				mpc_default_type);
 			/* fall through */
 		case 1:
@@ -508,10 +498,10 @@
 
 	printk("Intel MultiProcessor Specification v1.%d\n", mpf->mpf_specification);
 	if (mpf->mpf_feature2 & (1<<7)) {
-		printk("    IMCR and PIC compatibility mode.\n");
+		printk(KERN_INFO "    IMCR and PIC compatibility mode.\n");
 		pic_mode = 1;
 	} else {
-		printk("    Virtual Wire compatibility mode.\n");
+		printk(KERN_INFO "    Virtual Wire compatibility mode.\n");
 		pic_mode = 0;
 	}
 
@@ -520,7 +510,7 @@
 	 */
 	if (mpf->mpf_feature1 != 0) {
 
-		printk("Default MP configuration #%d\n", mpf->mpf_feature1);
+		printk(KERN_INFO "Default MP configuration #%d\n", mpf->mpf_feature1);
 		construct_default_ISA_mptable(mpf->mpf_feature1);
 
 	} else if (mpf->mpf_physptr) {
@@ -543,7 +533,7 @@
 		if (!mp_irq_entries) {
 			struct mpc_config_bus bus;
 
-			printk("BIOS bug, no explicit IRQ entries, using default mptable. (tell your hw vendor)\n");
+			printk(KERN_ERR "BIOS bug, no explicit IRQ entries, using default mptable. (tell your hw vendor)\n");
 
 			bus.mpc_type = MP_BUS;
 			bus.mpc_busid = 0;
@@ -556,7 +546,7 @@
 	} else
 		BUG();
 
-	printk("Processors: %d\n", num_processors);
+	printk(KERN_INFO "Processors: %d\n", num_processors);
 	/*
 	 * Only use the first configuration found.
 	 */
@@ -564,12 +554,13 @@
 
 static int __init smp_scan_config (unsigned long base, unsigned long length)
 {
+	extern void __bad_mpf_size(void); 
 	unsigned int *bp = phys_to_virt(base);
 	struct intel_mp_floating *mpf;
 
 	Dprintk("Scan SMP from %p for %ld bytes.\n", bp,length);
 	if (sizeof(*mpf) != 16)
-		printk("Error: MPF size\n");
+		__bad_mpf_size();
 
 	while (length > 0) {
 		mpf = (struct intel_mp_floating *)bp;
@@ -580,7 +571,7 @@
 				|| (mpf->mpf_specification == 4)) ) {
 
 			smp_found_config = 1;
-			printk("found SMP MP-table at %08lx\n",
+			printk(KERN_INFO "found SMP MP-table at %08lx\n",
 						virt_to_phys(mpf));
 			reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE);
 			if (mpf->mpf_physptr)
@@ -628,8 +619,6 @@
 	address = *(unsigned short *)phys_to_virt(0x40E);
 	address <<= 4;
 	smp_scan_config(address, 0x1000);
-	if (smp_found_config)
-		printk(KERN_WARNING "WARNING: MP table in the EBDA can be UNSAFE, contact linux-smp@vger.kernel.org if you experience SMP problems!\n");
 }
 
 /*
@@ -761,7 +750,7 @@
 	mp_ioapic_routing[idx].irq_end = irq_base + 
 		io_apic_get_redir_entries(idx);
 
-	printk("IOAPIC[%d]: apic_id %d, version %d, address 0x%x, "
+	printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, "
 		"IRQ %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, 
 		mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr,
 		mp_ioapic_routing[idx].irq_start,
diff -Nru a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
--- a/arch/x86_64/kernel/nmi.c	Sun Feb 23 22:25:24 2003
+++ b/arch/x86_64/kernel/nmi.c	Sun Feb 23 22:25:24 2003
@@ -300,11 +300,11 @@
  
 asmlinkage void do_nmi(struct pt_regs * regs, long error_code)
 {
-	int cpu;
+	int cpu = safe_smp_processor_id();
 
-	nmi_enter();
+	init_tss[cpu].ist[NMI_STACK] -= 2048;	/* this shouldn't be needed. */	
 
-	cpu = smp_processor_id(); 
+	nmi_enter();
 
 	add_pda(__nmi_count,1);
 
@@ -312,6 +312,8 @@
 		default_do_nmi(regs);
 	
 	nmi_exit();
+
+	init_tss[cpu].ist[NMI_STACK] += 2048;
 }
 
 void set_nmi_callback(nmi_callback_t callback)
diff -Nru a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
--- a/arch/x86_64/kernel/process.c	Sun Feb 23 22:25:24 2003
+++ b/arch/x86_64/kernel/process.c	Sun Feb 23 22:25:24 2003
@@ -328,7 +328,7 @@
  * - fold all the options into a flag word and test it with a single test.
  * - could test fs/gs bitsliced
  */
-void __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+struct task_struct *__switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 {
 	struct thread_struct *prev = &prev_p->thread,
 				 *next = &next_p->thread;
@@ -439,6 +439,8 @@
 			tss->io_map_base = INVALID_IO_BITMAP_OFFSET;
 		}
 	}
+
+	return prev_p;
 }
 
 /*
diff -Nru a/arch/x86_64/kernel/profile.c b/arch/x86_64/kernel/profile.c
--- a/arch/x86_64/kernel/profile.c	Sun Feb 23 22:25:24 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,45 +0,0 @@
-/*
- *	linux/arch/x86_64/kernel/profile.c
- *
- *	(C) 2002 John Levon <levon@movementarian.org>
- *
- */
-
-#include <linux/profile.h>
-#include <linux/spinlock.h>
-#include <linux/notifier.h>
-#include <linux/irq.h>
-#include <asm/hw_irq.h> 
- 
-static struct notifier_block * profile_listeners;
-static rwlock_t profile_lock = RW_LOCK_UNLOCKED;
- 
-int register_profile_notifier(struct notifier_block * nb)
-{
-	int err;
-	write_lock_irq(&profile_lock);
-	err = notifier_chain_register(&profile_listeners, nb);
-	write_unlock_irq(&profile_lock);
-	return err;
-}
-
-
-int unregister_profile_notifier(struct notifier_block * nb)
-{
-	int err;
-	write_lock_irq(&profile_lock);
-	err = notifier_chain_unregister(&profile_listeners, nb);
-	write_unlock_irq(&profile_lock);
-	return err;
-}
-
-
-void x86_profile_hook(struct pt_regs * regs)
-{
-	/* we would not even need this lock if
-	 * we had a global cli() on register/unregister
-	 */ 
-	read_lock(&profile_lock);
-	notifier_call_chain(&profile_listeners, 0, regs);
-	read_unlock(&profile_lock);
-}
diff -Nru a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c
--- a/arch/x86_64/kernel/ptrace.c	Sun Feb 23 22:25:23 2003
+++ b/arch/x86_64/kernel/ptrace.c	Sun Feb 23 22:25:23 2003
@@ -459,11 +459,8 @@
 	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();
+	ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
+				? 0x80 : 0));
 	/*
 	 * this isn't the same as continuing with a signal, but it will do
 	 * for normal use.  strace only continues with a signal if the
diff -Nru a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
--- a/arch/x86_64/kernel/setup.c	Sun Feb 23 22:25:21 2003
+++ b/arch/x86_64/kernel/setup.c	Sun Feb 23 22:25:21 2003
@@ -88,8 +88,6 @@
 extern int root_mountflags;
 extern char _text, _etext, _edata, _end;
 
-static int disable_x86_fxsr __initdata = 0;
-
 char command_line[COMMAND_LINE_SIZE];
 char saved_command_line[COMMAND_LINE_SIZE];
 
@@ -387,18 +385,6 @@
 #endif
 }
 
-#ifndef CONFIG_X86_TSC
-static int tsc_disable __initdata = 0;
-
-static int __init tsc_setup(char *str)
-{
-	tsc_disable = 1;
-	return 1;
-}
-
-__setup("notsc", tsc_setup);
-#endif
-
 static int __init get_model_name(struct cpuinfo_x86 *c)
 {
 	unsigned int *v;
@@ -417,25 +403,36 @@
 
 static void __init display_cacheinfo(struct cpuinfo_x86 *c)
 {
-	unsigned int n, dummy, ecx, edx;
+	unsigned int n, dummy, eax, ebx, ecx, edx;
 
 	n = cpuid_eax(0x80000000);
 
 	if (n >= 0x80000005) {
-		cpuid(0x80000005, &dummy, &dummy, &ecx, &edx);
+		cpuid(0x80000005, &dummy, &ebx, &ecx, &edx);
 		printk(KERN_INFO "CPU: L1 I Cache: %dK (%d bytes/line), D cache %dK (%d bytes/line)\n",
 			edx>>24, edx&0xFF, ecx>>24, ecx&0xFF);
-		c->x86_cache_size=(ecx>>24)+(edx>>24);	
+		c->x86_cache_size = (ecx>>24)+(edx>>24);
+		/* DTLB and ITLB together, but only 4K */
+		c->x86_tlbsize = ((ebx >> 16) & 0xff) + (ebx & 0xff);
 	}
 
-	if (n < 0x80000006)
-		return;
-
+	if (n >= 0x80000006) {
+		cpuid(0x80000006, &dummy, &ebx, &ecx, &edx);
 	ecx = cpuid_ecx(0x80000006);
 	c->x86_cache_size = ecx >> 16;
+		c->x86_tlbsize += ((ebx >> 16) & 0xff) + (ebx & 0xff);
 
 	printk(KERN_INFO "CPU: L2 Cache: %dK (%d bytes/line)\n",
 		c->x86_cache_size, ecx & 0xFF);
+	}
+
+	if (n >= 0x80000007)
+		cpuid(0x80000007, &dummy, &dummy, &dummy, &c->x86_power); 
+	if (n >= 0x80000008) {
+		cpuid(0x80000008, &eax, &dummy, &dummy, &dummy); 
+		c->x86_virt_bits = (eax >> 8) & 0xff;
+		c->x86_phys_bits = eax & 0xff;
+	}
 }
 
 
@@ -478,15 +475,6 @@
 	char *model_names[16];
 };
 
-int __init x86_fxsr_setup(char * s)
-{
-	disable_x86_fxsr = 1;
-	return 1;
-}
-__setup("nofxsr", x86_fxsr_setup);
-
-
-
 /*
  * This does the hard work of actually picking apart the CPU stuff...
  */
@@ -514,13 +502,17 @@
 	/* Note that the vendor-specific code below might override */
 
 	/* Intel-defined flags: level 0x00000001 */
-	if ( c->cpuid_level >= 0x00000001 ) {
+	if (c->cpuid_level >= 0x00000001) {
 		__u32 misc;
 		cpuid(0x00000001, &tfms, &misc, &junk,
 		      &c->x86_capability[0]);
-		c->x86 = (tfms >> 8) & 15;
-		c->x86_model = (tfms >> 4) & 15;
-		c->x86_mask = tfms & 15;
+		c->x86 = (tfms >> 8) & 0xf;
+		c->x86_model = (tfms >> 4) & 0xf;
+		c->x86_mask = tfms & 0xf;
+		if (c->x86 == 0xf) {
+			c->x86 += (tfms >> 20) & 0xff;
+			c->x86_model += ((tfms >> 16) & 0xF) << 4;
+		} 
 		if (c->x86_capability[0] & (1<<19)) 
        		c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
 	} else {
@@ -567,37 +559,6 @@
 			break;
 	}
 	
-	printk(KERN_DEBUG "CPU: After vendor init, caps: %08x %08x %08x %08x\n",
-	       c->x86_capability[0],
-	       c->x86_capability[1],
-	       c->x86_capability[2],
-	       c->x86_capability[3]);
-
-	/*
-	 * The vendor-specific functions might have changed features.  Now
-	 * we do "generic changes."
-	 */
-
-	/* TSC disabled? */
-#ifndef CONFIG_X86_TSC
-	if ( tsc_disable )
-		clear_bit(X86_FEATURE_TSC, &c->x86_capability);
-#endif
-
-	/* FXSR disabled? */
-	if (disable_x86_fxsr) {
-		clear_bit(X86_FEATURE_FXSR, &c->x86_capability);
-		clear_bit(X86_FEATURE_XMM, &c->x86_capability);
-	}
-
-	/* Now the feature flags better reflect actual CPU features! */
-
-	printk(KERN_DEBUG "CPU:     After generic, caps: %08x %08x %08x %08x\n",
-	       c->x86_capability[0],
-	       c->x86_capability[1],
-	       c->x86_capability[2],
-	       c->x86_capability[3]);
-
 	/*
 	 * On SMP, boot_cpu_data holds the common feature set between
 	 * all CPUs; so make sure that we indicate which features are
@@ -665,6 +626,13 @@
 		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 	};
+	static char *x86_power_flags[] = { 
+		"ts",	/* temperature sensor */
+		"fid",  /* frequency id control */
+		"vid",  /* voltage id control */
+		"ttp",  /* thermal trip */
+	};
+
 
 #ifdef CONFIG_SMP
 	if (!(cpu_online_map & (1<<(c-cpu_data))))
@@ -712,9 +680,30 @@
 				seq_printf(m, " %s", x86_cap_flags[i]);
 	}
 		
-	seq_printf(m, "\nbogomips\t: %lu.%02lu\n\n",
+	seq_printf(m, "\nbogomips\t: %lu.%02lu\n",
 		   c->loops_per_jiffy/(500000/HZ),
 		   (c->loops_per_jiffy/(5000/HZ)) % 100);
+
+	if (c->x86_tlbsize > 0) 
+		seq_printf(m, "TLB size\t: %d 4K pages\n", c->x86_tlbsize);
+	seq_printf(m, "clflush size\t: %d\n", c->x86_clflush_size);
+
+	seq_printf(m, "address sizes\t: %u bits physical, %u bits virtual\n", 
+		   c->x86_phys_bits, c->x86_virt_bits);
+
+	seq_printf(m, "power management:");
+	{
+		int i;
+		for (i = 0; i < 32; i++) 
+			if (c->x86_power & (1 << i)) {
+				if (i < ARRAY_SIZE(x86_power_flags))
+					seq_printf(m, " %s", x86_power_flags[i]);
+				else
+					seq_printf(m, " [%d]", i);
+			}
+	}
+
+	seq_printf(m, "\n\n"); 
 
 	return 0;
 }
diff -Nru a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
--- a/arch/x86_64/kernel/setup64.c	Sun Feb 23 22:25:22 2003
+++ b/arch/x86_64/kernel/setup64.c	Sun Feb 23 22:25:22 2003
@@ -99,7 +99,7 @@
 	pda->irqcount = -1;
 	pda->cpudata_offset = 0;
 	pda->kernelstack = 
-		(unsigned long)current_thread_info() - PDA_STACKOFFSET + THREAD_SIZE; 
+		(unsigned long)stack_thread_info() - PDA_STACKOFFSET + THREAD_SIZE; 
 
 	if (cpu == 0) {
 		/* others are initialized in smpboot.c */
diff -Nru a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c
--- a/arch/x86_64/kernel/smp.c	Sun Feb 23 22:25:22 2003
+++ b/arch/x86_64/kernel/smp.c	Sun Feb 23 22:25:22 2003
@@ -344,9 +344,11 @@
 
 void flush_tlb_all(void)
 {
+	preempt_disable();
 	smp_call_function (flush_tlb_all_ipi,0,1,1);
 
 	do_flush_tlb_all_local();
+	preempt_enable();
 }
 
 void smp_kdb_stop(void)
diff -Nru a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
--- a/arch/x86_64/kernel/smpboot.c	Sun Feb 23 22:25:27 2003
+++ b/arch/x86_64/kernel/smpboot.c	Sun Feb 23 22:25:27 2003
@@ -127,7 +127,7 @@
 	int buggy = 0;
 	extern unsigned cpu_khz;
 
-	printk("checking TSC synchronization across %u CPUs: ",num_booting_cpus());
+	printk(KERN_INFO "checking TSC synchronization across %u CPUs: ",num_booting_cpus());
 
 	one_usec = cpu_khz; 
 
@@ -262,9 +262,8 @@
 	phys_id = GET_APIC_ID(apic_read(APIC_ID));
 	cpuid = smp_processor_id();
 	if (test_and_set_bit(cpuid, &cpu_callin_map)) {
-		printk("huh, phys CPU#%d, CPU#%d already present??\n",
+		panic("smp_callin: phys CPU#%d, CPU#%d already present??\n",
 					phys_id, cpuid);
-		BUG();
 	}
 	Dprintk("CPU#%d (phys ID: %d) waiting for CALLOUT\n", cpuid, phys_id);
 
@@ -290,9 +289,8 @@
 	}
 
 	if (!time_before(jiffies, timeout)) {
-		printk("BUG: CPU%d started up but did not get a callout!\n",
+		panic("smp_callin: CPU%d started up but did not get a callout!\n",
 			cpuid);
-		BUG();
 	}
 
 	/*
@@ -429,7 +427,7 @@
 	char *names[] = { "ID", "VERSION", "SPIV" };
 	int timeout, status;
 
-	printk("Inquiring remote APIC #%d...\n", apicid);
+	printk(KERN_INFO "Inquiring remote APIC #%d...\n", apicid);
 
 	for (i = 0; i < sizeof(regs) / sizeof(*regs); i++) {
 		printk("... APIC #%d %s: ", apicid, names[i]);
@@ -576,9 +574,9 @@
 	Dprintk("After Startup.\n");
 
 	if (send_status)
-		printk("APIC never delivered???\n");
+		printk(KERN_ERR "APIC never delivered???\n");
 	if (accept_status)
-		printk("APIC delivery error (%lx).\n", accept_status);
+		printk(KERN_ERR "APIC delivery error (%lx).\n", accept_status);
 
 	return (send_status | accept_status);
 }
@@ -621,7 +619,7 @@
 	init_tss[cpu].rsp0 = init_rsp;
 	initial_code = initialize_secondary;
 
-	printk("Booting processor %d/%d rip %lx rsp %lx rsp2 %lx\n", cpu, apicid, 
+	printk(KERN_INFO "Booting processor %d/%d rip %lx rsp %lx rsp2 %lx\n", cpu, apicid, 
 	       start_rip, idle->thread.rsp, init_rsp);
 
 	/*
@@ -680,7 +678,7 @@
 		if (test_bit(cpu, &cpu_callin_map)) {
 			/* number CPUs logically, starting from 1 (BSP is 0) */
 			Dprintk("OK.\n");
-			printk("CPU%d: ", cpu);
+			printk("KERN_INFO CPU%d: ", cpu);
 			print_cpu_info(&cpu_data[cpu]);
 			Dprintk("CPU has booted.\n");
 		} else {
@@ -744,10 +742,10 @@
 
 	cache_decay_ticks = (long)cacheflush_time/cpu_khz * HZ / 1000;
 
-	printk("per-CPU timeslice cutoff: %ld.%02ld usecs.\n",
+	printk(KERN_INFO "per-CPU timeslice cutoff: %ld.%02ld usecs.\n",
 		(long)cacheflush_time/(cpu_khz/1000),
 		((long)cacheflush_time*100/(cpu_khz/1000)) % 100);
-	printk("task migration cache decay timeout: %ld msecs.\n",
+	printk(KERN_INFO "task migration cache decay timeout: %ld msecs.\n",
 		(cache_decay_ticks + 1) * 1000 / HZ);
 }
 
@@ -763,7 +761,7 @@
 	 * Setup boot CPU information
 	 */
 	smp_store_cpu_info(0); /* Final full version of the data */
-	printk("CPU%d: ", 0);
+	printk(KERN_INFO "CPU%d: ", 0);
 	print_cpu_info(&cpu_data[0]);
 
 	current_thread_info()->cpu = 0;
@@ -795,7 +793,7 @@
 	 * CPU too, but we do it for the sake of robustness anyway.
 	 */
 	if (!test_bit(boot_cpu_id, &phys_cpu_present_map)) {
-		printk("weird, boot CPU (#%d) not listed by the BIOS.\n",
+		printk(KERN_NOTICE "weird, boot CPU (#%d) not listed by the BIOS.\n",
 								 boot_cpu_id);
 		phys_cpu_present_map |= (1 << hard_smp_processor_id());
 	}
diff -Nru a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
--- a/arch/x86_64/kernel/time.c	Sun Feb 23 22:25:25 2003
+++ b/arch/x86_64/kernel/time.c	Sun Feb 23 22:25:25 2003
@@ -123,6 +123,7 @@
 	time_esterror = NTP_PHASE_LIMIT;
 
 	write_sequnlock_irq(&xtime_lock);
+	clock_was_set();
 }
 
 /*
diff -Nru a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c
--- a/arch/x86_64/kernel/vsyscall.c	Sun Feb 23 22:25:25 2003
+++ b/arch/x86_64/kernel/vsyscall.c	Sun Feb 23 22:25:25 2003
@@ -51,13 +51,14 @@
 #include <asm/errno.h>
 
 #define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr)))
+#define force_inline __attribute__((always_inline)) inline
 
 int __sysctl_vsyscall __section_sysctl_vsyscall = 1;
 seqlock_t __xtime_lock __section_xtime_lock = SEQLOCK_UNLOCKED;
 
 #include <asm/unistd.h>
 
-static inline void timeval_normalize(struct timeval * tv)
+static force_inline void timeval_normalize(struct timeval * tv)
 {
 	time_t __sec;
 
@@ -69,7 +70,7 @@
 	}
 }
 
-static inline void do_vgettimeofday(struct timeval * tv)
+static force_inline void do_vgettimeofday(struct timeval * tv)
 {
 	long sequence, t;
 	unsigned long sec, usec;
@@ -80,7 +81,7 @@
 		sync_core();
 		rdtscll(t);
 		sec = __xtime.tv_sec;
-		usec = (__xtime.tv_nsec * 1000) +
+		usec = (__xtime.tv_nsec / 1000) +
 			(__jiffies - __wall_jiffies) * (1000000 / HZ) +
 			(t  - __hpet.last_tsc) * (1000000 / HZ) / __hpet.ticks + __hpet.offset;
 
@@ -91,12 +92,12 @@
 }
 
 /* RED-PEN may want to readd seq locking, but then the variable should be write-once. */
-static inline void do_get_tz(struct timezone * tz)
+static force_inline void do_get_tz(struct timezone * tz)
 {
 		*tz = __sys_tz;
 }
 
-static inline int gettimeofday(struct timeval *tv, struct timezone *tz)
+static force_inline int gettimeofday(struct timeval *tv, struct timezone *tz)
 {
 	int ret;
 	asm volatile("syscall" 
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	Sun Feb 23 22:25:22 2003
+++ b/arch/x86_64/kernel/x8664_ksyms.c	Sun Feb 23 22:25:22 2003
@@ -29,6 +29,7 @@
 #include <asm/nmi.h>
 #include <asm/kdebug.h>
 #include <asm/unistd.h>
+#include <asm/delay.h>
 
 extern spinlock_t rtc_lock;
 
@@ -71,6 +72,7 @@
 EXPORT_SYMBOL(csum_partial_copy_nocheck);
 /* Delay loops */
 EXPORT_SYMBOL(__udelay);
+EXPORT_SYMBOL(__ndelay);
 EXPORT_SYMBOL(__delay);
 EXPORT_SYMBOL(__const_udelay);
 
@@ -132,8 +134,6 @@
 
 EXPORT_SYMBOL(rtc_lock);
 
-EXPORT_SYMBOL_GPL(register_profile_notifier);
-EXPORT_SYMBOL_GPL(unregister_profile_notifier);
 EXPORT_SYMBOL_GPL(set_nmi_callback);
 EXPORT_SYMBOL_GPL(unset_nmi_callback);
 
diff -Nru a/arch/x86_64/lib/delay.c b/arch/x86_64/lib/delay.c
--- a/arch/x86_64/lib/delay.c	Sun Feb 23 22:25:23 2003
+++ b/arch/x86_64/lib/delay.c	Sun Feb 23 22:25:23 2003
@@ -1,5 +1,5 @@
 /*
- *	Precise Delay Loops for i386
+ *	Precise Delay Loops for x86-64
  *
  *	Copyright (C) 1993 Linus Torvalds
  *	Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
@@ -42,4 +42,9 @@
 void __udelay(unsigned long usecs)
 {
 	__const_udelay(usecs * 0x000010c6);  /* 2**32 / 1000000 */
+}
+
+void __ndelay(unsigned long nsecs)
+{
+	__const_udelay(nsecs * 0x00005);  /* 2**32 / 1000000000 (rounded up) */
 }
diff -Nru a/arch/x86_64/mm/Makefile b/arch/x86_64/mm/Makefile
--- a/arch/x86_64/mm/Makefile	Sun Feb 23 22:25:25 2003
+++ b/arch/x86_64/mm/Makefile	Sun Feb 23 22:25:25 2003
@@ -6,3 +6,8 @@
 obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
 obj-$(CONFIG_DISCONTIGMEM) += numa.o
 obj-$(CONFIG_K8_NUMA) += k8topology.o
+
+$(obj)/hugetlbpage.c: 
+	@ln -sf ../../i386/mm/hugetlbpage.c $(obj)/hugetlbpage.c
+
+clean-files += hugetlbpage.c
diff -Nru a/arch/x86_64/mm/hugetlbpage.c b/arch/x86_64/mm/hugetlbpage.c
--- a/arch/x86_64/mm/hugetlbpage.c	Sun Feb 23 22:25:24 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,403 +0,0 @@
-/*
- * x86-64 Huge TLB Page Support for Kernel.
- *
- * Copyright (C) 2002, Rohit Seth <rohit.seth@intel.com>
- * Minor hacks by Andi Kleen for x86-64
- */
-
-#include <linux/config.h>
-#include <linux/init.h>
-#include <linux/fs.h>
-#include <linux/mm.h>
-#include <linux/hugetlb.h>
-#include <linux/pagemap.h>
-#include <linux/smp_lock.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/err.h>
-#include <linux/sysctl.h>
-#include <asm/mman.h>
-#include <asm/pgalloc.h>
-#include <asm/tlb.h>
-#include <asm/tlbflush.h>
-
-static long    htlbpagemem;
-int     htlbpage_max;
-static long    htlbzone_pages;
-
-static LIST_HEAD(htlbpage_freelist);
-static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED;
-
-static struct page *alloc_hugetlb_page(void)
-{
-	int i;
-	struct page *page;
-
-	spin_lock(&htlbpage_lock);
-	if (list_empty(&htlbpage_freelist)) {
-		spin_unlock(&htlbpage_lock);
-		return NULL;
-	}
-
-	page = list_entry(htlbpage_freelist.next, struct page, list);
-	list_del(&page->list);
-	htlbpagemem--;
-	spin_unlock(&htlbpage_lock);
-	set_page_count(page, 1);
-	for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)
-		clear_highpage(&page[i]);
-	return page;
-}
-
-static pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
-{
-	pgd_t *pgd;
-	pmd_t *pmd = NULL;
-
-	pgd = pgd_offset(mm, addr);
-	pmd = pmd_alloc(mm, pgd, addr);
-	return (pte_t *) pmd;
-}
-
-static pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
-{
-	pgd_t *pgd;
-	pmd_t *pmd = NULL;
-
-	pgd = pgd_offset(mm, addr);
-	pmd = pmd_offset(pgd, addr);
-	return (pte_t *) pmd;
-}
-
-#define mk_pte_huge(entry) {pte_val(entry) |= (_PAGE_PRESENT | _PAGE_PSE);}
-
-static void set_huge_pte(struct mm_struct *mm, struct vm_area_struct *vma, struct page *page, pte_t * page_table, int write_access)
-{
-	pte_t entry;
-
-	mm->rss += (HPAGE_SIZE / PAGE_SIZE);
-	if (write_access) {
-		entry =
-		    pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot)));
-	} else
-		entry = pte_wrprotect(mk_pte(page, vma->vm_page_prot));
-	entry = pte_mkyoung(entry);
-	mk_pte_huge(entry);
-	set_pte(page_table, entry);
-}
-
-/*
- * This function checks for proper alignment of input addr and len parameters.
- */
-int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
-{
-	if (len & ~HPAGE_MASK)
-		return -EINVAL;
-	if (addr & ~HPAGE_MASK)
-		return -EINVAL;
-	return 0;
-}
-
-int
-copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
-			struct vm_area_struct *vma)
-{
-	pte_t *src_pte, *dst_pte, entry;
-	struct page *ptepage;
-	unsigned long addr = vma->vm_start;
-	unsigned long end = vma->vm_end;
-
-	while (addr < end) {
-		dst_pte = huge_pte_alloc(dst, addr);
-		if (!dst_pte)
-			goto nomem;
-		src_pte = huge_pte_offset(src, addr);
-		entry = *src_pte;
-		ptepage = pte_page(entry);
-		get_page(ptepage);
-		set_pte(dst_pte, entry);
-		dst->rss += (HPAGE_SIZE / PAGE_SIZE);
-		addr += HPAGE_SIZE;
-	}
-	return 0;
-
-nomem:
-	return -ENOMEM;
-}
-
-int
-follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
-		    struct page **pages, struct vm_area_struct **vmas,
-		    unsigned long *st, int *length, int i)
-{
-	pte_t *ptep, pte;
-	unsigned long start = *st;
-	unsigned long pstart;
-	int len = *length;
-	struct page *page;
-
-	do {
-		pstart = start;
-		ptep = huge_pte_offset(mm, start);
-		pte = *ptep;
-
-back1:
-		page = pte_page(pte);
-		if (pages) {
-			page += ((start & ~HPAGE_MASK) >> PAGE_SHIFT);
-			get_page(page);
-			pages[i] = page;
-		}
-		if (vmas)
-			vmas[i] = vma;
-		i++;
-		len--;
-		start += PAGE_SIZE;
-		if (((start & HPAGE_MASK) == pstart) && len &&
-				(start < vma->vm_end))
-			goto back1;
-	} while (len && start < vma->vm_end);
-	*length = len;
-	*st = start;
-	return i;
-}
-
-struct page *
-follow_huge_addr(struct mm_struct *mm,
-	struct vm_area_struct *vma, unsigned long address, int write)
-{
-	return NULL;
-}
-
-struct vm_area_struct *hugepage_vma(struct mm_struct *mm, unsigned long addr)
-{
-	return NULL;
-}
-
-int pmd_huge(pmd_t pmd)
-{
-	return !!(pmd_val(pmd) & _PAGE_PSE);
-}
-
-struct page *
-follow_huge_pmd(struct mm_struct *mm, unsigned long address,
-		pmd_t *pmd, int write)
-{
-	struct page *page;
-
-	page = pte_page(*(pte_t *)pmd);
-	if (page) {
-		page += ((address & ~HPAGE_MASK) >> PAGE_SHIFT);
-		get_page(page);
-	}
-	return page;
-}
-
-void free_huge_page(struct page *page)
-{
-	BUG_ON(page_count(page));
-	BUG_ON(page->mapping);
-
-	INIT_LIST_HEAD(&page->list);
-
-	spin_lock(&htlbpage_lock);
-	list_add(&page->list, &htlbpage_freelist);
-	htlbpagemem++;
-	spin_unlock(&htlbpage_lock);
-}
-
-void huge_page_release(struct page *page)
-{
-	if (!put_page_testzero(page))
-		return;
-
-	free_huge_page(page);
-}
-
-void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
-{
-	struct mm_struct *mm = vma->vm_mm;
-	unsigned long address;
-	pte_t *pte;
-	struct page *page;
-
-	BUG_ON(start & (HPAGE_SIZE - 1));
-	BUG_ON(end & (HPAGE_SIZE - 1));
-
-	for (address = start; address < end; address += HPAGE_SIZE) {
-		pte = huge_pte_offset(mm, address);
-		page = pte_page(*pte);
-		huge_page_release(page);
-		pte_clear(pte);
-	}
-	mm->rss -= (end - start) >> PAGE_SHIFT;
-	flush_tlb_range(vma, start, end);
-}
-
-void zap_hugepage_range(struct vm_area_struct *vma, unsigned long start, unsigned long length)
-{
-	struct mm_struct *mm = vma->vm_mm;
-	spin_lock(&mm->page_table_lock);
-	unmap_hugepage_range(vma, start, start + length);
-	spin_unlock(&mm->page_table_lock);
-}
-
-int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma)
-{
-	struct mm_struct *mm = current->mm;
-	unsigned long addr;
-	int ret = 0;
-
-	BUG_ON(vma->vm_start & ~HPAGE_MASK);
-	BUG_ON(vma->vm_end & ~HPAGE_MASK);
-
-	spin_lock(&mm->page_table_lock);
-	for (addr = vma->vm_start; addr < vma->vm_end; addr += HPAGE_SIZE) {
-		unsigned long idx;
-		pte_t *pte = huge_pte_alloc(mm, addr);
-		struct page *page;
-
-		if (!pte) {
-			ret = -ENOMEM;
-			goto out;
-		}
-		if (!pte_none(*pte))
-			continue;
-
-		idx = ((addr - vma->vm_start) >> HPAGE_SHIFT)
-			+ (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT));
-		page = find_get_page(mapping, idx);
-		if (!page) {
-
-			page = alloc_hugetlb_page();
-			if (!page) {
-				ret = -ENOMEM;
-				goto out;
-			}
-			ret = add_to_page_cache(page, mapping, idx, GFP_ATOMIC);
-			unlock_page(page);
-			if (ret) {
-				free_huge_page(page);
-				goto out;
-			}
-		}
-		set_huge_pte(mm, vma, page, pte, vma->vm_flags & VM_WRITE);
-	}
-out:
-	spin_unlock(&mm->page_table_lock);
-	return ret;
-}
-
-int set_hugetlb_mem_size(int count)
-{
-	int j, lcount;
-	struct page *page, *map;
-	extern long htlbzone_pages;
-	extern struct list_head htlbpage_freelist;
-
-	if (count < 0)
-		lcount = count;
-	else
-		lcount = count - htlbzone_pages;
-
-	if (lcount > 0) {	/* Increase the mem size. */
-		while (lcount--) {
-			page = alloc_pages(__GFP_HIGHMEM, HUGETLB_PAGE_ORDER);
-			if (page == NULL)
-				break;
-			spin_lock(&htlbpage_lock);
-			list_add(&page->list, &htlbpage_freelist);
-			htlbpagemem++;
-			htlbzone_pages++;
-			spin_unlock(&htlbpage_lock);
-		}
-		return (int) htlbzone_pages;
-	}
-	/* Shrink the memory size. */
-	while (lcount++) {
-		page = alloc_hugetlb_page();
-		if (page == NULL)
-			break;
-		spin_lock(&htlbpage_lock);
-		htlbzone_pages--;
-		spin_unlock(&htlbpage_lock);
-		map = page;
-		for (j = 0; j < (HPAGE_SIZE / PAGE_SIZE); j++) {
-			map->flags &= ~(1 << PG_locked | 1 << PG_error |
-					1 << PG_referenced |
-					1 << PG_dirty | 1 << PG_active |
-					1 << PG_private | 1<< PG_writeback);
-			set_page_count(map, 0);
-			map++;
-		}
-		set_page_count(page, 1);
-		__free_pages(page, HUGETLB_PAGE_ORDER);
-	}
-	return (int) htlbzone_pages;
-}
-
-/* This will likely not work because of fragmentation. */ 
-int hugetlb_sysctl_handler(ctl_table *table, int write, struct file *file, void *buffer, size_t *length)
-{
-	proc_dointvec(table, write, file, buffer, length);
-	htlbpage_max = set_hugetlb_mem_size(htlbpage_max);
-	return 0;
-}
-
-static int __init hugetlb_setup(char *s)
-{
-	if (sscanf(s, "%d", &htlbpage_max) <= 0)
-		htlbpage_max = 0;
-	return 1;
-}
-__setup("hugepages=", hugetlb_setup);
-
-static int __init hugetlb_init(void)
-{
-	int i, j;
-	struct page *page;
-
-	for (i = 0; i < htlbpage_max; ++i) {
-		page = alloc_pages(__GFP_HIGHMEM, HUGETLB_PAGE_ORDER);
-		if (!page)
-			break;
-		for (j = 0; j < HPAGE_SIZE/PAGE_SIZE; ++j)
-			SetPageReserved(&page[j]);
-		spin_lock(&htlbpage_lock);
-		list_add(&page->list, &htlbpage_freelist);
-		spin_unlock(&htlbpage_lock);
-	}
-	htlbpage_max = htlbpagemem = htlbzone_pages = i;
-	printk("Total HugeTLB memory allocated, %ld\n", htlbpagemem);
-	return 0;
-}
-module_init(hugetlb_init);
-
-int hugetlb_report_meminfo(char *buf)
-{
-	return sprintf(buf,
-			"HugePages_Total: %5lu\n"
-			"HugePages_Free:  %5lu\n"
-			"Hugepagesize:    %5lu kB\n",
-			htlbzone_pages,
-			htlbpagemem,
-			HPAGE_SIZE/1024);
-}
-
-static struct page *
-hugetlb_nopage(struct vm_area_struct *vma, unsigned long address, int unused)
-{
-	BUG();
-	return NULL;
-}
-
-struct vm_operations_struct hugetlb_vm_ops = {
-	.nopage = hugetlb_nopage,
-};
-
-int is_hugepage_mem_enough(size_t size)
-{
-       if (size > (htlbpagemem << HPAGE_SHIFT))
-               return 0;
-       return 1;
-}
diff -Nru a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c
--- a/arch/x86_64/mm/pageattr.c	Sun Feb 23 22:25:24 2003
+++ b/arch/x86_64/mm/pageattr.c	Sun Feb 23 22:25:24 2003
@@ -123,10 +123,12 @@
 
 static inline void flush_map(unsigned long address)
 {	
+	preempt_disable();
 #ifdef CONFIG_SMP 
 	smp_call_function(flush_kernel_map, (void *)address, 1, 1);
 #endif	
 	flush_kernel_map((void *)address);
+	preempt_enable();
 }
 
 struct deferred_page { 
diff -Nru a/drivers/acorn/block/fd1772.c b/drivers/acorn/block/fd1772.c
--- a/drivers/acorn/block/fd1772.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/acorn/block/fd1772.c	Sun Feb 23 22:25:23 2003
@@ -99,7 +99,7 @@
  *                Removed the busy wait loop in do_fd_request and replaced
  *                by a routine on tq_immediate; only 11% cpu on a dd off the
  *                raw disc - but the speed is the same.
- *	1/ 9/96 - Idea (failed!) - set the 'disable spin-up seqeunce'
+ *	1/ 9/96 - Idea (failed!) - set the 'disable spin-up sequence'
  *		  when we read the track if we know the motor is on; didn't
  *		  help - perhaps we have to do it in stepping as well.
  *		  Nope. Still doesn't help.
diff -Nru a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c
--- a/drivers/acpi/dispatcher/dsfield.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/dispatcher/dsfield.c	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c
--- a/drivers/acpi/dispatcher/dsinit.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/dispatcher/dsinit.c	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
--- a/drivers/acpi/dispatcher/dsmethod.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/dispatcher/dsmethod.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c
--- a/drivers/acpi/dispatcher/dsmthdat.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/acpi/dispatcher/dsmthdat.c	Sun Feb 23 22:25:23 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c
--- a/drivers/acpi/dispatcher/dsobject.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/dispatcher/dsobject.c	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c
--- a/drivers/acpi/dispatcher/dsopcode.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/dispatcher/dsopcode.c	Sun Feb 23 22:25:26 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c
--- a/drivers/acpi/dispatcher/dsutils.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/dispatcher/dsutils.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c
--- a/drivers/acpi/dispatcher/dswexec.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/dispatcher/dswexec.c	Sun Feb 23 22:25:26 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c
--- a/drivers/acpi/dispatcher/dswload.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/dispatcher/dswload.c	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c
--- a/drivers/acpi/dispatcher/dswscope.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/acpi/dispatcher/dswscope.c	Sun Feb 23 22:25:27 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c
--- a/drivers/acpi/dispatcher/dswstate.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/dispatcher/dswstate.c	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c
--- a/drivers/acpi/events/evevent.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/events/evevent.c	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #include <acpi/acpi.h>
diff -Nru a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c
--- a/drivers/acpi/events/evgpe.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/events/evgpe.c	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #include <acpi/acpi.h>
@@ -255,7 +274,7 @@
 				ACPI_HIDWORD (acpi_gbl_gpe_block_info[gpe_block].block_address->address),
 				ACPI_LODWORD (acpi_gbl_gpe_block_info[gpe_block].block_address->address)));
 
-			ACPI_REPORT_INFO (("GPE Block%d defined as GPE%d to GPE%d\n",
+			ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d defined as GPE%d to GPE%d\n",
 				(s32) gpe_block,
 				(u32) acpi_gbl_gpe_block_info[gpe_block].block_base_number,
 				(u32) (acpi_gbl_gpe_block_info[gpe_block].block_base_number +
@@ -307,7 +326,7 @@
 	void                            **return_value)
 {
 	u32                             gpe_number;
-	u32                             gpe_number_index;
+	struct acpi_gpe_number_info     *gpe_number_info;
 	char                            name[ACPI_NAME_SIZE + 1];
 	u8                              type;
 	acpi_status                     status;
@@ -357,19 +376,22 @@
 
 	/* Get GPE index and ensure that we have a valid GPE number */
 
-	gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
-	if (gpe_number_index == ACPI_GPE_INVALID) {
+	gpe_number_info = acpi_ev_get_gpe_number_info (gpe_number);
+	if (!gpe_number_info) {
 		/* Not valid, all we can do here is ignore it */
 
+		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+			"GPE number associated with method is not valid %s\n",
+			name));
 		return (AE_OK);
 	}
 
 	/*
-	 * Now we can add this information to the gpe_info block
+	 * Now we can add this information to the gpe_number_info block
 	 * for use during dispatch of this GPE.
 	 */
-	acpi_gbl_gpe_number_info [gpe_number_index].type  = type;
-	acpi_gbl_gpe_number_info [gpe_number_index].method_node = (struct acpi_namespace_node *) obj_handle;
+	gpe_number_info->type     = type;
+	gpe_number_info->method_node = (struct acpi_namespace_node *) obj_handle;
 
 	/*
 	 * Enable the GPE (SCIs should be disabled at this point)
@@ -532,7 +554,7 @@
 {
 	u32                             gpe_number = (u32) ACPI_TO_INTEGER (context);
 	u32                             gpe_number_index;
-	struct acpi_gpe_number_info     gpe_info;
+	struct acpi_gpe_number_info     gpe_number_info;
 	acpi_status                     status;
 
 
@@ -553,26 +575,26 @@
 		return_VOID;
 	}
 
-	gpe_info = acpi_gbl_gpe_number_info [gpe_number_index];
+	gpe_number_info = acpi_gbl_gpe_number_info [gpe_number_index];
 	status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
 	if (ACPI_FAILURE (status)) {
 		return_VOID;
 	}
 
-	if (gpe_info.method_node) {
+	if (gpe_number_info.method_node) {
 		/*
 		 * Invoke the GPE Method (_Lxx, _Exx):
 		 * (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.)
 		 */
-		status = acpi_ns_evaluate_by_handle (gpe_info.method_node, NULL, NULL);
+		status = acpi_ns_evaluate_by_handle (gpe_number_info.method_node, NULL, NULL);
 		if (ACPI_FAILURE (status)) {
 			ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2.2X]\n",
 				acpi_format_exception (status),
-				gpe_info.method_node->name.ascii, gpe_number));
+				gpe_number_info.method_node->name.ascii, gpe_number));
 		}
 	}
 
-	if (gpe_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
+	if (gpe_number_info.type & ACPI_EVENT_LEVEL_TRIGGERED) {
 		/*
 		 * GPE is level-triggered, we clear the GPE status bit after handling
 		 * the event.
@@ -609,31 +631,28 @@
 acpi_ev_gpe_dispatch (
 	u32                             gpe_number)
 {
-	u32                             gpe_number_index;
-	struct acpi_gpe_number_info     *gpe_info;
+	struct acpi_gpe_number_info     *gpe_number_info;
 	acpi_status                     status;
 
 
 	ACPI_FUNCTION_TRACE ("ev_gpe_dispatch");
 
 
-	gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
-	if (gpe_number_index == ACPI_GPE_INVALID) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "GPE[%X] is not a valid event\n", gpe_number));
-		return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
-	}
-
 	/*
-	 * We don't have to worry about mutex on gpe_info because we are
+	 * We don't have to worry about mutex on gpe_number_info because we are
 	 * executing at interrupt level.
 	 */
-	gpe_info = &acpi_gbl_gpe_number_info [gpe_number_index];
+	gpe_number_info = acpi_ev_get_gpe_number_info (gpe_number);
+	if (!gpe_number_info) {
+		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "GPE[%X] is not a valid event\n", gpe_number));
+		return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+	}
 
 	/*
 	 * If edge-triggered, clear the GPE status bit now.  Note that
 	 * level-triggered events are cleared after the GPE is serviced.
 	 */
-	if (gpe_info->type & ACPI_EVENT_EDGE_TRIGGERED) {
+	if (gpe_number_info->type & ACPI_EVENT_EDGE_TRIGGERED) {
 		status = acpi_hw_clear_gpe (gpe_number);
 		if (ACPI_FAILURE (status)) {
 			ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: Unable to clear GPE[%2.2X]\n", gpe_number));
@@ -648,12 +667,12 @@
 	 * If there is neither a handler nor a method, we disable the level to
 	 * prevent further events from coming in here.
 	 */
-	if (gpe_info->handler) {
+	if (gpe_number_info->handler) {
 		/* Invoke the installed handler (at interrupt level) */
 
-		gpe_info->handler (gpe_info->context);
+		gpe_number_info->handler (gpe_number_info->context);
 	}
-	else if (gpe_info->method_node) {
+	else if (gpe_number_info->method_node) {
 		/*
 		 * Disable GPE, so it doesn't keep firing before the method has a
 		 * chance to run.
@@ -692,7 +711,7 @@
 	/*
 	 * It is now safe to clear level-triggered evnets.
 	 */
-	if (gpe_info->type & ACPI_EVENT_LEVEL_TRIGGERED) {
+	if (gpe_number_info->type & ACPI_EVENT_LEVEL_TRIGGERED) {
 		status = acpi_hw_clear_gpe (gpe_number);
 		if (ACPI_FAILURE (status)) {
 			ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: Unable to clear GPE[%2.2X]\n", gpe_number));
diff -Nru a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
--- a/drivers/acpi/events/evmisc.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/events/evmisc.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #include <acpi/acpi.h>
@@ -67,27 +86,53 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ev_get_gpe_register_index
+ * FUNCTION:    acpi_ev_get_gpe_register_info
  *
  * PARAMETERS:  gpe_number      - Raw GPE number
  *
- * RETURN:      None.
+ * RETURN:      Pointer to the info struct for this GPE register.
  *
  * DESCRIPTION: Returns the register index (index into the GPE register info
  *              table) associated with this GPE.
  *
  ******************************************************************************/
 
-u32
-acpi_ev_get_gpe_register_index (
+struct acpi_gpe_register_info *
+acpi_ev_get_gpe_register_info (
+	u32                             gpe_number)
+{
+
+	if (gpe_number > acpi_gbl_gpe_number_max) {
+		return (NULL);
+	}
+
+	return (&acpi_gbl_gpe_register_info [ACPI_DIV_8 (acpi_gbl_gpe_number_to_index[gpe_number].number_index)]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ev_get_gpe_number_info
+ *
+ * PARAMETERS:  gpe_number      - Raw GPE number
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Returns the number index (index into the GPE number info table)
+ *              associated with this GPE.
+ *
+ ******************************************************************************/
+
+struct acpi_gpe_number_info *
+acpi_ev_get_gpe_number_info (
 	u32                             gpe_number)
 {
 
 	if (gpe_number > acpi_gbl_gpe_number_max) {
-		return (ACPI_GPE_INVALID);
+		return (NULL);
 	}
 
-	return (ACPI_DIV_8 (acpi_gbl_gpe_number_to_index[gpe_number].number_index));
+	return (&acpi_gbl_gpe_number_info [acpi_gbl_gpe_number_to_index[gpe_number].number_index]);
 }
 
 
diff -Nru a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
--- a/drivers/acpi/events/evregion.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/events/evregion.c	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c
--- a/drivers/acpi/events/evrgnini.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/events/evrgnini.c	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c
--- a/drivers/acpi/events/evsci.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/events/evsci.c	Sun Feb 23 22:25:25 2003
@@ -6,21 +6,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #include <acpi/acpi.h>
diff -Nru a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
--- a/drivers/acpi/events/evxface.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/events/evxface.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
@@ -473,7 +492,7 @@
 	void                            *context)
 {
 	acpi_status                     status;
-	u32                             gpe_number_index;
+	struct acpi_gpe_number_info     *gpe_number_info;
 
 
 	ACPI_FUNCTION_TRACE ("acpi_install_gpe_handler");
@@ -487,8 +506,8 @@
 
 	/* Ensure that we have a valid GPE number */
 
-	gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
-	if (gpe_number_index == ACPI_GPE_INVALID) {
+	gpe_number_info = acpi_ev_get_gpe_number_info (gpe_number);
+	if (!gpe_number_info) {
 		return_ACPI_STATUS (AE_BAD_PARAMETER);
 	}
 
@@ -499,16 +518,16 @@
 
 	/* Make sure that there isn't a handler there already */
 
-	if (acpi_gbl_gpe_number_info[gpe_number_index].handler) {
+	if (gpe_number_info->handler) {
 		status = AE_ALREADY_EXISTS;
 		goto cleanup;
 	}
 
 	/* Install the handler */
 
-	acpi_gbl_gpe_number_info[gpe_number_index].handler = handler;
-	acpi_gbl_gpe_number_info[gpe_number_index].context = context;
-	acpi_gbl_gpe_number_info[gpe_number_index].type = (u8) type;
+	gpe_number_info->handler = handler;
+	gpe_number_info->context = context;
+	gpe_number_info->type  = (u8) type;
 
 	/* Clear the GPE (of stale events), the enable it */
 
@@ -545,7 +564,7 @@
 	acpi_gpe_handler                handler)
 {
 	acpi_status                     status;
-	u32                             gpe_number_index;
+	struct acpi_gpe_number_info     *gpe_number_info;
 
 
 	ACPI_FUNCTION_TRACE ("acpi_remove_gpe_handler");
@@ -559,8 +578,8 @@
 
 	/* Ensure that we have a valid GPE number */
 
-	gpe_number_index = acpi_ev_get_gpe_number_index (gpe_number);
-	if (gpe_number_index == ACPI_GPE_INVALID) {
+	gpe_number_info = acpi_ev_get_gpe_number_info (gpe_number);
+	if (!gpe_number_info) {
 		return_ACPI_STATUS (AE_BAD_PARAMETER);
 	}
 
@@ -578,7 +597,7 @@
 
 	/* Make sure that the installed handler is the same */
 
-	if (acpi_gbl_gpe_number_info[gpe_number_index].handler != handler) {
+	if (gpe_number_info->handler != handler) {
 		(void) acpi_hw_enable_gpe (gpe_number);
 		status = AE_BAD_PARAMETER;
 		goto cleanup;
@@ -586,8 +605,8 @@
 
 	/* Remove the handler */
 
-	acpi_gbl_gpe_number_info[gpe_number_index].handler = NULL;
-	acpi_gbl_gpe_number_info[gpe_number_index].context = NULL;
+	gpe_number_info->handler = NULL;
+	gpe_number_info->context = NULL;
 
 
 cleanup:
diff -Nru a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c
--- a/drivers/acpi/events/evxfevnt.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/events/evxfevnt.c	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c
--- a/drivers/acpi/events/evxfregn.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/events/evxfregn.c	Sun Feb 23 22:25:22 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
--- a/drivers/acpi/executer/exconfig.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/executer/exconfig.c	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
@@ -313,7 +332,6 @@
 		break;
 
 
-	case ACPI_TYPE_BUFFER_FIELD:
 	case ACPI_TYPE_LOCAL_REGION_FIELD:
 	case ACPI_TYPE_LOCAL_BANK_FIELD:
 	case ACPI_TYPE_LOCAL_INDEX_FIELD:
diff -Nru a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c
--- a/drivers/acpi/executer/exconvrt.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/executer/exconvrt.c	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c
--- a/drivers/acpi/executer/excreate.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/executer/excreate.c	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c
--- a/drivers/acpi/executer/exdump.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/executer/exdump.c	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c
--- a/drivers/acpi/executer/exfield.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/executer/exfield.c	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c
--- a/drivers/acpi/executer/exfldio.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/acpi/executer/exfldio.c	Sun Feb 23 22:25:23 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c
--- a/drivers/acpi/executer/exmisc.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/executer/exmisc.c	Sun Feb 23 22:25:26 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c
--- a/drivers/acpi/executer/exmutex.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/executer/exmutex.c	Sun Feb 23 22:25:26 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c
--- a/drivers/acpi/executer/exnames.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/acpi/executer/exnames.c	Sun Feb 23 22:25:23 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c
--- a/drivers/acpi/executer/exoparg1.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/executer/exoparg1.c	Sun Feb 23 22:25:26 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c
--- a/drivers/acpi/executer/exoparg2.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/executer/exoparg2.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c
--- a/drivers/acpi/executer/exoparg3.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/executer/exoparg3.c	Sun Feb 23 22:25:21 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c
--- a/drivers/acpi/executer/exoparg6.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/executer/exoparg6.c	Sun Feb 23 22:25:25 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c
--- a/drivers/acpi/executer/exprep.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/executer/exprep.c	Sun Feb 23 22:25:22 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c
--- a/drivers/acpi/executer/exregion.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/executer/exregion.c	Sun Feb 23 22:25:22 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c
--- a/drivers/acpi/executer/exresnte.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/executer/exresnte.c	Sun Feb 23 22:25:22 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c
--- a/drivers/acpi/executer/exresolv.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/acpi/executer/exresolv.c	Sun Feb 23 22:25:23 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c
--- a/drivers/acpi/executer/exresop.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/executer/exresop.c	Sun Feb 23 22:25:26 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
@@ -345,13 +364,6 @@
 			type_needed = ACPI_TYPE_EVENT;
 			break;
 
-		case ARGI_REGION:
-
-			/* Need an operand of type ACPI_TYPE_REGION */
-
-			type_needed = ACPI_TYPE_REGION;
-			break;
-
 		case ARGI_PACKAGE:   /* Package */
 
 			/* Need an operand of type ACPI_TYPE_PACKAGE */
@@ -458,6 +470,37 @@
 			goto next_operand;
 
 
+		case ARGI_BUFFER_OR_STRING:
+
+			/* Need an operand of type STRING or BUFFER */
+
+			switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+			case ACPI_TYPE_STRING:
+			case ACPI_TYPE_BUFFER:
+
+				/* Valid operand */
+			   break;
+
+			case ACPI_TYPE_INTEGER:
+
+				/* Highest priority conversion is to type Buffer */
+
+				status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr, walk_state);
+				if (ACPI_FAILURE (status)) {
+					return_ACPI_STATUS (status);
+				}
+				break;
+
+			default:
+				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+					"Needed [Integer/String/Buffer], found [%s] %p\n",
+					acpi_ut_get_object_type_name (obj_desc), obj_desc));
+
+				return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+			}
+			goto next_operand;
+
+
 		case ARGI_DATAOBJECT:
 			/*
 			 * ARGI_DATAOBJECT is only used by the size_of operator.
@@ -477,7 +520,7 @@
 
 			default:
 				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Needed [Buf/Str/Pkg], found [%s] %p\n",
+					"Needed [Buffer/String/Package/Reference], found [%s] %p\n",
 					acpi_ut_get_object_type_name (obj_desc), obj_desc));
 
 				return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -499,7 +542,30 @@
 
 			default:
 				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-					"Needed [Buf/Str/Pkg], found [%s] %p\n",
+					"Needed [Buffer/String/Package], found [%s] %p\n",
+					acpi_ut_get_object_type_name (obj_desc), obj_desc));
+
+				return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+			}
+			goto next_operand;
+
+
+		case ARGI_REGION_OR_FIELD:
+
+			/* Need an operand of type ACPI_TYPE_REGION or a FIELD in a region */
+
+			switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+			case ACPI_TYPE_REGION:
+			case ACPI_TYPE_LOCAL_REGION_FIELD:
+			case ACPI_TYPE_LOCAL_BANK_FIELD:
+			case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+				/* Valid operand */
+				break;
+
+			default:
+				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+					"Needed [Region/region_field], found [%s] %p\n",
 					acpi_ut_get_object_type_name (obj_desc), obj_desc));
 
 				return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
diff -Nru a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c
--- a/drivers/acpi/executer/exstore.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/executer/exstore.c	Sun Feb 23 22:25:24 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c
--- a/drivers/acpi/executer/exstoren.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/executer/exstoren.c	Sun Feb 23 22:25:22 2003
@@ -7,21 +7,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c
--- a/drivers/acpi/executer/exstorob.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/executer/exstorob.c	Sun Feb 23 22:25:26 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c
--- a/drivers/acpi/executer/exsystem.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/executer/exsystem.c	Sun Feb 23 22:25:25 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
--- a/drivers/acpi/executer/exutils.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/executer/exutils.c	Sun Feb 23 22:25:22 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c
--- a/drivers/acpi/hardware/hwacpi.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/hardware/hwacpi.c	Sun Feb 23 22:25:21 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c
--- a/drivers/acpi/hardware/hwgpe.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/hardware/hwgpe.c	Sun Feb 23 22:25:21 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #include <acpi/acpi.h>
@@ -67,34 +86,34 @@
 	u32                             gpe_number)
 {
 	u32                             in_byte;
-	u32                             register_index;
-	u8                              bit_mask;
 	acpi_status                     status;
+	struct acpi_gpe_register_info   *gpe_register_info;
 
 
 	ACPI_FUNCTION_ENTRY ();
 
 
-	/* Translate GPE number to index into global registers array. */
+	/* Get the info block for the entire GPE register */
 
-	register_index = acpi_ev_get_gpe_register_index (gpe_number);
-
-	/* Get the register bitmask for this GPE */
-
-	bit_mask = acpi_hw_get_gpe_bit_mask (gpe_number);
+	gpe_register_info = acpi_ev_get_gpe_register_info (gpe_number);
+	if (!gpe_register_info) {
+		return (AE_BAD_PARAMETER);
+	}
 
 	/*
 	 * Read the current value of the register, set the appropriate bit
 	 * to enable the GPE, and write out the new register.
 	 */
 	status = acpi_hw_low_level_read (8, &in_byte,
-			  &acpi_gbl_gpe_register_info[register_index].enable_address, 0);
+			  &gpe_register_info->enable_address, 0);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
 
-	status = acpi_hw_low_level_write (8, (in_byte | bit_mask),
-			  &acpi_gbl_gpe_register_info[register_index].enable_address, 0);
+	/* Write with the new GPE bit enabled */
+
+	status = acpi_hw_low_level_write (8, (in_byte | acpi_hw_get_gpe_bit_mask (gpe_number)),
+			  &gpe_register_info->enable_address, 0);
 
 	return (status);
 }
@@ -117,25 +136,23 @@
 acpi_hw_enable_gpe_for_wakeup (
 	u32                             gpe_number)
 {
-	u32                             register_index;
-	u8                              bit_mask;
+	struct acpi_gpe_register_info   *gpe_register_info;
 
 
 	ACPI_FUNCTION_ENTRY ();
 
 
-	/* Translate GPE number to index into global registers array. */
-
-	register_index = acpi_ev_get_gpe_register_index (gpe_number);
-
-	/* Get the register bitmask for this GPE */
+	/* Get the info block for the entire GPE register */
 
-	bit_mask = acpi_hw_get_gpe_bit_mask (gpe_number);
+	gpe_register_info = acpi_ev_get_gpe_register_info (gpe_number);
+	if (!gpe_register_info) {
+		return;
+	}
 
 	/*
 	 * Set the bit so we will not disable this when sleeping
 	 */
-	acpi_gbl_gpe_register_info[register_index].wake_enable |= bit_mask;
+	gpe_register_info->wake_enable |= acpi_hw_get_gpe_bit_mask (gpe_number);
 }
 
 
@@ -156,34 +173,34 @@
 	u32                             gpe_number)
 {
 	u32                             in_byte;
-	u32                             register_index;
-	u8                              bit_mask;
 	acpi_status                     status;
+	struct acpi_gpe_register_info   *gpe_register_info;
 
 
 	ACPI_FUNCTION_ENTRY ();
 
 
-	/* Translate GPE number to index into global registers array. */
-
-	register_index = acpi_ev_get_gpe_register_index (gpe_number);
+	/* Get the info block for the entire GPE register */
 
-	/* Get the register bitmask for this GPE */
-
-	bit_mask = acpi_hw_get_gpe_bit_mask (gpe_number);
+	gpe_register_info = acpi_ev_get_gpe_register_info (gpe_number);
+	if (!gpe_register_info) {
+		return (AE_BAD_PARAMETER);
+	}
 
 	/*
 	 * Read the current value of the register, clear the appropriate bit,
 	 * and write out the new register value to disable the GPE.
 	 */
 	status = acpi_hw_low_level_read (8, &in_byte,
-			  &acpi_gbl_gpe_register_info[register_index].enable_address, 0);
+			  &gpe_register_info->enable_address, 0);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
 
-	status = acpi_hw_low_level_write (8, (in_byte & ~bit_mask),
-			  &acpi_gbl_gpe_register_info[register_index].enable_address, 0);
+	/* Write the byte with this GPE bit cleared */
+
+	status = acpi_hw_low_level_write (8, (in_byte & ~(acpi_hw_get_gpe_bit_mask (gpe_number))),
+			  &gpe_register_info->enable_address, 0);
 	if (ACPI_FAILURE (status)) {
 		return (status);
 	}
@@ -210,25 +227,23 @@
 acpi_hw_disable_gpe_for_wakeup (
 	u32                             gpe_number)
 {
-	u32                             register_index;
-	u8                              bit_mask;
+	struct acpi_gpe_register_info   *gpe_register_info;
 
 
 	ACPI_FUNCTION_ENTRY ();
 
 
-	/* Translate GPE number to index into global registers array. */
-
-	register_index = acpi_ev_get_gpe_register_index (gpe_number);
-
-	/* Get the register bitmask for this GPE */
+	/* Get the info block for the entire GPE register */
 
-	bit_mask = acpi_hw_get_gpe_bit_mask (gpe_number);
+	gpe_register_info = acpi_ev_get_gpe_register_info (gpe_number);
+	if (!gpe_register_info) {
+		return;
+	}
 
 	/*
 	 * Clear the bit so we will disable this when sleeping
 	 */
-	acpi_gbl_gpe_register_info[register_index].wake_enable &= ~bit_mask;
+	gpe_register_info->wake_enable &= ~(acpi_hw_get_gpe_bit_mask (gpe_number));
 }
 
 
@@ -248,28 +263,26 @@
 acpi_hw_clear_gpe (
 	u32                             gpe_number)
 {
-	u32                             register_index;
-	u8                              bit_mask;
 	acpi_status                     status;
+	struct acpi_gpe_register_info   *gpe_register_info;
 
 
 	ACPI_FUNCTION_ENTRY ();
 
 
-	/* Translate GPE number to index into global registers array. */
-
-	register_index = acpi_ev_get_gpe_register_index (gpe_number);
-
-	/* Get the register bitmask for this GPE */
+	/* Get the info block for the entire GPE register */
 
-	bit_mask = acpi_hw_get_gpe_bit_mask (gpe_number);
+	gpe_register_info = acpi_ev_get_gpe_register_info (gpe_number);
+	if (!gpe_register_info) {
+		return (AE_BAD_PARAMETER);
+	}
 
 	/*
 	 * Write a one to the appropriate bit in the status register to
 	 * clear this GPE.
 	 */
-	status = acpi_hw_low_level_write (8, bit_mask,
-			  &acpi_gbl_gpe_register_info[register_index].status_address, 0);
+	status = acpi_hw_low_level_write (8, acpi_hw_get_gpe_bit_mask (gpe_number),
+			  &gpe_register_info->status_address, 0);
 
 	return (status);
 }
@@ -292,11 +305,11 @@
 	u32                             gpe_number,
 	acpi_event_status               *event_status)
 {
-	u32                             in_byte = 0;
-	u32                             register_index = 0;
-	u8                              bit_mask = 0;
+	u32                             in_byte;
+	u8                              bit_mask;
 	struct acpi_gpe_register_info   *gpe_register_info;
 	acpi_status                     status;
+	acpi_event_status               local_event_status = 0;
 
 
 	ACPI_FUNCTION_ENTRY ();
@@ -306,12 +319,12 @@
 		return (AE_BAD_PARAMETER);
 	}
 
-	(*event_status) = 0;
+	/* Get the info block for the entire GPE register */
 
-	/* Translate GPE number to index into global registers array. */
-
-	register_index = acpi_ev_get_gpe_register_index (gpe_number);
-	gpe_register_info = &acpi_gbl_gpe_register_info[register_index];
+	gpe_register_info = acpi_ev_get_gpe_register_info (gpe_number);
+	if (!gpe_register_info) {
+		return (AE_BAD_PARAMETER);
+	}
 
 	/* Get the register bitmask for this GPE */
 
@@ -325,13 +338,13 @@
 	}
 
 	if (bit_mask & in_byte) {
-		(*event_status) |= ACPI_EVENT_FLAG_ENABLED;
+		local_event_status |= ACPI_EVENT_FLAG_ENABLED;
 	}
 
 	/* GPE Enabled for wake? */
 
 	if (bit_mask & gpe_register_info->wake_enable) {
-		(*event_status) |= ACPI_EVENT_FLAG_WAKE_ENABLED;
+		local_event_status |= ACPI_EVENT_FLAG_WAKE_ENABLED;
 	}
 
 	/* GPE active (set)? */
@@ -342,8 +355,12 @@
 	}
 
 	if (bit_mask & in_byte) {
-		(*event_status) |= ACPI_EVENT_FLAG_SET;
+		local_event_status |= ACPI_EVENT_FLAG_SET;
 	}
+
+	/* Set return value */
+
+	(*event_status) = local_event_status;
 	return (AE_OK);
 }
 
@@ -378,7 +395,12 @@
 
 
 	for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
+		/* Get the info block for the entire GPE register */
+
 		gpe_register_info = &acpi_gbl_gpe_register_info[i];
+		if (!gpe_register_info) {
+			return (AE_BAD_PARAMETER);
+		}
 
 		/*
 		 * Read the enabled status of all GPEs. We
@@ -430,7 +452,12 @@
 
 
 	for (i = 0; i < acpi_gbl_gpe_register_count; i++) {
+		/* Get the info block for the entire GPE register */
+
 		gpe_register_info = &acpi_gbl_gpe_register_info[i];
+		if (!gpe_register_info) {
+			return (AE_BAD_PARAMETER);
+		}
 
 		/*
 		 * We previously stored the enabled status of all GPEs.
diff -Nru a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c
--- a/drivers/acpi/hardware/hwregs.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/hardware/hwregs.c	Sun Feb 23 22:25:26 2003
@@ -7,21 +7,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
--- a/drivers/acpi/hardware/hwsleep.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/hardware/hwsleep.c	Sun Feb 23 22:25:21 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #include <acpi/acpi.h>
diff -Nru a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c
--- a/drivers/acpi/hardware/hwtimer.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/hardware/hwtimer.c	Sun Feb 23 22:25:22 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #include <acpi/acpi.h>
diff -Nru a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c
--- a/drivers/acpi/namespace/nsaccess.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/namespace/nsaccess.c	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
@@ -100,6 +119,18 @@
 		 * initial value, create the initial value.
 		 */
 		if (init_val->val) {
+			acpi_string val;
+
+			status = acpi_os_predefined_override(init_val, &val);
+			if (ACPI_FAILURE (status)) {
+				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not override predefined %s\n",
+					init_val->name));
+			}
+
+			if (!val) {
+				val = init_val->val;
+			}
+
 			/*
 			 * Entry requests an initial value, allocate a
 			 * descriptor for it.
@@ -118,7 +149,7 @@
 			switch (init_val->type) {
 			case ACPI_TYPE_METHOD:
 				obj_desc->method.param_count =
-						(u8) ACPI_STRTOUL (init_val->val, NULL, 10);
+						(u8) ACPI_STRTOUL (val, NULL, 10);
 				obj_desc->common.flags |= AOPOBJ_DATA_VALID;
 
 #if defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
@@ -132,7 +163,7 @@
 			case ACPI_TYPE_INTEGER:
 
 				obj_desc->integer.value =
-						(acpi_integer) ACPI_STRTOUL (init_val->val, NULL, 10);
+						(acpi_integer) ACPI_STRTOUL (val, NULL, 10);
 				break;
 
 
@@ -141,8 +172,8 @@
 				/*
 				 * Build an object around the static string
 				 */
-				obj_desc->string.length = (u32) ACPI_STRLEN (init_val->val);
-				obj_desc->string.pointer = init_val->val;
+				obj_desc->string.length = (u32) ACPI_STRLEN (val);
+				obj_desc->string.pointer = val;
 				obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
 				break;
 
@@ -151,7 +182,7 @@
 
 				obj_desc->mutex.node = new_node;
 				obj_desc->mutex.sync_level =
-						 (u16) ACPI_STRTOUL (init_val->val, NULL, 10);
+						 (u16) ACPI_STRTOUL (val, NULL, 10);
 
 				if (ACPI_STRCMP (init_val->name, "_GL_") == 0) {
 					/*
diff -Nru a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c
--- a/drivers/acpi/namespace/nsalloc.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/namespace/nsalloc.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c
--- a/drivers/acpi/namespace/nsdump.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/namespace/nsdump.c	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c
--- a/drivers/acpi/namespace/nsdumpdv.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/namespace/nsdumpdv.c	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c
--- a/drivers/acpi/namespace/nseval.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/acpi/namespace/nseval.c	Sun Feb 23 22:25:23 2003
@@ -6,21 +6,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c
--- a/drivers/acpi/namespace/nsinit.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/acpi/namespace/nsinit.c	Sun Feb 23 22:25:23 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c
--- a/drivers/acpi/namespace/nsload.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/namespace/nsload.c	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c
--- a/drivers/acpi/namespace/nsnames.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/acpi/namespace/nsnames.c	Sun Feb 23 22:25:27 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c
--- a/drivers/acpi/namespace/nsobject.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/acpi/namespace/nsobject.c	Sun Feb 23 22:25:23 2003
@@ -6,21 +6,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c
--- a/drivers/acpi/namespace/nsparse.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/namespace/nsparse.c	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c
--- a/drivers/acpi/namespace/nssearch.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/namespace/nssearch.c	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c
--- a/drivers/acpi/namespace/nsutils.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/namespace/nsutils.c	Sun Feb 23 22:25:24 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c
--- a/drivers/acpi/namespace/nswalk.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/acpi/namespace/nswalk.c	Sun Feb 23 22:25:27 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c
--- a/drivers/acpi/namespace/nsxfeval.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/acpi/namespace/nsxfeval.c	Sun Feb 23 22:25:27 2003
@@ -6,21 +6,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c
--- a/drivers/acpi/namespace/nsxfname.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/namespace/nsxfname.c	Sun Feb 23 22:25:22 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c
--- a/drivers/acpi/namespace/nsxfobj.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/namespace/nsxfobj.c	Sun Feb 23 22:25:21 2003
@@ -6,21 +6,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
@@ -140,7 +159,7 @@
 	*ret_handle =
 		acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_node (node));
 
-	/* Return exeption if parent is null */
+	/* Return exception if parent is null */
 
 	if (!acpi_ns_get_parent_node (node)) {
 		status = AE_NULL_ENTRY;
diff -Nru a/drivers/acpi/numa.c b/drivers/acpi/numa.c
--- a/drivers/acpi/numa.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/numa.c	Sun Feb 23 22:25:25 2003
@@ -1,7 +1,7 @@
 /*
  *  acpi_numa.c - ACPI NUMA support
  *
- *  Copyright (C) 2002 Takayoshi Kochi <t-kouchi@cq.jp.nec.com>
+ *  Copyright (C) 2002 Takayoshi Kochi <t-kochi@bq.jp.nec.com>
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
diff -Nru a/drivers/acpi/osl.c b/drivers/acpi/osl.c
--- a/drivers/acpi/osl.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/osl.c	Sun Feb 23 22:25:26 2003
@@ -203,6 +203,26 @@
 	return AE_OK;
 }
 
+#define ACPI_MAX_OVERRIDE_LEN 100
+
+static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
+
+acpi_status
+acpi_os_predefined_override (const struct acpi_predefined_names *init_val,
+		             acpi_string *new_val)
+{
+	if (!init_val || !new_val)
+		return AE_BAD_PARAMETER;
+
+	*new_val = NULL;
+	if (!memcmp (init_val->name, "_OS_", 4) && strlen(acpi_os_name)) {
+		printk(KERN_INFO PREFIX "Overriding _OS definition\n");
+		*new_val = acpi_os_name;
+	}
+
+	return AE_OK;
+}
+
 acpi_status
 acpi_os_table_override (struct acpi_table_header *existing_table,
 			struct acpi_table_header **new_table)
@@ -223,6 +243,13 @@
 acpi_status
 acpi_os_install_interrupt_handler(u32 irq, OSD_HANDLER handler, void *context)
 {
+	/*
+	 * Ignore the irq from the core, and use the value in our copy of the
+	 * FADT. It may not be the same if an interrupt source override exists
+	 * for the SCI.
+	 */
+	irq = acpi_fadt.sci_int;
+
 #ifdef CONFIG_IA64
 	irq = gsi_to_vector(irq);
 #endif
@@ -847,3 +874,28 @@
 
 	return AE_OK;
 }
+
+int __init
+acpi_os_name_setup(char *str)
+{
+	char *p = acpi_os_name;
+	int count = ACPI_MAX_OVERRIDE_LEN-1;
+
+	if (!str || !*str)
+		return 0;
+
+	for (; count-- && str && *str; str++) {
+		if (isalnum(*str) || *str == ' ')
+			*p++ = *str;
+		else if (*str == '\'' || *str == '"')
+			continue;
+		else
+			break;
+	}
+	*p = 0;
+
+	return 1;
+		
+}
+
+__setup("acpi_os_name=", acpi_os_name_setup);
diff -Nru a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c
--- a/drivers/acpi/parser/psargs.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/acpi/parser/psargs.c	Sun Feb 23 22:25:23 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c
--- a/drivers/acpi/parser/psopcode.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/parser/psopcode.c	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
@@ -258,7 +277,7 @@
 #define ARGI_LLESSEQUAL_OP              ARGI_INVALID_OPCODE
 #define ARGI_LNOT_OP                    ARGI_LIST1 (ARGI_INTEGER)
 #define ARGI_LNOTEQUAL_OP               ARGI_INVALID_OPCODE
-#define ARGI_LOAD_OP                    ARGI_LIST2 (ARGI_REGION,     ARGI_TARGETREF)
+#define ARGI_LOAD_OP                    ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF)
 #define ARGI_LOAD_TABLE_OP              ARGI_LIST6 (ARGI_STRING,     ARGI_STRING,        ARGI_STRING,       ARGI_STRING,    ARGI_STRING, ARGI_ANYTYPE)
 #define ARGI_LOCAL0                     ARG_NONE
 #define ARGI_LOCAL1                     ARG_NONE
@@ -272,7 +291,7 @@
 #define ARGI_MATCH_OP                   ARGI_LIST6 (ARGI_PACKAGE,    ARGI_INTEGER,       ARGI_INTEGER,      ARGI_INTEGER,   ARGI_INTEGER,   ARGI_INTEGER)
 #define ARGI_METHOD_OP                  ARGI_INVALID_OPCODE
 #define ARGI_METHODCALL_OP              ARGI_INVALID_OPCODE
-#define ARGI_MID_OP                     ARGI_LIST4 (ARGI_BUFFERSTRING,ARGI_INTEGER,      ARGI_INTEGER,      ARGI_TARGETREF)
+#define ARGI_MID_OP                     ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER,  ARGI_INTEGER,      ARGI_TARGETREF)
 #define ARGI_MOD_OP                     ARGI_LIST3 (ARGI_INTEGER,    ARGI_INTEGER,       ARGI_TARGETREF)
 #define ARGI_MULTIPLY_OP                ARGI_LIST3 (ARGI_INTEGER,    ARGI_INTEGER,       ARGI_TARGETREF)
 #define ARGI_MUTEX_OP                   ARGI_INVALID_OPCODE
diff -Nru a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c
--- a/drivers/acpi/parser/psparse.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/parser/psparse.c	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c
--- a/drivers/acpi/parser/psscope.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/parser/psscope.c	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c
--- a/drivers/acpi/parser/pstree.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/acpi/parser/pstree.c	Sun Feb 23 22:25:23 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c
--- a/drivers/acpi/parser/psutils.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/parser/psutils.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c
--- a/drivers/acpi/parser/pswalk.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/parser/pswalk.c	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c
--- a/drivers/acpi/parser/psxface.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/parser/psxface.c	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
--- a/drivers/acpi/pci_irq.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/pci_irq.c	Sun Feb 23 22:25:24 2003
@@ -351,8 +351,10 @@
 			printk(" - using IRQ %d\n", dev->irq);
 			return_VALUE(dev->irq);
 		}
-		else
+		else {
+			printk("\n");
 			return_VALUE(0);
+		}
  	}
 
 	dev->irq = irq;
diff -Nru a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
--- a/drivers/acpi/pci_link.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/pci_link.c	Sun Feb 23 22:25:21 2003
@@ -306,13 +306,26 @@
 	memset(&resource, 0, sizeof(resource));
 
 	/* NOTE: PCI interrupts are always level / active_low / shared. */
-	resource.res.id = ACPI_RSTYPE_IRQ;
-	resource.res.length = sizeof(struct acpi_resource);
-	resource.res.data.irq.edge_level = ACPI_LEVEL_SENSITIVE;
-	resource.res.data.irq.active_high_low = ACPI_ACTIVE_LOW;
-	resource.res.data.irq.shared_exclusive = ACPI_SHARED;
-	resource.res.data.irq.number_of_interrupts = 1;
-	resource.res.data.irq.interrupts[0] = irq;
+	if (irq <= 15) {
+		resource.res.id = ACPI_RSTYPE_IRQ;
+		resource.res.length = sizeof(struct acpi_resource);
+		resource.res.data.irq.edge_level = ACPI_LEVEL_SENSITIVE;
+		resource.res.data.irq.active_high_low = ACPI_ACTIVE_LOW;
+		resource.res.data.irq.shared_exclusive = ACPI_SHARED;
+		resource.res.data.irq.number_of_interrupts = 1;
+		resource.res.data.irq.interrupts[0] = irq;
+	}
+	else {
+		resource.res.id = ACPI_RSTYPE_EXT_IRQ;
+		resource.res.length = sizeof(struct acpi_resource);
+		resource.res.data.extended_irq.producer_consumer = ACPI_CONSUMER;
+		resource.res.data.extended_irq.edge_level = ACPI_LEVEL_SENSITIVE;
+		resource.res.data.extended_irq.active_high_low = ACPI_ACTIVE_LOW;
+		resource.res.data.extended_irq.shared_exclusive = ACPI_SHARED;
+		resource.res.data.extended_irq.number_of_interrupts = 1;
+		resource.res.data.extended_irq.interrupts[0] = irq;
+		/* ignore resource_source, it's optional */
+	}
 	resource.end.id = ACPI_RSTYPE_END_TAG;
 
 	status = acpi_set_current_resources(link->handle, &buffer);
diff -Nru a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c
--- a/drivers/acpi/resources/rsaddr.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/resources/rsaddr.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
@@ -130,6 +149,8 @@
 		if (ACPI_IO_RANGE == output_struct->data.address16.resource_type) {
 			output_struct->data.address16.attribute.io.range_attribute =
 				(u16) (temp8 & 0x03);
+			output_struct->data.address16.attribute.io.translation_attribute =
+				(u16) ((temp8 >> 4) & 0x03);
 		}
 		else {
 			/* BUS_NUMBER_RANGE == Address16.Data->resource_type */
@@ -328,6 +349,9 @@
 		temp8 = (u8)
 			(linked_list->data.address16.attribute.io.range_attribute &
 			 0x03);
+		temp8 |=
+			(linked_list->data.address16.attribute.io.translation_attribute &
+			 0x03) << 4;
 	}
 
 	*buffer = temp8;
@@ -516,6 +540,8 @@
 		if (ACPI_IO_RANGE == output_struct->data.address32.resource_type) {
 			output_struct->data.address32.attribute.io.range_attribute =
 				(u16) (temp8 & 0x03);
+			output_struct->data.address32.attribute.io.translation_attribute =
+				(u16) ((temp8 >> 4) & 0x03);
 		}
 		else {
 			/* BUS_NUMBER_RANGE == output_struct->Data.Address32.resource_type */
@@ -712,6 +738,9 @@
 		temp8 = (u8)
 			(linked_list->data.address32.attribute.io.range_attribute &
 			 0x03);
+		temp8 |=
+			(linked_list->data.address32.attribute.io.translation_attribute &
+			 0x03) << 4;
 	}
 
 	*buffer = temp8;
@@ -899,6 +928,8 @@
 		if (ACPI_IO_RANGE == output_struct->data.address64.resource_type) {
 			output_struct->data.address64.attribute.io.range_attribute =
 				(u16) (temp8 & 0x03);
+			output_struct->data.address64.attribute.io.translation_attribute =
+				(u16) ((temp8 >> 4) & 0x03);
 		}
 		else {
 			/* BUS_NUMBER_RANGE == output_struct->Data.Address64.resource_type */
@@ -1099,6 +1130,9 @@
 		temp8 = (u8)
 			(linked_list->data.address64.attribute.io.range_attribute &
 			 0x03);
+		temp8 |=
+			(linked_list->data.address64.attribute.io.range_attribute &
+			 0x03) << 4;
 	}
 
 	*buffer = temp8;
diff -Nru a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
--- a/drivers/acpi/resources/rscalc.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/resources/rscalc.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
--- a/drivers/acpi/resources/rscreate.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/acpi/resources/rscreate.c	Sun Feb 23 22:25:23 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c
--- a/drivers/acpi/resources/rsdump.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/resources/rsdump.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
@@ -551,6 +570,11 @@
 					  "Invalid range attribute\n");
 			break;
 		}
+
+		acpi_os_printf (" Type Specific: %s Translation\n",
+			ACPI_SPARSE_TRANSLATION ==
+			address16_data->attribute.io.translation_attribute ?
+			"Sparse" : "Dense");
 		break;
 
 	case ACPI_BUS_NUMBER_RANGE:
@@ -673,26 +697,31 @@
 		acpi_os_printf ("  Resource Type: Io Range\n");
 
 		switch (address32_data->attribute.io.range_attribute) {
-			case ACPI_NON_ISA_ONLY_RANGES:
-				acpi_os_printf ("  Type Specific: "
-						  "Non-ISA Io Addresses\n");
-				break;
-
-			case ACPI_ISA_ONLY_RANGES:
-				acpi_os_printf ("  Type Specific: "
-						  "ISA Io Addresses\n");
-				break;
-
-			case ACPI_ENTIRE_RANGE:
-				acpi_os_printf ("  Type Specific: "
-						  "ISA and non-ISA Io Addresses\n");
-				break;
-
-			default:
-				acpi_os_printf ("  Type Specific: "
-						  "Invalid Range attribute");
-				break;
-			}
+		case ACPI_NON_ISA_ONLY_RANGES:
+			acpi_os_printf ("  Type Specific: "
+					  "Non-ISA Io Addresses\n");
+			break;
+
+		case ACPI_ISA_ONLY_RANGES:
+			acpi_os_printf ("  Type Specific: "
+					  "ISA Io Addresses\n");
+			break;
+
+		case ACPI_ENTIRE_RANGE:
+			acpi_os_printf ("  Type Specific: "
+					  "ISA and non-ISA Io Addresses\n");
+			break;
+
+		default:
+			acpi_os_printf ("  Type Specific: "
+					  "Invalid Range attribute");
+			break;
+		}
+
+		acpi_os_printf (" Type Specific: %s Translation\n",
+			ACPI_SPARSE_TRANSLATION ==
+			address32_data->attribute.io.translation_attribute ?
+			"Sparse" : "Dense");
 		break;
 
 	case ACPI_BUS_NUMBER_RANGE:
@@ -815,26 +844,31 @@
 		acpi_os_printf ("  Resource Type: Io Range\n");
 
 		switch (address64_data->attribute.io.range_attribute) {
-			case ACPI_NON_ISA_ONLY_RANGES:
-				acpi_os_printf ("  Type Specific: "
-						  "Non-ISA Io Addresses\n");
-				break;
-
-			case ACPI_ISA_ONLY_RANGES:
-				acpi_os_printf ("  Type Specific: "
-						  "ISA Io Addresses\n");
-				break;
-
-			case ACPI_ENTIRE_RANGE:
-				acpi_os_printf ("  Type Specific: "
-						  "ISA and non-ISA Io Addresses\n");
-				break;
-
-			default:
-				acpi_os_printf ("  Type Specific: "
-						  "Invalid Range attribute");
-				break;
-			}
+		case ACPI_NON_ISA_ONLY_RANGES:
+			acpi_os_printf ("  Type Specific: "
+					  "Non-ISA Io Addresses\n");
+			break;
+
+		case ACPI_ISA_ONLY_RANGES:
+			acpi_os_printf ("  Type Specific: "
+					  "ISA Io Addresses\n");
+			break;
+
+		case ACPI_ENTIRE_RANGE:
+			acpi_os_printf ("  Type Specific: "
+					  "ISA and non-ISA Io Addresses\n");
+			break;
+
+		default:
+			acpi_os_printf ("  Type Specific: "
+					  "Invalid Range attribute");
+			break;
+		}
+
+		acpi_os_printf (" Type Specific: %s Translation\n",
+			ACPI_SPARSE_TRANSLATION ==
+			address64_data->attribute.io.translation_attribute ?
+			"Sparse" : "Dense");
 		break;
 
 	case ACPI_BUS_NUMBER_RANGE:
diff -Nru a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c
--- a/drivers/acpi/resources/rsio.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/resources/rsio.c	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c
--- a/drivers/acpi/resources/rsirq.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/acpi/resources/rsirq.c	Sun Feb 23 22:25:27 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c
--- a/drivers/acpi/resources/rslist.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/acpi/resources/rslist.c	Sun Feb 23 22:25:27 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c
--- a/drivers/acpi/resources/rsmemory.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/resources/rsmemory.c	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
--- a/drivers/acpi/resources/rsmisc.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/resources/rsmisc.c	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c
--- a/drivers/acpi/resources/rsutils.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/resources/rsutils.c	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c
--- a/drivers/acpi/resources/rsxface.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/resources/rsxface.c	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c
--- a/drivers/acpi/tables/tbconvrt.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/acpi/tables/tbconvrt.c	Sun Feb 23 22:25:23 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c
--- a/drivers/acpi/tables/tbget.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/tables/tbget.c	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c
--- a/drivers/acpi/tables/tbgetall.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/tables/tbgetall.c	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
--- a/drivers/acpi/tables/tbinstal.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/tables/tbinstal.c	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c
--- a/drivers/acpi/tables/tbrsdt.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/tables/tbrsdt.c	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
--- a/drivers/acpi/tables/tbutils.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/tables/tbutils.c	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
--- a/drivers/acpi/tables/tbxface.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/tables/tbxface.c	Sun Feb 23 22:25:26 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c
--- a/drivers/acpi/tables/tbxfroot.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/tables/tbxfroot.c	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
--- a/drivers/acpi/toshiba_acpi.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/toshiba_acpi.c	Sun Feb 23 22:25:21 2003
@@ -2,7 +2,7 @@
  *  toshiba_acpi.c - Toshiba Laptop ACPI Extras
  *
  *
- *  Copyright (C) 2002 John Belmonte
+ *  Copyright (C) 2002-2003 John Belmonte
  *
  *  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
@@ -33,7 +33,7 @@
  *
  */
 
-#define TOSHIBA_ACPI_VERSION	"0.13"
+#define TOSHIBA_ACPI_VERSION	"0.14"
 #define PROC_INTERFACE_VERSION	1
 
 #include <linux/kernel.h>
@@ -41,19 +41,9 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/proc_fs.h>
-#include <linux/seq_file.h>
 #include <linux/version.h>
 
-#include <acpi/acconfig.h>
-#define OLD_ACPI_INTERFACE (ACPI_CA_VERSION < 0x20020000)
-
-#if OLD_ACPI_INTERFACE
-#include <acpi.h>
-extern struct proc_dir_entry* bm_proc_root;
-#define acpi_root_dir bm_proc_root
-#else
 #include <acpi/acpi_drivers.h>
-#endif
 
 MODULE_AUTHOR("John Belmonte");
 MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver");
@@ -101,47 +91,6 @@
 #define HCI_VIDEO_OUT_CRT		0x2
 #define HCI_VIDEO_OUT_TV		0x4
 
-static int toshiba_lcd_open_fs(struct inode *inode, struct file *file);
-static int toshiba_video_open_fs(struct inode *inode, struct file *file);
-static int toshiba_fan_open_fs(struct inode *inode, struct file *file);
-static int toshiba_keys_open_fs(struct inode *inode, struct file *file);
-static int toshiba_version_open_fs(struct inode *inode, struct file *file);
-
-static struct file_operations toshiba_lcd_fops = {
-	.open		= toshiba_lcd_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
-
-static struct file_operations toshiba_video_fops = {
-	.open		= toshiba_video_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
-
-static struct file_operations toshiba_fan_fops = {
-	.open		= toshiba_fan_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
-
-static struct file_operations toshiba_keys_fops = {
-	.open		= toshiba_keys_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
-
-static struct file_operations toshiba_version_fops = {
-	.open		= toshiba_version_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
-
 /* utility
  */
 
@@ -191,8 +140,8 @@
 static int
 read_acpi_int(const char* methodName, int* pVal)
 {
-	acpi_buffer results;
-	acpi_object out_objs[1];
+	struct acpi_buffer results;
+	union acpi_object out_objs[1];
 	acpi_status status;
 
 	results.length = sizeof(out_objs);
@@ -270,22 +219,50 @@
 	return status;
 }
 
-#define PROC_TOSHIBA		"toshiba"
-#define PROC_LCD		"lcd"
-#define PROC_VIDEO		"video"
-#define PROC_FAN		"fan"
-#define PROC_KEYS		"keys"
-#define PROC_VERSION		"version"
-
 static struct proc_dir_entry*	toshiba_proc_dir = NULL;
 static int			force_fan;
 static int			last_key_event;
 static int			key_event_valid;
 
+typedef struct _ProcItem
+{
+	char* name;
+	char* (*read_func)(char*);
+	unsigned long (*write_func)(const char*, unsigned long);
+} ProcItem;
+
 /* proc file handlers
  */
 
-static int toshiba_lcd_seq_show(struct seq_file *seq, void *offset)
+static int
+dispatch_read(char* page, char** start, off_t off, int count, int* eof,
+	ProcItem* item)
+{
+	char* p = page;
+	int len;
+
+	if (off == 0)
+		p = item->read_func(p);
+
+	/* ISSUE: I don't understand this code */
+	len = (p - page);
+	if (len <= off+count) *eof = 1;
+	*start = page + off;
+	len -= off;
+	if (len>count) len = count;
+	if (len<0) len = 0;
+	return len;
+}
+
+static int
+dispatch_write(struct file* file, const char* buffer, unsigned long count,
+	ProcItem* item)
+{
+	return item->write_func(buffer, count);
+}
+
+static char*
+read_lcd(char* p)
 {
 	u32 hci_result;
 	u32 value;
@@ -293,24 +270,18 @@
 	hci_read1(HCI_LCD_BRIGHTNESS, &value, &hci_result);
 	if (hci_result == HCI_SUCCESS) {
 		value = value >> HCI_LCD_BRIGHTNESS_SHIFT;
-		seq_printf(seq, "brightness:              %d\n"
-				"brightness_levels:       %d\n",
-				value,
-				HCI_LCD_BRIGHTNESS_LEVELS);
-	} else
-		seq_puts(seq, "ERROR\n");
-
-	return 0;
-}
+		p += sprintf(p, "brightness:              %d\n", value);
+		p += sprintf(p, "brightness_levels:       %d\n",
+			HCI_LCD_BRIGHTNESS_LEVELS);
+	} else {
+		p += sprintf(p, "ERROR\n");
+	}
 
-static int toshiba_lcd_open_fs(struct inode *inode, struct file *file)
-{
-	return single_open(file, toshiba_lcd_seq_show, NULL);
+	return p;
 }
 
-static int
-proc_write_lcd(struct file* file, const char* buffer, size_t count,
-	loff_t* data)
+static unsigned long
+write_lcd(const char* buffer, unsigned long count)
 {
 	int value;
 	/*int byte_count;*/
@@ -330,7 +301,8 @@
 	return count;
 }
 
-static int toshiba_video_seq_show(struct seq_file *seq, void *offset)
+static char*
+read_video(char* p)
 {
 	u32 hci_result;
 	u32 value;
@@ -340,26 +312,18 @@
 		int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0;
 		int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0;
 		int is_tv  = (value & HCI_VIDEO_OUT_TV ) ? 1 : 0;
-		seq_printf(seq, "lcd_out:                 %d\n"
-				"crt_out:                 %d\n"
-				"tv_out:                  %d\n",
-				is_lcd,
-				is_crt,
-				is_tv);
-	} else
-		seq_puts(seq, "ERROR\n");
+		p += sprintf(p, "lcd_out:                 %d\n", is_lcd);
+		p += sprintf(p, "crt_out:                 %d\n", is_crt);
+		p += sprintf(p, "tv_out:                  %d\n", is_tv);
+	} else {
+		p += sprintf(p, "ERROR\n");
+	}
 
-	return 0;
+	return p;
 }
 
-static int toshiba_video_open_fs(struct inode *inode, struct file *file)
-{
-	return single_open(file, toshiba_video_seq_show, NULL);
-}
-
-static int
-proc_write_video(struct file* file, const char* buffer, size_t count,
-	loff_t* data)
+static unsigned long
+write_video(const char* buffer, unsigned long count)
 {
 	int value;
 	const char* buffer_end = buffer + count;
@@ -400,31 +364,25 @@
 	return count;
 }
 
-static int toshiba_fan_seq_show(struct seq_file *seq, void *offset)
+static char*
+read_fan(char* p)
 {
 	u32 hci_result;
 	u32 value;
 
 	hci_read1(HCI_FAN, &value, &hci_result);
 	if (hci_result == HCI_SUCCESS) {
-		seq_printf(seq, "running:                 %d\n"
-				"force_on:                %d\n",
-				(value > 0),
-				force_fan);
-	} else
-		seq_puts(seq, "ERROR\n");
-
-	return 0;
-}
+		p += sprintf(p, "running:                 %d\n", (value > 0));
+		p += sprintf(p, "force_on:                %d\n", force_fan);
+	} else {
+		p += sprintf(p, "ERROR\n");
+	}
 
-static int toshiba_fan_open_fs(struct inode *inode, struct file *file)
-{
-	return single_open(file, toshiba_fan_seq_show, NULL);
+	return p;
 }
 
-static int
-proc_write_fan(struct file* file, const char* buffer, size_t count,
-	loff_t* data)
+static unsigned long
+write_fan(const char* buffer, unsigned long count)
 {
 	int value;
 	u32 hci_result;
@@ -443,7 +401,8 @@
 	return count;
 }
 
-static int toshiba_keys_seq_show(struct seq_file *seq, void *offset)
+static char*
+read_keys(char* p)
 {
 	u32 hci_result;
 	u32 value;
@@ -456,28 +415,20 @@
 		} else if (hci_result == HCI_EMPTY) {
 			/* better luck next time */
 		} else {
-			seq_puts(seq, "ERROR\n");
+			p += sprintf(p, "ERROR\n");
 			goto end;
 		}
 	}
 
-	seq_printf(seq, "hotkey_ready:            %d\n"
-			"hotkey:                  0x%04x\n",
-			key_event_valid,
-			last_key_event);
+	p += sprintf(p, "hotkey_ready:            %d\n", key_event_valid);
+	p += sprintf(p, "hotkey:                  0x%04x\n", last_key_event);
 
 end:
-	return 0;
+	return p;
 }
 
-static int toshiba_keys_open_fs(struct inode *inode, struct file *file)
-{
-	return single_open(file, toshiba_keys_seq_show, NULL);
-}
-
-static int
-proc_write_keys(struct file* file, const char* buffer, size_t count,
-	loff_t* data)
+static unsigned long
+write_keys(const char* buffer, unsigned long count)
 {
 	int value;
 
@@ -491,61 +442,44 @@
 	return count;
 }
 
-static int toshiba_version_seq_show(struct seq_file *seq, void *offset)
-{
-	seq_printf(seq, "driver:                  %s\n"
-			"proc_interface:          %d\n",
-			TOSHIBA_ACPI_VERSION,
-			PROC_INTERFACE_VERSION);
-
-	return 0;
-}
-
-static int toshiba_version_open_fs(struct inode *inode, struct file *file)
+static char*
+read_version(char* p)
 {
-	return single_open(file, toshiba_version_seq_show, NULL);
+	p += sprintf(p, "driver:                  %s\n", TOSHIBA_ACPI_VERSION);
+	p += sprintf(p, "proc_interface:          %d\n",
+		PROC_INTERFACE_VERSION);
+	return p;
 }
 
 /* proc and module init
  */
 
+#define PROC_TOSHIBA		"toshiba"
+
+ProcItem proc_items[] =
+{
+	{ "lcd"		, read_lcd	, write_lcd	},
+	{ "video"	, read_video	, write_video	},
+	{ "fan"		, read_fan	, write_fan	},
+	{ "keys"	, read_keys	, write_keys	},
+	{ "version"	, read_version	, 0		},
+	{ 0		, 0		, 0		},
+};
+
 static acpi_status
 add_device(void)
 {
 	struct proc_dir_entry* proc;
+	ProcItem* item;
 
-	proc = create_proc_entry(PROC_LCD, S_IFREG | S_IRUGO | S_IWUSR,
-		toshiba_proc_dir);
-	if (proc) {
-		proc->proc_fops = &toshiba_lcd_fops;
-		proc->proc_fops->write = proc_write_lcd;
-	}
-
-	proc = create_proc_entry(PROC_VIDEO, S_IFREG | S_IRUGO | S_IWUSR,
-		toshiba_proc_dir);
-	if (proc) {
-		proc->proc_fops = &toshiba_video_fops;
-		proc->proc_fops->write = proc_write_video;
-	}
-
-	proc = create_proc_entry(PROC_FAN, S_IFREG | S_IRUGO | S_IWUSR,
-		toshiba_proc_dir);
-	if (proc) {
-		proc->proc_fops = &toshiba_fan_fops;
-		proc->proc_fops->write = proc_write_fan;
-	}
-
-	proc = create_proc_entry(PROC_KEYS, S_IFREG | S_IRUGO | S_IWUSR,
-		toshiba_proc_dir);
-	if (proc) {
-		proc->proc_fops = &toshiba_keys_fops;
-		proc->proc_fops->write = proc_write_keys;
-	}
-
-	proc = create_proc_entry(PROC_VERSION, S_IFREG | S_IRUGO | S_IWUSR,
-		toshiba_proc_dir);
-	if (proc)
-		proc->proc_fops = &toshiba_version_fops;
+	for (item = proc_items; item->name; ++item)
+	{
+		proc = create_proc_read_entry(item->name,
+			S_IFREG | S_IRUGO | S_IWUSR,
+			toshiba_proc_dir, (read_proc_t*)dispatch_read, item);
+		if (proc && item->write_func)
+			proc->write_proc = (write_proc_t*)dispatch_write;
+	}
 
 	return(AE_OK);
 }
@@ -553,11 +487,10 @@
 static acpi_status
 remove_device(void)
 {
-	remove_proc_entry(PROC_LCD, toshiba_proc_dir);
-	remove_proc_entry(PROC_VIDEO, toshiba_proc_dir);
-	remove_proc_entry(PROC_FAN, toshiba_proc_dir);
-	remove_proc_entry(PROC_KEYS, toshiba_proc_dir);
-	remove_proc_entry(PROC_VERSION, toshiba_proc_dir);
+	ProcItem* item;
+
+	for (item = proc_items; item->name; ++item)
+		remove_proc_entry(item->name, toshiba_proc_dir);
 	return(AE_OK);
 }
 
diff -Nru a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
--- a/drivers/acpi/utilities/utalloc.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/utilities/utalloc.c	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
--- a/drivers/acpi/utilities/utcopy.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/utilities/utcopy.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
--- a/drivers/acpi/utilities/utdebug.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/utilities/utdebug.c	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
--- a/drivers/acpi/utilities/utdelete.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/utilities/utdelete.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
--- a/drivers/acpi/utilities/uteval.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/utilities/uteval.c	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
--- a/drivers/acpi/utilities/utglobal.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/utilities/utglobal.c	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #define DEFINE_ACPI_GLOBALS
@@ -358,14 +377,16 @@
 
 const char                *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] =
 {
-	"system_memory",
-	"system_iO",
+/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
+	"SystemMemory",
+	"SystemIO",
 	"PCI_Config",
-	"embedded_control",
+	"EmbeddedControl",
 	"SMBus",
 	"CMOS",
 	"PCIBARTarget",
-	"data_table",
+	"DataTable"
+/*! [End] no source code translation !*/
 };
 
 
@@ -381,7 +402,7 @@
 
 	else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS)
 	{
-		return ("invalid_space_iD");
+		return ("invalid_space_id");
 	}
 
 	return ((char *) acpi_gbl_region_types[space_id]);
diff -Nru a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c
--- a/drivers/acpi/utilities/utinit.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/acpi/utilities/utinit.c	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c
--- a/drivers/acpi/utilities/utmath.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/acpi/utilities/utmath.c	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
--- a/drivers/acpi/utilities/utmisc.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/acpi/utilities/utmisc.c	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  ******************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
--- a/drivers/acpi/utilities/utobject.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/acpi/utilities/utobject.c	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
--- a/drivers/acpi/utilities/utxface.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/acpi/utilities/utxface.c	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
--- a/drivers/block/cciss_scsi.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/block/cciss_scsi.c	Sun Feb 23 22:25:22 2003
@@ -737,7 +737,7 @@
 	sh->hostdata[0] = (unsigned long) hba[i];
 	sh->irq = hba[i]->intr;
 	sh->unique_id = sh->irq;
-	scsi_set_pci_device(sh, hba[i]->pdev);
+	scsi_set_device(sh, &hba[i]->pdev->dev);
 
 	return 1;	/* Say we have 1 scsi adapter, this will be */
 			/* called multiple times, once for each adapter */
diff -Nru a/drivers/block/floppy.c b/drivers/block/floppy.c
--- a/drivers/block/floppy.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/block/floppy.c	Sun Feb 23 22:25:22 2003
@@ -822,7 +822,7 @@
 		}
 	}
 	/*
-	 *	We should propogate failures to grab the resources back
+	 *	We should propagate failures to grab the resources back
 	 *	nicely from here. Actually we ought to rewrite the fd
 	 *	driver some day too.
 	 */
diff -Nru a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
--- a/drivers/bluetooth/Kconfig	Sun Feb 23 22:25:23 2003
+++ b/drivers/bluetooth/Kconfig	Sun Feb 23 22:25:23 2003
@@ -1,6 +1,6 @@
 
 menu "Bluetooth device drivers"
-	depends on BT!=n
+	depends on BT
 
 config BT_HCIUSB
 	tristate "HCI USB driver"
@@ -52,11 +52,19 @@
 	help
 	  BCSP (BlueCore Serial Protocol) is serial protocol for communication 
 	  between Bluetooth device and host. This protocol is required for non
-	  USB Bluetooth devices based on CSR BlueCore chip, including PCMCIA and 
+	  USB Bluetooth devices based on CSR BlueCore chip, including PCMCIA and
 	  CF cards.
 
 	  Say Y here to compile support for HCI BCSP protocol.
 
+config BT_HCIUART_BCSP_TXCRC
+        bool "Transmit CRC with every BCSP packet"
+        depends on BT_HCIUART_BCSP
+        help
+	  If you say Y here, a 16-bit CRC checksum will be transmitted along with
+	  every BCSP (BlueCore Serial Protocol) packet sent to the Bluetooth chip.
+	  This increases reliability, but slightly reduces efficiency.
+
 config BT_HCIDTL1
 	tristate "HCI DTL1 (PC Card) driver"
 	depends on PCMCIA && BT
@@ -64,8 +72,8 @@
 	  Bluetooth HCI DTL1 (PC Card) driver.
 	  This driver provides support for Bluetooth PCMCIA devices with
 	  Nokia DTL1 interface:
-	  Nokia Bluetooth Card
-	  Socket Bluetooth CF Card
+	     Nokia Bluetooth Card
+	     Socket Bluetooth CF Card
 
 	  Say Y here to compile support for HCI DTL1 devices into the
 	  kernel or say M to compile it as module (dtl1_cs).
@@ -73,12 +81,12 @@
 config BT_HCIBT3C
 	tristate "HCI BT3C (PC Card) driver"
 	depends on PCMCIA && BT
-	---help---
+	help
 	  Bluetooth HCI BT3C (PC Card) driver.
 	  This driver provides support for Bluetooth PCMCIA devices with
 	  3Com BT3C interface:
-	  3Com Bluetooth Card (3CRWB6096)
-	  HP Bluetooth Card
+	     3Com Bluetooth Card (3CRWB6096)
+	     HP Bluetooth Card
 
 	  The HCI BT3C driver uses external firmware loader program provided in
 	  the BlueFW package. For more information, see <http://bluez.sf.net>.
@@ -93,10 +101,26 @@
 	  Bluetooth HCI BlueCard (PC Card) driver.
 	  This driver provides support for Bluetooth PCMCIA devices with
 	  Anycom BlueCard interface:
-	  Anycom Bluetooth PC Card
-	  Anycom Bluetooth CF Card
+	     Anycom Bluetooth PC Card
+	     Anycom Bluetooth CF Card
 
 	  Say Y here to compile support for HCI BlueCard devices into the
+	  kernel or say M to compile it as module (bluecard_cs.o).
+
+config BT_HCIBTUART
+	tristate "HCI UART (PC Card) device driver"
+	depends on PCMCIA && BT
+	help
+	  Bluetooth HCI UART (PC Card) driver.
+	  This driver provides support for Bluetooth PCMCIA devices with
+	  an UART interface:
+	     Xircom CreditCard Bluetooth Adapter
+	     Xircom RealPort2 Bluetooth Adapter
+	     Sphinx PICO Card
+	     H-Soft blue+Card
+	     Cyber-blue Compact Flash Card
+
+	  Say Y here to compile support for HCI UART devices into the
 	  kernel or say M to compile it as module (bluecard_cs).
 
 config BT_HCIVHCI
diff -Nru a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
--- a/drivers/bluetooth/Makefile	Sun Feb 23 22:25:27 2003
+++ b/drivers/bluetooth/Makefile	Sun Feb 23 22:25:27 2003
@@ -8,6 +8,7 @@
 obj-$(CONFIG_BT_HCIDTL1)	+= dtl1_cs.o
 obj-$(CONFIG_BT_HCIBT3C)	+= bt3c_cs.o
 obj-$(CONFIG_BT_HCIBLUECARD)	+= bluecard_cs.o
+obj-$(CONFIG_BT_HCIBTUART)	+= btuart_cs.o
 
 hci_uart-y				:= hci_ldisc.o
 hci_uart-$(CONFIG_BT_HCIUART_H4)	+= hci_h4.o
diff -Nru a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
--- a/drivers/bluetooth/bluecard_cs.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/bluetooth/bluecard_cs.c	Sun Feb 23 22:25:24 2003
@@ -789,6 +789,8 @@
 	hdev->destruct = bluecard_hci_destruct;
 	hdev->ioctl = bluecard_hci_ioctl;
 
+	hdev->owner = THIS_MODULE;
+	
 	if (hci_register_dev(hdev) < 0) {
 		printk(KERN_WARNING "bluecard_cs: Can't register HCI device %s.\n", hdev->name);
 		return -ENODEV;
@@ -1002,8 +1004,6 @@
 		goto failed;
 	}
 
-	MOD_INC_USE_COUNT;
-
 	if (bluecard_open(info) != 0)
 		goto failed;
 
@@ -1028,8 +1028,6 @@
 
 	if (link->state & DEV_PRESENT)
 		bluecard_close(info);
-
-	MOD_DEC_USE_COUNT;
 
 	link->dev = NULL;
 
diff -Nru a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
--- a/drivers/bluetooth/bt3c_cs.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/bluetooth/bt3c_cs.c	Sun Feb 23 22:25:27 2003
@@ -546,6 +546,8 @@
 	hdev->destruct = bt3c_hci_destruct;
 	hdev->ioctl = bt3c_hci_ioctl;
 
+	hdev->owner = THIS_MODULE;
+	
 	if (hci_register_dev(hdev) < 0) {
 		printk(KERN_WARNING "bt3c_cs: Can't register HCI device %s.\n", hdev->name);
 		return -ENODEV;
@@ -788,8 +790,6 @@
 		goto failed;
 	}
 
-	MOD_INC_USE_COUNT;
-
 	if (bt3c_open(info) != 0)
 		goto failed;
 
@@ -814,8 +814,6 @@
 
 	if (link->state & DEV_PRESENT)
 		bt3c_close(info);
-
-	MOD_DEC_USE_COUNT;
 
 	link->dev = NULL;
 
diff -Nru a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/bluetooth/btuart_cs.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,903 @@
+/*
+ *
+ *  Driver for Bluetooth PCMCIA cards with HCI UART interface
+ *
+ *  Copyright (C) 2001-2002  Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ *  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;
+ *
+ *  Software distributed under the License is distributed on an "AS
+ *  IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ *  implied. See the License for the specific language governing
+ *  rights and limitations under the License.
+ *
+ *  The initial developer of the original code is David A. Hinds
+ *  <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
+ *  are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+#include <linux/sched.h>
+#include <linux/timer.h>
+#include <linux/errno.h>
+#include <linux/ptrace.h>
+#include <linux/ioport.h>
+#include <linux/spinlock.h>
+
+#include <linux/skbuff.h>
+#include <linux/string.h>
+#include <linux/serial.h>
+#include <linux/serial_reg.h>
+#include <asm/system.h>
+#include <asm/bitops.h>
+#include <asm/io.h>
+
+#include <pcmcia/version.h>
+#include <pcmcia/cs_types.h>
+#include <pcmcia/cs.h>
+#include <pcmcia/cistpl.h>
+#include <pcmcia/ciscode.h>
+#include <pcmcia/ds.h>
+#include <pcmcia/cisreg.h>
+
+#include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/hci_core.h>
+
+
+
+/* ======================== Module parameters ======================== */
+
+
+/* Bit map of interrupts to choose from */
+static u_int irq_mask = 0xffff;
+static int irq_list[4] = { -1 };
+
+MODULE_PARM(irq_mask, "i");
+MODULE_PARM(irq_list, "1-4i");
+
+MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
+MODULE_DESCRIPTION("Bluetooth driver for Bluetooth PCMCIA cards with HCI UART interface");
+MODULE_LICENSE("GPL");
+
+
+
+/* ======================== Local structures ======================== */
+
+
+typedef struct btuart_info_t {
+	dev_link_t link;
+	dev_node_t node;
+
+	struct hci_dev hdev;
+
+	spinlock_t lock;	/* For serializing operations */
+
+	struct sk_buff_head txq;
+	unsigned long tx_state;
+
+	unsigned long rx_state;
+	unsigned long rx_count;
+	struct sk_buff *rx_skb;
+} btuart_info_t;
+
+
+void btuart_config(dev_link_t *link);
+void btuart_release(u_long arg);
+int btuart_event(event_t event, int priority, event_callback_args_t *args);
+
+static dev_info_t dev_info = "btuart_cs";
+
+dev_link_t *btuart_attach(void);
+void btuart_detach(dev_link_t *);
+
+static dev_link_t *dev_list = NULL;
+
+
+/* Maximum baud rate */
+#define SPEED_MAX  115200
+
+/* Default baud rate: 57600, 115200, 230400 or 460800 */
+#define DEFAULT_BAUD_RATE  115200
+
+
+/* Transmit states  */
+#define XMIT_SENDING	1
+#define XMIT_WAKEUP	2
+#define XMIT_WAITING	8
+
+/* Receiver states */
+#define RECV_WAIT_PACKET_TYPE	0
+#define RECV_WAIT_EVENT_HEADER	1
+#define RECV_WAIT_ACL_HEADER	2
+#define RECV_WAIT_SCO_HEADER	3
+#define RECV_WAIT_DATA		4
+
+
+
+/* ======================== Interrupt handling ======================== */
+
+
+static int btuart_write(unsigned int iobase, int fifo_size, __u8 *buf, int len)
+{
+	int actual = 0;
+
+	/* Tx FIFO should be empty */
+	if (!(inb(iobase + UART_LSR) & UART_LSR_THRE))
+		return 0;
+
+	/* Fill FIFO with current frame */
+	while ((fifo_size-- > 0) && (actual < len)) {
+		/* Transmit next byte */
+		outb(buf[actual], iobase + UART_TX);
+		actual++;
+	}
+
+	return actual;
+}
+
+
+static void btuart_write_wakeup(btuart_info_t *info)
+{
+	if (!info) {
+		printk(KERN_WARNING "btuart_cs: Call of write_wakeup for unknown device.\n");
+		return;
+	}
+
+	if (test_and_set_bit(XMIT_SENDING, &(info->tx_state))) {
+		set_bit(XMIT_WAKEUP, &(info->tx_state));
+		return;
+	}
+
+	do {
+		register unsigned int iobase = info->link.io.BasePort1;
+		register struct sk_buff *skb;
+		register int len;
+
+		clear_bit(XMIT_WAKEUP, &(info->tx_state));
+
+		if (!(info->link.state & DEV_PRESENT))
+			return;
+
+		if (!(skb = skb_dequeue(&(info->txq))))
+			break;
+
+		/* Send frame */
+		len = btuart_write(iobase, 16, skb->data, skb->len);
+		set_bit(XMIT_WAKEUP, &(info->tx_state));
+
+		if (len == skb->len) {
+			kfree_skb(skb);
+		} else {
+			skb_pull(skb, len);
+			skb_queue_head(&(info->txq), skb);
+		}
+
+		info->hdev.stat.byte_tx += len;
+
+	} while (test_bit(XMIT_WAKEUP, &(info->tx_state)));
+
+	clear_bit(XMIT_SENDING, &(info->tx_state));
+}
+
+
+static void btuart_receive(btuart_info_t *info)
+{
+	unsigned int iobase;
+	int boguscount = 0;
+
+	if (!info) {
+		printk(KERN_WARNING "btuart_cs: Call of receive for unknown device.\n");
+		return;
+	}
+
+	iobase = info->link.io.BasePort1;
+
+	do {
+		info->hdev.stat.byte_rx++;
+
+		/* Allocate packet */
+		if (info->rx_skb == NULL) {
+			info->rx_state = RECV_WAIT_PACKET_TYPE;
+			info->rx_count = 0;
+			if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) {
+				printk(KERN_WARNING "btuart_cs: Can't allocate mem for new packet.\n");
+				return;
+			}
+		}
+
+		if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
+
+			info->rx_skb->dev = (void *)&(info->hdev);
+			info->rx_skb->pkt_type = inb(iobase + UART_RX);
+
+			switch (info->rx_skb->pkt_type) {
+
+			case HCI_EVENT_PKT:
+				info->rx_state = RECV_WAIT_EVENT_HEADER;
+				info->rx_count = HCI_EVENT_HDR_SIZE;
+				break;
+
+			case HCI_ACLDATA_PKT:
+				info->rx_state = RECV_WAIT_ACL_HEADER;
+				info->rx_count = HCI_ACL_HDR_SIZE;
+				break;
+
+			case HCI_SCODATA_PKT:
+				info->rx_state = RECV_WAIT_SCO_HEADER;
+				info->rx_count = HCI_SCO_HDR_SIZE;
+				break;
+
+			default:
+				/* Unknown packet */
+				printk(KERN_WARNING "btuart_cs: Unknown HCI packet with type 0x%02x received.\n", info->rx_skb->pkt_type);
+				info->hdev.stat.err_rx++;
+				clear_bit(HCI_RUNNING, &(info->hdev.flags));
+
+				kfree_skb(info->rx_skb);
+				info->rx_skb = NULL;
+				break;
+
+			}
+
+		} else {
+
+			*skb_put(info->rx_skb, 1) = inb(iobase + UART_RX);
+			info->rx_count--;
+
+			if (info->rx_count == 0) {
+
+				int dlen;
+				struct hci_event_hdr *eh;
+				struct hci_acl_hdr *ah;
+				struct hci_sco_hdr *sh;
+
+
+				switch (info->rx_state) {
+
+				case RECV_WAIT_EVENT_HEADER:
+					eh = (struct hci_event_hdr *)(info->rx_skb->data);
+					info->rx_state = RECV_WAIT_DATA;
+					info->rx_count = eh->plen;
+					break;
+
+				case RECV_WAIT_ACL_HEADER:
+					ah = (struct hci_acl_hdr *)(info->rx_skb->data);
+					dlen = __le16_to_cpu(ah->dlen);
+					info->rx_state = RECV_WAIT_DATA;
+					info->rx_count = dlen;
+					break;
+
+				case RECV_WAIT_SCO_HEADER:
+					sh = (struct hci_sco_hdr *)(info->rx_skb->data);
+					info->rx_state = RECV_WAIT_DATA;
+					info->rx_count = sh->dlen;
+					break;
+
+				case RECV_WAIT_DATA:
+					hci_recv_frame(info->rx_skb);
+					info->rx_skb = NULL;
+					break;
+
+				}
+
+			}
+
+		}
+
+		/* Make sure we don't stay here to long */
+		if (boguscount++ > 16)
+			break;
+
+	} while (inb(iobase + UART_LSR) & UART_LSR_DR);
+}
+
+
+void btuart_interrupt(int irq, void *dev_inst, struct pt_regs *regs)
+{
+	btuart_info_t *info = dev_inst;
+	unsigned int iobase;
+	int boguscount = 0;
+	int iir, lsr;
+
+	if (!info) {
+		printk(KERN_WARNING "btuart_cs: Call of irq %d for unknown device.\n", irq);
+		return;
+	}
+
+	iobase = info->link.io.BasePort1;
+
+	spin_lock(&(info->lock));
+
+	iir = inb(iobase + UART_IIR) & UART_IIR_ID;
+	while (iir) {
+
+		/* Clear interrupt */
+		lsr = inb(iobase + UART_LSR);
+
+		switch (iir) {
+		case UART_IIR_RLSI:
+			printk(KERN_NOTICE "btuart_cs: RLSI\n");
+			break;
+		case UART_IIR_RDI:
+			/* Receive interrupt */
+			btuart_receive(info);
+			break;
+		case UART_IIR_THRI:
+			if (lsr & UART_LSR_THRE) {
+				/* Transmitter ready for data */
+				btuart_write_wakeup(info);
+			}
+			break;
+		default:
+			printk(KERN_NOTICE "btuart_cs: Unhandled IIR=%#x\n", iir);
+			break;
+		}
+
+		/* Make sure we don't stay here to long */
+		if (boguscount++ > 100)
+			break;
+
+		iir = inb(iobase + UART_IIR) & UART_IIR_ID;
+
+	}
+
+	spin_unlock(&(info->lock));
+}
+
+
+static void btuart_change_speed(btuart_info_t *info, unsigned int speed)
+{
+	unsigned long flags;
+	unsigned int iobase;
+	int fcr;		/* FIFO control reg */
+	int lcr;		/* Line control reg */
+	int divisor;
+
+	if (!info) {
+		printk(KERN_WARNING "btuart_cs: Call of change speed for unknown device.\n");
+		return;
+	}
+
+	iobase = info->link.io.BasePort1;
+
+	spin_lock_irqsave(&(info->lock), flags);
+
+	/* Turn off interrupts */
+	outb(0, iobase + UART_IER);
+
+	divisor = SPEED_MAX / speed;
+
+	fcr = UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT;
+
+	/* 
+	 * Use trigger level 1 to avoid 3 ms. timeout delay at 9600 bps, and
+	 * almost 1,7 ms at 19200 bps. At speeds above that we can just forget
+	 * about this timeout since it will always be fast enough. 
+	 */
+
+	if (speed < 38400)
+		fcr |= UART_FCR_TRIGGER_1;
+	else
+		fcr |= UART_FCR_TRIGGER_14;
+
+	/* Bluetooth cards use 8N1 */
+	lcr = UART_LCR_WLEN8;
+
+	outb(UART_LCR_DLAB | lcr, iobase + UART_LCR);	/* Set DLAB */
+	outb(divisor & 0xff, iobase + UART_DLL);	/* Set speed */
+	outb(divisor >> 8, iobase + UART_DLM);
+	outb(lcr, iobase + UART_LCR);	/* Set 8N1  */
+	outb(fcr, iobase + UART_FCR);	/* Enable FIFO's */
+
+	/* Turn on interrups */
+	outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
+
+	spin_unlock_irqrestore(&(info->lock), flags);
+}
+
+
+
+/* ======================== HCI interface ======================== */
+
+
+static int btuart_hci_flush(struct hci_dev *hdev)
+{
+	btuart_info_t *info = (btuart_info_t *)(hdev->driver_data);
+
+	/* Drop TX queue */
+	skb_queue_purge(&(info->txq));
+
+	return 0;
+}
+
+
+static int btuart_hci_open(struct hci_dev *hdev)
+{
+	set_bit(HCI_RUNNING, &(hdev->flags));
+
+	return 0;
+}
+
+
+static int btuart_hci_close(struct hci_dev *hdev)
+{
+	if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
+		return 0;
+
+	btuart_hci_flush(hdev);
+
+	return 0;
+}
+
+
+static int btuart_hci_send_frame(struct sk_buff *skb)
+{
+	btuart_info_t *info;
+	struct hci_dev *hdev = (struct hci_dev *)(skb->dev);
+
+	if (!hdev) {
+		printk(KERN_WARNING "btuart_cs: Frame for unknown HCI device (hdev=NULL).");
+		return -ENODEV;
+	}
+
+	info = (btuart_info_t *)(hdev->driver_data);
+
+	switch (skb->pkt_type) {
+	case HCI_COMMAND_PKT:
+		hdev->stat.cmd_tx++;
+		break;
+	case HCI_ACLDATA_PKT:
+		hdev->stat.acl_tx++;
+		break;
+	case HCI_SCODATA_PKT:
+		hdev->stat.sco_tx++;
+		break;
+	};
+
+	/* Prepend skb with frame type */
+	memcpy(skb_push(skb, 1), &(skb->pkt_type), 1);
+	skb_queue_tail(&(info->txq), skb);
+
+	btuart_write_wakeup(info);
+
+	return 0;
+}
+
+
+static void btuart_hci_destruct(struct hci_dev *hdev)
+{
+}
+
+
+static int btuart_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
+{
+	return -ENOIOCTLCMD;
+}
+
+
+
+/* ======================== Card services HCI interaction ======================== */
+
+
+int btuart_open(btuart_info_t *info)
+{
+	unsigned long flags;
+	unsigned int iobase = info->link.io.BasePort1;
+	struct hci_dev *hdev;
+
+	spin_lock_init(&(info->lock));
+
+	skb_queue_head_init(&(info->txq));
+
+	info->rx_state = RECV_WAIT_PACKET_TYPE;
+	info->rx_count = 0;
+	info->rx_skb = NULL;
+
+	spin_lock_irqsave(&(info->lock), flags);
+
+	/* Reset UART */
+	outb(0, iobase + UART_MCR);
+
+	/* Turn off interrupts */
+	outb(0, iobase + UART_IER);
+
+	/* Initialize UART */
+	outb(UART_LCR_WLEN8, iobase + UART_LCR);	/* Reset DLAB */
+	outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase + UART_MCR);
+
+	/* Turn on interrupts */
+	// outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
+
+	spin_unlock_irqrestore(&(info->lock), flags);
+
+	btuart_change_speed(info, DEFAULT_BAUD_RATE);
+
+	/* Timeout before it is safe to send the first HCI packet */
+	set_current_state(TASK_INTERRUPTIBLE);
+	schedule_timeout(HZ);
+
+
+	/* Initialize and register HCI device */
+
+	hdev = &(info->hdev);
+
+	hdev->type = HCI_PCCARD;
+	hdev->driver_data = info;
+
+	hdev->open = btuart_hci_open;
+	hdev->close = btuart_hci_close;
+	hdev->flush = btuart_hci_flush;
+	hdev->send = btuart_hci_send_frame;
+	hdev->destruct = btuart_hci_destruct;
+	hdev->ioctl = btuart_hci_ioctl;
+
+	hdev->owner = THIS_MODULE;
+	
+	if (hci_register_dev(hdev) < 0) {
+		printk(KERN_WARNING "btuart_cs: Can't register HCI device %s.\n", hdev->name);
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+
+int btuart_close(btuart_info_t *info)
+{
+	unsigned long flags;
+	unsigned int iobase = info->link.io.BasePort1;
+	struct hci_dev *hdev = &(info->hdev);
+
+	btuart_hci_close(hdev);
+
+	spin_lock_irqsave(&(info->lock), flags);
+
+	/* Reset UART */
+	outb(0, iobase + UART_MCR);
+
+	/* Turn off interrupts */
+	outb(0, iobase + UART_IER);
+
+	spin_unlock_irqrestore(&(info->lock), flags);
+
+	if (hci_unregister_dev(hdev) < 0)
+		printk(KERN_WARNING "btuart_cs: Can't unregister HCI device %s.\n", hdev->name);
+
+	return 0;
+}
+
+
+
+/* ======================== Card services ======================== */
+
+
+static void cs_error(client_handle_t handle, int func, int ret)
+{
+	error_info_t err = { func, ret };
+
+	CardServices(ReportError, handle, &err);
+}
+
+
+dev_link_t *btuart_attach(void)
+{
+	btuart_info_t *info;
+	client_reg_t client_reg;
+	dev_link_t *link;
+	int i, ret;
+
+	/* Create new info device */
+	info = kmalloc(sizeof(*info), GFP_KERNEL);
+	if (!info)
+		return NULL;
+	memset(info, 0, sizeof(*info));
+
+	link = &info->link;
+	link->priv = info;
+
+	init_timer(&link->release);
+	link->release.function = &btuart_release;
+	link->release.data = (u_long)link;
+	link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
+	link->io.NumPorts1 = 8;
+	link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
+	link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID;
+
+	if (irq_list[0] == -1)
+		link->irq.IRQInfo2 = irq_mask;
+	else
+		for (i = 0; i < 4; i++)
+			link->irq.IRQInfo2 |= 1 << irq_list[i];
+
+	link->irq.Handler = btuart_interrupt;
+	link->irq.Instance = info;
+
+	link->conf.Attributes = CONF_ENABLE_IRQ;
+	link->conf.Vcc = 50;
+	link->conf.IntType = INT_MEMORY_AND_IO;
+
+	/* Register with Card Services */
+	link->next = dev_list;
+	dev_list = link;
+	client_reg.dev_info = &dev_info;
+	client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
+	client_reg.EventMask =
+		CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
+		CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
+		CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
+	client_reg.event_handler = &btuart_event;
+	client_reg.Version = 0x0210;
+	client_reg.event_callback_args.client_data = link;
+
+	ret = CardServices(RegisterClient, &link->handle, &client_reg);
+	if (ret != CS_SUCCESS) {
+		cs_error(link->handle, RegisterClient, ret);
+		btuart_detach(link);
+		return NULL;
+	}
+
+	return link;
+}
+
+
+void btuart_detach(dev_link_t *link)
+{
+	btuart_info_t *info = link->priv;
+	dev_link_t **linkp;
+	int ret;
+
+	/* Locate device structure */
+	for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
+		if (*linkp == link)
+			break;
+
+	if (*linkp == NULL)
+		return;
+
+	del_timer(&link->release);
+	if (link->state & DEV_CONFIG)
+		btuart_release((u_long)link);
+
+	if (link->handle) {
+		ret = CardServices(DeregisterClient, link->handle);
+		if (ret != CS_SUCCESS)
+			cs_error(link->handle, DeregisterClient, ret);
+	}
+
+	/* Unlink device structure, free bits */
+	*linkp = link->next;
+
+	kfree(info);
+}
+
+
+static int get_tuple(int fn, client_handle_t handle, tuple_t *tuple, cisparse_t *parse)
+{
+	int i;
+
+	i = CardServices(fn, handle, tuple);
+	if (i != CS_SUCCESS)
+		return CS_NO_MORE_ITEMS;
+
+	i = CardServices(GetTupleData, handle, tuple);
+	if (i != CS_SUCCESS)
+		return i;
+
+	return CardServices(ParseTuple, handle, tuple, parse);
+}
+
+
+#define first_tuple(a, b, c) get_tuple(GetFirstTuple, a, b, c)
+#define next_tuple(a, b, c) get_tuple(GetNextTuple, a, b, c)
+
+void btuart_config(dev_link_t *link)
+{
+	static ioaddr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
+	client_handle_t handle = link->handle;
+	btuart_info_t *info = link->priv;
+	tuple_t tuple;
+	u_short buf[256];
+	cisparse_t parse;
+	cistpl_cftable_entry_t *cf = &parse.cftable_entry;
+	config_info_t config;
+	int i, j, try, last_ret, last_fn;
+
+	tuple.TupleData = (cisdata_t *)buf;
+	tuple.TupleOffset = 0;
+	tuple.TupleDataMax = 255;
+	tuple.Attributes = 0;
+
+	/* Get configuration register information */
+	tuple.DesiredTuple = CISTPL_CONFIG;
+	last_ret = first_tuple(handle, &tuple, &parse);
+	if (last_ret != CS_SUCCESS) {
+		last_fn = ParseTuple;
+		goto cs_failed;
+	}
+	link->conf.ConfigBase = parse.config.base;
+	link->conf.Present = parse.config.rmask[0];
+
+	/* Configure card */
+	link->state |= DEV_CONFIG;
+	i = CardServices(GetConfigurationInfo, handle, &config);
+	link->conf.Vcc = config.Vcc;
+
+	/* First pass: look for a config entry that looks normal. */
+	tuple.TupleData = (cisdata_t *) buf;
+	tuple.TupleOffset = 0;
+	tuple.TupleDataMax = 255;
+	tuple.Attributes = 0;
+	tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
+	/* Two tries: without IO aliases, then with aliases */
+	for (try = 0; try < 2; try++) {
+		i = first_tuple(handle, &tuple, &parse);
+		while (i != CS_NO_MORE_ITEMS) {
+			if (i != CS_SUCCESS)
+				goto next_entry;
+			if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
+				link->conf.Vpp1 = link->conf.Vpp2 = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
+			if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && (cf->io.win[0].base != 0)) {
+				link->conf.ConfigIndex = cf->index;
+				link->io.BasePort1 = cf->io.win[0].base;
+				link->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
+				i = CardServices(RequestIO, link->handle, &link->io);
+				if (i == CS_SUCCESS)
+					goto found_port;
+			}
+next_entry:
+			i = next_tuple(handle, &tuple, &parse);
+		}
+	}
+
+	/* Second pass: try to find an entry that isn't picky about
+	   its base address, then try to grab any standard serial port
+	   address, and finally try to get any free port. */
+	i = first_tuple(handle, &tuple, &parse);
+	while (i != CS_NO_MORE_ITEMS) {
+		if ((i == CS_SUCCESS) && (cf->io.nwin > 0)
+		    && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
+			link->conf.ConfigIndex = cf->index;
+			for (j = 0; j < 5; j++) {
+				link->io.BasePort1 = base[j];
+				link->io.IOAddrLines = base[j] ? 16 : 3;
+				i = CardServices(RequestIO, link->handle, &link->io);
+				if (i == CS_SUCCESS)
+					goto found_port;
+			}
+		}
+		i = next_tuple(handle, &tuple, &parse);
+	}
+
+found_port:
+	if (i != CS_SUCCESS) {
+		printk(KERN_NOTICE "btuart_cs: No usable port range found. Giving up.\n");
+		cs_error(link->handle, RequestIO, i);
+		goto failed;
+	}
+
+	i = CardServices(RequestIRQ, link->handle, &link->irq);
+	if (i != CS_SUCCESS) {
+		cs_error(link->handle, RequestIRQ, i);
+		link->irq.AssignedIRQ = 0;
+	}
+
+	i = CardServices(RequestConfiguration, link->handle, &link->conf);
+	if (i != CS_SUCCESS) {
+		cs_error(link->handle, RequestConfiguration, i);
+		goto failed;
+	}
+
+	if (btuart_open(info) != 0)
+		goto failed;
+
+	strcpy(info->node.dev_name, info->hdev.name);
+	link->dev = &info->node;
+	link->state &= ~DEV_CONFIG_PENDING;
+
+	return;
+
+cs_failed:
+	cs_error(link->handle, last_fn, last_ret);
+
+failed:
+	btuart_release((u_long) link);
+}
+
+
+void btuart_release(u_long arg)
+{
+	dev_link_t *link = (dev_link_t *)arg;
+	btuart_info_t *info = link->priv;
+
+	if (link->state & DEV_PRESENT)
+		btuart_close(info);
+
+	link->dev = NULL;
+
+	CardServices(ReleaseConfiguration, link->handle);
+	CardServices(ReleaseIO, link->handle, &link->io);
+	CardServices(ReleaseIRQ, link->handle, &link->irq);
+
+	link->state &= ~DEV_CONFIG;
+}
+
+
+int btuart_event(event_t event, int priority, event_callback_args_t *args)
+{
+	dev_link_t *link = args->client_data;
+	btuart_info_t *info = link->priv;
+
+	switch (event) {
+	case CS_EVENT_CARD_REMOVAL:
+		link->state &= ~DEV_PRESENT;
+		if (link->state & DEV_CONFIG) {
+			btuart_close(info);
+			mod_timer(&link->release, jiffies + HZ / 20);
+		}
+		break;
+	case CS_EVENT_CARD_INSERTION:
+		link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
+		btuart_config(link);
+		break;
+	case CS_EVENT_PM_SUSPEND:
+		link->state |= DEV_SUSPEND;
+		/* Fall through... */
+	case CS_EVENT_RESET_PHYSICAL:
+		if (link->state & DEV_CONFIG)
+			CardServices(ReleaseConfiguration, link->handle);
+		break;
+	case CS_EVENT_PM_RESUME:
+		link->state &= ~DEV_SUSPEND;
+		/* Fall through... */
+	case CS_EVENT_CARD_RESET:
+		if (DEV_OK(link))
+			CardServices(RequestConfiguration, link->handle, &link->conf);
+		break;
+	}
+
+	return 0;
+}
+
+
+
+/* ======================== Module initialization ======================== */
+
+
+int __init init_btuart_cs(void)
+{
+	servinfo_t serv;
+	int err;
+
+	CardServices(GetCardServicesInfo, &serv);
+	if (serv.Revision != CS_RELEASE_CODE) {
+		printk(KERN_NOTICE "btuart_cs: Card Services release does not match!\n");
+		return -1;
+	}
+
+	err = register_pccard_driver(&dev_info, &btuart_attach, &btuart_detach);
+
+	return err;
+}
+
+
+void __exit exit_btuart_cs(void)
+{
+	unregister_pccard_driver(&dev_info);
+
+	while (dev_list != NULL)
+		btuart_detach(dev_list);
+}
+
+
+module_init(init_btuart_cs);
+module_exit(exit_btuart_cs);
diff -Nru a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
--- a/drivers/bluetooth/dtl1_cs.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/bluetooth/dtl1_cs.c	Sun Feb 23 22:25:23 2003
@@ -520,6 +520,8 @@
 	hdev->destruct = dtl1_hci_destruct;
 	hdev->ioctl = dtl1_hci_ioctl;
 
+	hdev->owner = THIS_MODULE;
+	
 	if (hci_register_dev(hdev) < 0) {
 		printk(KERN_WARNING "dtl1_cs: Can't register HCI device %s.\n", hdev->name);
 		return -ENODEV;
@@ -747,8 +749,6 @@
 		goto failed;
 	}
 
-	MOD_INC_USE_COUNT;
-
 	if (dtl1_open(info) != 0)
 		goto failed;
 
@@ -773,8 +773,6 @@
 
 	if (link->state & DEV_PRESENT)
 		dtl1_close(info);
-
-	MOD_DEC_USE_COUNT;
 
 	link->dev = NULL;
 
diff -Nru a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
--- a/drivers/bluetooth/hci_ldisc.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/bluetooth/hci_ldisc.c	Sun Feb 23 22:25:25 2003
@@ -250,8 +250,6 @@
 
 	hu = (struct hci_uart *) hdev->driver_data;
 	kfree(hu);
-
-	MOD_DEC_USE_COUNT;
 }
 
 /* ------ LDISC part ------ */
@@ -290,8 +288,7 @@
 
 	if (tty->driver.flush_buffer)
 		tty->driver.flush_buffer(tty);
-	
-	MOD_INC_USE_COUNT;
+
 	return 0;
 }
 
@@ -317,8 +314,6 @@
 			hu->proto->close(hu);
 			hci_unregister_dev(hdev);
 		}
-
-		MOD_DEC_USE_COUNT;
 	}
 }
 
@@ -411,11 +406,13 @@
 	hdev->send  = hci_uart_send_frame;
 	hdev->destruct = hci_uart_destruct;
 
+	hdev->owner = THIS_MODULE;
+	
 	if (hci_register_dev(hdev) < 0) {
 		BT_ERR("Can't register HCI device %s", hdev->name);
 		return -ENODEV;
 	}
-	MOD_INC_USE_COUNT;
+
 	return 0;
 }
 
diff -Nru a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
--- a/drivers/bluetooth/hci_usb.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/bluetooth/hci_usb.c	Sun Feb 23 22:25:26 2003
@@ -207,18 +207,15 @@
 	if (test_and_set_bit(HCI_RUNNING, &hdev->flags))
 		return 0;
 
-	MOD_INC_USE_COUNT;
-
 	write_lock_irqsave(&husb->completion_lock, flags);
 
 	err = hci_usb_enable_intr(husb);
 	if (!err) {
 		for (i = 0; i < HCI_MAX_BULK_RX; i++)
 			hci_usb_rx_submit(husb, NULL);
-	} else {
+	} else
 		clear_bit(HCI_RUNNING, &hdev->flags);
-		MOD_DEC_USE_COUNT;
-	}
+	
 
 	write_unlock_irqrestore(&husb->completion_lock, flags);
 	return err;
@@ -271,8 +268,6 @@
 	hci_usb_flush(hdev);
 
 	write_unlock_irqrestore(&husb->completion_lock, flags);
-
-	MOD_DEC_USE_COUNT;
 	return 0;
 }
 
@@ -758,6 +753,8 @@
 	hdev->send  = hci_usb_send_frame;
 	hdev->destruct = hci_usb_destruct;
 
+	hdev->owner = THIS_MODULE;
+	
 	if (hci_register_dev(hdev) < 0) {
 		BT_ERR("Can't register HCI device");
 		goto probe_error;
diff -Nru a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
--- a/drivers/bluetooth/hci_vhci.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/bluetooth/hci_vhci.c	Sun Feb 23 22:25:26 2003
@@ -84,8 +84,6 @@
 
 	vhci = (struct hci_vhci_struct *) hdev->driver_data;
 	kfree(vhci);
-
-	MOD_DEC_USE_COUNT;
 }
 
 static int hci_vhci_send_frame(struct sk_buff *skb)
@@ -288,11 +286,12 @@
 	hdev->send  = hci_vhci_send_frame;
 	hdev->destruct = hci_vhci_destruct;
 
+	hdev->owner = THIS_MODULE;
+	
 	if (hci_register_dev(hdev) < 0) {
 		kfree(hci_vhci);
 		return -EBUSY;
 	}
-	MOD_INC_USE_COUNT;
 
 	file->private_data = hci_vhci;
 	return 0;   
diff -Nru a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
--- a/drivers/char/agp/via-agp.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/char/agp/via-agp.c	Sun Feb 23 22:25:26 2003
@@ -227,7 +227,7 @@
 
 			printk (KERN_INFO PFX "Found KT400 in disguise as a KT266.\n");
 
-			/* Check AGP compatability mode. */
+			/* Check AGP compatibility mode. */
 			pci_read_config_byte(pdev, VIA_AGPSEL, &reg);
 			if ((reg & (1<<1))==0)
 				return via_generic_agp3_setup(pdev);
@@ -271,7 +271,7 @@
 {
 	u8 reg;
 	pci_read_config_byte(pdev, VIA_AGPSEL, &reg);
-	/* Check AGP 2.0 compatability mode. */
+	/* Check AGP 2.0 compatibility mode. */
 	if ((reg & (1<<1))==0)
 		return via_generic_agp3_setup(pdev);
 	return via_generic_setup(pdev);
diff -Nru a/drivers/char/amiserial.c b/drivers/char/amiserial.c
--- a/drivers/char/amiserial.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/char/amiserial.c	Sun Feb 23 22:25:27 2003
@@ -50,7 +50,7 @@
   
 #if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
 #define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \
- kdevname(tty->device), (info->flags), serial_refcount,info->count,tty->count,s)
+ cdevname(tty->device), (info->flags), serial_refcount,info->count,tty->count,s)
 #else
 #define DBG_CNT(s)
 #endif
@@ -164,11 +164,11 @@
 		"Warning: null async_struct for (%s) in %s\n";
 
 	if (!info) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (info->magic != SERIAL_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/drivers/char/cyclades.c b/drivers/char/cyclades.c
--- a/drivers/char/cyclades.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/char/cyclades.c	Sun Feb 23 22:25:22 2003
@@ -903,18 +903,18 @@
         "cyc Warning: cyclades_port out of range for (%s) in %s\n";
 
     if (!info) {
-        printk(badinfo, kdevname(device), routine);
+        printk(badinfo, cdevname(device), routine);
         return 1;
     }
 
     if( (long)info < (long)(&cy_port[0])
     || (long)(&cy_port[NR_PORTS]) < (long)info ){
-        printk(badrange, kdevname(device), routine);
+        printk(badrange, cdevname(device), routine);
         return 1;
     }
 
     if (info->magic != CYCLADES_MAGIC) {
-        printk(badmagic, kdevname(device), routine);
+        printk(badmagic, cdevname(device), routine);
         return 1;
     }
 #endif
diff -Nru a/drivers/char/drm/drm_drv.h b/drivers/char/drm/drm_drv.h
--- a/drivers/char/drm/drm_drv.h	Sun Feb 23 22:25:26 2003
+++ b/drivers/char/drm/drm_drv.h	Sun Feb 23 22:25:26 2003
@@ -323,8 +323,6 @@
 	dev->last_context = 0;
 	dev->last_switch = 0;
 	dev->last_checked = 0;
-	init_timer( &dev->timer );
-	init_waitqueue_head( &dev->context_wait );
 
 	dev->ctx_start = 0;
 	dev->lck_start = 0;
@@ -580,6 +578,8 @@
 		memset( (void *)dev, 0, sizeof(*dev) );
 		dev->count_lock = SPIN_LOCK_UNLOCKED;
 		sema_init( &dev->struct_sem, 1 );
+		init_timer( &dev->timer );
+		init_waitqueue_head( &dev->context_wait );
 
 		if ((DRM(minor)[i] = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0)
 			return -EPERM;
diff -Nru a/drivers/char/epca.c b/drivers/char/epca.c
--- a/drivers/char/epca.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/char/epca.c	Sun Feb 23 22:25:25 2003
@@ -2805,7 +2805,7 @@
 		ch->fepstopc = ch->stopc;
 
 		/* ------------------------------------------------------------
-			The XON / XOFF characters have changed; propogate these
+			The XON / XOFF characters have changed; propagate these
 			changes to the card.	
 		--------------------------------------------------------------- */
 
@@ -2819,7 +2819,7 @@
 
 		/* ---------------------------------------------------------------
 			Similar to the above, this time the auxilarly XON / XOFF 
-			characters have changed; propogate these changes to the card.
+			characters have changed; propagate these changes to the card.
 		------------------------------------------------------------------ */
 
 		fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1);
diff -Nru a/drivers/char/esp.c b/drivers/char/esp.c
--- a/drivers/char/esp.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/char/esp.c	Sun Feb 23 22:25:21 2003
@@ -135,7 +135,7 @@
   
 #if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
 #define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \
- kdevname(tty->device), (info->flags), serial_refcount,info->count,tty->count,s)
+ cdevname(tty->device), (info->flags), serial_refcount,info->count,tty->count,s)
 #else
 #define DBG_CNT(s)
 #endif
@@ -184,11 +184,11 @@
 		"Warning: null esp_struct for (%s) in %s\n";
 
 	if (!info) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (info->magic != ESP_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/drivers/char/ftape/zftape/zftape-ctl.c b/drivers/char/ftape/zftape/zftape-ctl.c
--- a/drivers/char/ftape/zftape/zftape-ctl.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/char/ftape/zftape/zftape-ctl.c	Sun Feb 23 22:25:23 2003
@@ -717,7 +717,7 @@
 			    ftape_disable());
 	}
 	/* zft_seg_pos should be greater than the vtbl segpos but not
-	 * if in compatability mode and only after we read in the
+	 * if in compatibility mode and only after we read in the
 	 * header segments
 	 *
 	 * might also be a problem if the user makes a backup with a
diff -Nru a/drivers/char/ftape/zftape/zftape-eof.c b/drivers/char/ftape/zftape/zftape-eof.c
--- a/drivers/char/ftape/zftape/zftape-eof.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/char/ftape/zftape/zftape-eof.c	Sun Feb 23 22:25:27 2003
@@ -1,6 +1,6 @@
 /*
  *   I use these routines just to decide when I have to fake a 
- *   volume-table to preserve compatability to original ftape.
+ *   volume-table to preserve compatibility to original ftape.
  */
 /*
  *      Copyright (C) 1994-1995 Bas Laarhoven.
diff -Nru a/drivers/char/ftape/zftape/zftape-vtbl.c b/drivers/char/ftape/zftape/zftape-vtbl.c
--- a/drivers/char/ftape/zftape/zftape-vtbl.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/char/ftape/zftape/zftape-vtbl.c	Sun Feb 23 22:25:24 2003
@@ -143,7 +143,7 @@
  * using the keyword "blocksize". The blocksize written to the
  * volume-label is in bytes.
  *
- * We use this now only for compatability with old zftape version. We
+ * We use this now only for compatibility with old zftape version. We
  * store the blocksize directly as binary number in the vendor
  * extension part of the volume entry.
  */
diff -Nru a/drivers/char/ftape/zftape/zftape-vtbl.h b/drivers/char/ftape/zftape/zftape-vtbl.h
--- a/drivers/char/ftape/zftape/zftape-vtbl.h	Sun Feb 23 22:25:23 2003
+++ b/drivers/char/ftape/zftape/zftape-vtbl.h	Sun Feb 23 22:25:23 2003
@@ -72,7 +72,7 @@
 #define VTBL_FMT        125
 #define VTBL_RESERVED_2 126
 #define VTBL_RESERVED_3 127
-/* compatability with pre revision K */
+/* compatibility with pre revision K */
 #define VTBL_K_CMPR     120 
 
 /*  the next is used by QIC-3020 tapes with format code 6 (>2^16
diff -Nru a/drivers/char/genrtc.c b/drivers/char/genrtc.c
--- a/drivers/char/genrtc.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/char/genrtc.c	Sun Feb 23 22:25:26 2003
@@ -97,7 +97,7 @@
 static spinlock_t gen_rtc_lock = SPIN_LOCK_UNLOCKED;
 
 /*
- * Routine to poll RTC seconds field for change as often as posible,
+ * Routine to poll RTC seconds field for change as often as possible,
  * after first RTC_UIE use timer to reduce polling
  */
 void genrtc_troutine(void *data)
@@ -430,7 +430,6 @@
 
 module_init(rtc_generic_init);
 module_exit(rtc_generic_exit);
-EXPORT_NO_SYMBOLS;
 
 
 /*
diff -Nru a/drivers/char/ip2/i2ellis.h b/drivers/char/ip2/i2ellis.h
--- a/drivers/char/ip2/i2ellis.h	Sun Feb 23 22:25:21 2003
+++ b/drivers/char/ip2/i2ellis.h	Sun Feb 23 22:25:21 2003
@@ -400,7 +400,7 @@
 	rwlock_t	read_fifo_spinlock;
 	rwlock_t	write_fifo_spinlock;
 
-//	For queuing interupt bottom half handlers.	/\/\|=mhw=|\/\/
+//	For queuing interrupt bottom half handlers.	/\/\|=mhw=|\/\/
 	struct work_struct	tqueue_interrupt;
 
 	struct timer_list  SendPendingTimer;   // Used by iiSendPending
diff -Nru a/drivers/char/ip2main.c b/drivers/char/ip2main.c
--- a/drivers/char/ip2main.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/char/ip2main.c	Sun Feb 23 22:25:27 2003
@@ -366,7 +366,7 @@
 
 #if defined(MODULE) && defined(IP2DEBUG_OPEN)
 #define DBG_CNT(s) printk(KERN_DEBUG "(%s): [%x] refc=%d, ttyc=%d, modc=%x -> %s\n", \
-		    kdevname(tty->device),(pCh->flags),ref_count, \
+		    cdevname(tty->device),(pCh->flags),ref_count, \
 		    tty->count,/*GET_USE_COUNT(module)*/0,s)
 #else
 #define DBG_CNT(s)
diff -Nru a/drivers/char/ipmi/ipmi_kcs_intf.c b/drivers/char/ipmi/ipmi_kcs_intf.c
--- a/drivers/char/ipmi/ipmi_kcs_intf.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/char/ipmi/ipmi_kcs_intf.c	Sun Feb 23 22:25:21 2003
@@ -128,7 +128,7 @@
 	/* The driver will disable interrupts when it gets into a
 	   situation where it cannot handle messages due to lack of
 	   memory.  Once that situation clears up, it will re-enable
-	   interupts. */
+	   interrupts. */
 	int                 interrupt_disabled;
 };
 
@@ -613,18 +613,6 @@
 	atomic_set(&kcs_info->req_events, 1);
 }
 
-static int new_user(void *send_info)
-{
-	if (!try_module_get(THIS_MODULE))
-		return -EBUSY;
-	return 0;
-}
-
-static void user_left(void *send_info)
-{
-	module_put(THIS_MODULE);
-}
-
 /* Call every 10 ms. */
 #define KCS_TIMEOUT_TIME_USEC	10000
 #define KCS_USEC_PER_JIFFY	(1000000/HZ)
@@ -718,11 +706,10 @@
 
 static struct ipmi_smi_handlers handlers =
 {
-	sender:		       sender,
-	request_events:        request_events,
-	new_user:	       new_user,
-	user_left:	       user_left,
-	set_run_to_completion: set_run_to_completion
+	.owner			= THIS_MODULE,
+	.sender			= sender,
+	.request_events		= request_events,
+	.set_run_to_completion	= set_run_to_completion,
 };
 
 static unsigned char ipmi_kcs_dev_rev;
diff -Nru a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
--- a/drivers/char/ipmi/ipmi_msghandler.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/char/ipmi/ipmi_msghandler.c	Sun Feb 23 22:25:24 2003
@@ -485,13 +485,14 @@
 	new_user->intf = ipmi_interfaces[if_num];
 	new_user->gets_events = 0;
 
-	rv = new_user->intf->handlers->new_user(new_user->intf->send_info);
-	if (rv)
+	if (!try_module_get(new_user->intf->handlers->owner)) {
+		rv = -ENODEV;
 		goto out_unlock;
+	}
 
-	write_lock_irqsave(&(new_user->intf->users_lock), flags);
-	list_add_tail(&(new_user->link), &(new_user->intf->users));
-	write_unlock_irqrestore(&(new_user->intf->users_lock), flags);
+	write_lock_irqsave(&new_user->intf->users_lock, flags);
+	list_add_tail(&new_user->link, &new_user->intf->users);
+	write_unlock_irqrestore(&new_user->intf->users_lock, flags);
 
  out_unlock:	
 	if (rv) {
@@ -563,12 +564,12 @@
 	unsigned long flags;
 
 	down_read(&interfaces_sem);
-	write_lock_irqsave(&(intf->users_lock), flags);
+	write_lock_irqsave(&intf->users_lock, flags);
 	rv = ipmi_destroy_user_nolock(user);
 	if (!rv)
-		intf->handlers->user_left(intf->send_info);
+		module_put(intf->handlers->owner);
 		
-	write_unlock_irqrestore(&(intf->users_lock), flags);
+	write_unlock_irqrestore(&intf->users_lock, flags);
 	up_read(&interfaces_sem);
 	return rv;
 }
diff -Nru a/drivers/char/isicom.c b/drivers/char/isicom.c
--- a/drivers/char/isicom.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/char/isicom.c	Sun Feb 23 22:25:21 2003
@@ -347,11 +347,11 @@
 	static const char * badport = 
 			KERN_WARNING "ISICOM: Warning: NULL isicom port for dev %s in %s.\n";		
 	if (!port) {
-		printk(badport, kdevname(dev), routine);
+		printk(badport, cdevname(dev), routine);
 		return 1;
 	}
 	if (port->magic != ISICOM_MAGIC) {
-		printk(badmagic, kdevname(dev), routine);
+		printk(badmagic, cdevname(dev), routine);
 		return 1;
 	}	
 #endif	
diff -Nru a/drivers/char/mwave/3780i.c b/drivers/char/mwave/3780i.c
--- a/drivers/char/mwave/3780i.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/char/mwave/3780i.c	Sun Feb 23 22:25:26 2003
@@ -698,7 +698,7 @@
 		usDspBaseIO, pusIPCSource);
 
 	/*
-	* Disable DSP to PC interrupts, read the interupt register,
+	* Disable DSP to PC interrupts, read the interrupt register,
 	* clear the pending IPC bits, and reenable DSP to PC interrupts
 	*/
 	spin_lock_irqsave(&dsp_lock, flags);
diff -Nru a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
--- a/drivers/char/pcmcia/synclink_cs.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/char/pcmcia/synclink_cs.c	Sun Feb 23 22:25:23 2003
@@ -860,11 +860,11 @@
 		"Warning: null mgslpc_info for (%s) in %s\n";
 
 	if (!info) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (info->magic != MGSLPC_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/drivers/char/ppdev.c b/drivers/char/ppdev.c
--- a/drivers/char/ppdev.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/char/ppdev.c	Sun Feb 23 22:25:26 2003
@@ -676,7 +676,7 @@
 	    (pp->state.mode != IEEE1284_MODE_COMPAT)) {
 	    	struct ieee1284_info *info;
 
-		/* parport released, but not in compatability mode */
+		/* parport released, but not in compatibility mode */
 		parport_claim_or_block (pp->pdev);
 		pp->flags |= PP_CLAIMED;
 		info = &pp->pdev->port->ieee1284;
diff -Nru a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
--- a/drivers/char/rio/rio_linux.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/char/rio/rio_linux.c	Sun Feb 23 22:25:25 2003
@@ -302,11 +302,11 @@
     KERN_ERR "rio: Warning: null rio port for device %s in %s\n";
  
   if (!port) {
-    printk (badinfo, kdevname(device), routine);
+    printk (badinfo, cdevname(device), routine);
     return 1;
   }
   if (port->magic != RIO_MAGIC) {
-    printk (badmagic, kdevname(device), routine);
+    printk (badmagic, cdevname(device), routine);
     return 1;
   }
 
diff -Nru a/drivers/char/riscom8.c b/drivers/char/riscom8.c
--- a/drivers/char/riscom8.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/char/riscom8.c	Sun Feb 23 22:25:24 2003
@@ -140,11 +140,11 @@
 		"rc: Warning: null riscom port for device %s in %s\n";
 
 	if (!port) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (port->magic != RISCOM8_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/drivers/char/sonypi.c b/drivers/char/sonypi.c
--- a/drivers/char/sonypi.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/char/sonypi.c	Sun Feb 23 22:25:25 2003
@@ -1,7 +1,7 @@
 /*
  * Sony Programmable I/O Control Device driver for VAIO
  *
- * Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
+ * Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
  *
  * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
  *
@@ -33,6 +33,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/input.h>
 #include <linux/pci.h>
 #include <linux/sched.h>
 #include <linux/init.h>
@@ -56,6 +57,7 @@
 static int fnkeyinit; /* = 0 */
 static int camera; /* = 0 */
 static int compat; /* = 0 */
+static int useinput = 1;
 static unsigned long mask = 0xffffffff;
 
 /* Inits the queue */
@@ -335,6 +337,22 @@
 	return;
 
 found:
+#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
+	if (useinput) {
+		struct input_dev *jog_dev = &sonypi_device.jog_dev;
+		if (event == SONYPI_EVENT_JOGDIAL_PRESSED)
+			input_report_key(jog_dev, BTN_MIDDLE, 1);
+		else if (event == SONYPI_EVENT_ANYBUTTON_RELEASED)
+			input_report_key(jog_dev, BTN_MIDDLE, 0);
+		else if ((event == SONYPI_EVENT_JOGDIAL_UP) ||
+			 (event == SONYPI_EVENT_JOGDIAL_UP_PRESSED))
+			input_report_rel(jog_dev, REL_WHEEL, 1);
+		else if ((event == SONYPI_EVENT_JOGDIAL_DOWN) ||
+			 (event == SONYPI_EVENT_JOGDIAL_DOWN_PRESSED))
+			input_report_rel(jog_dev, REL_WHEEL, -1);
+		input_sync(jog_dev);
+	}
+#endif /* CONFIG_INPUT || CONFIG_INPUT_MODULE */
 	sonypi_pushq(event);
 }
 
@@ -579,7 +597,7 @@
 	-1, "sonypi", &sonypi_misc_fops
 };
 
-#if CONFIG_PM
+#ifdef CONFIG_PM
 static int sonypi_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data) {
 	static int old_camera_power;
 
@@ -594,14 +612,14 @@
 			sonypi_type2_dis();
 		else
 			sonypi_type1_dis();
-#if !defined(CONFIG_ACPI)
+#ifndef CONFIG_ACPI
 		/* disable ACPI mode */
 		if (fnkeyinit)
 			outb(0xf1, 0xb2);
 #endif
 		break;
 	case PM_RESUME:
-#if !defined(CONFIG_ACPI)
+#ifndef CONFIG_ACPI
 		/* Enable ACPI mode to get Fn key events */
 		if (fnkeyinit)
 			outb(0xf0, 0xb2);
@@ -692,7 +710,7 @@
 		goto out3;
 	}
 
-#if !defined(CONFIG_ACPI)
+#ifndef CONFIG_ACPI
 	/* Enable ACPI mode to get Fn key events */
 	if (fnkeyinit)
 		outb(0xf0, 0xb2);
@@ -715,14 +733,15 @@
 	       SONYPI_DRIVER_MINORVERSION);
 	printk(KERN_INFO "sonypi: detected %s model, "
 	       "verbose = %d, fnkeyinit = %s, camera = %s, "
-	       "compat = %s, mask = 0x%08lx\n",
+	       "compat = %s, mask = 0x%08lx, useinput = %s\n",
 	       (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE1) ?
 			"type1" : "type2",
 	       verbose,
 	       fnkeyinit ? "on" : "off",
 	       camera ? "on" : "off",
 	       compat ? "on" : "off",
-	       mask);
+	       mask,
+	       useinput ? "on" : "off");
 	printk(KERN_INFO "sonypi: enabled at irq=%d, port1=0x%x, port2=0x%x\n",
 	       sonypi_device.irq, 
 	       sonypi_device.ioport1, sonypi_device.ioport2);
@@ -730,7 +749,24 @@
 		printk(KERN_INFO "sonypi: device allocated minor is %d\n",
 		       sonypi_misc_device.minor);
 
-#if CONFIG_PM
+#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
+	if (useinput) {
+		/* Initialize the Input Drivers: */
+		sonypi_device.jog_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
+		sonypi_device.jog_dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_MIDDLE);
+		sonypi_device.jog_dev.relbit[0] = BIT(REL_WHEEL);
+		sonypi_device.jog_dev.name = (char *) kmalloc(
+			sizeof(SONYPI_INPUTNAME), GFP_KERNEL);
+		sprintf(sonypi_device.jog_dev.name, SONYPI_INPUTNAME);
+		sonypi_device.jog_dev.id.bustype = BUS_ISA;
+		sonypi_device.jog_dev.id.vendor = PCI_VENDOR_ID_SONY;
+	  
+		input_register_device(&sonypi_device.jog_dev);
+		printk(KERN_INFO "%s installed.\n", sonypi_device.jog_dev.name);
+	}
+#endif /* CONFIG_INPUT || CONFIG_INPUT_MODULE */
+
+#ifdef CONFIG_PM
 	sonypi_device.pm = pm_register(PM_PCI_DEV, 0, sonypi_pm_callback);
 #endif
 
@@ -746,18 +782,26 @@
 
 static void __devexit sonypi_remove(void) {
 
-#if CONFIG_PM
+#ifdef CONFIG_PM
 	pm_unregister(sonypi_device.pm);
 #endif
 
 	sonypi_call2(0x81, 0); /* make sure we don't get any more events */
+	
+#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
+	if (useinput) {
+		input_unregister_device(&sonypi_device.jog_dev);
+		kfree(sonypi_device.jog_dev.name);
+	}
+#endif /* CONFIG_INPUT || CONFIG_INPUT_MODULE */
+
 	if (camera)
 		sonypi_camera_off();
 	if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE2)
 		sonypi_type2_dis();
 	else
 		sonypi_type1_dis();
-#if !defined(CONFIG_ACPI)
+#ifndef CONFIG_ACPI
 	/* disable ACPI mode */
 	if (fnkeyinit)
 		outb(0xf1, 0xb2);
@@ -787,7 +831,7 @@
 
 #ifndef MODULE
 static int __init sonypi_setup(char *str)  {
-	int ints[7];
+	int ints[8];
 
 	str = get_options(str, ARRAY_SIZE(ints), ints);
 	if (ints[0] <= 0) 
@@ -808,6 +852,9 @@
 	if (ints[0] == 5)
 		goto out;
 	mask = ints[6];
+	if (ints[0] == 6)
+		goto out;
+	useinput = ints[7];
 out:
 	return 1;
 }
@@ -836,5 +883,7 @@
 MODULE_PARM_DESC(compat, "set this if you want to enable backward compatibility mode");
 MODULE_PARM(mask, "i");
 MODULE_PARM_DESC(mask, "set this to the mask of event you want to enable (see doc)");
+MODULE_PARM(useinput, "i");
+MODULE_PARM_DESC(useinput, "if you have a jogdial, set this if you would like it to use the modern Linux Input Driver system");
 
 EXPORT_SYMBOL(sonypi_camera_command);
diff -Nru a/drivers/char/sonypi.h b/drivers/char/sonypi.h
--- a/drivers/char/sonypi.h	Sun Feb 23 22:25:25 2003
+++ b/drivers/char/sonypi.h	Sun Feb 23 22:25:25 2003
@@ -1,7 +1,7 @@
 /* 
  * Sony Programmable I/O Control Device driver for VAIO
  *
- * Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
+ * Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
  *
  * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
  *
@@ -37,7 +37,7 @@
 #ifdef __KERNEL__
 
 #define SONYPI_DRIVER_MAJORVERSION	 1
-#define SONYPI_DRIVER_MINORVERSION	17
+#define SONYPI_DRIVER_MINORVERSION	18
 
 #define SONYPI_DEVICE_MODEL_TYPE1	1
 #define SONYPI_DEVICE_MODEL_TYPE2	2
@@ -45,6 +45,7 @@
 #include <linux/config.h>
 #include <linux/types.h>
 #include <linux/pci.h>
+#include <linux/input.h>
 #include <linux/pm.h>
 #include <linux/acpi.h>
 #include "linux/sonypi.h"
@@ -334,6 +335,9 @@
 	unsigned char buf[SONYPI_BUF_SIZE];
 };
 
+/* The name of the Jog Dial for the input device drivers */
+#define SONYPI_INPUTNAME	"Sony VAIO Jog Dial"
+
 struct sonypi_device {
 	struct pci_dev *dev;
 	u16 irq;
@@ -347,7 +351,10 @@
 	struct sonypi_queue queue;
 	int open_count;
 	int model;
-#if CONFIG_PM
+#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
+	struct input_dev jog_dev;
+#endif
+#ifdef CONFIG_PM
 	struct pm_dev *pm;
 #endif
 };
@@ -363,7 +370,7 @@
 		printk(KERN_WARNING "sonypi command failed at %s : %s (line %d)\n", __FILE__, __FUNCTION__, __LINE__); \
 }
 
-#if !defined(CONFIG_ACPI)
+#ifndef CONFIG_ACPI
 extern int verbose;
 
 static inline int ec_write(u8 addr, u8 value) {
diff -Nru a/drivers/char/specialix.c b/drivers/char/specialix.c
--- a/drivers/char/specialix.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/char/specialix.c	Sun Feb 23 22:25:26 2003
@@ -219,11 +219,11 @@
 		KERN_ERR "sx: Warning: null specialix port for device %s in %s\n";
  
 	if (!port) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (port->magic != SPECIALIX_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/drivers/char/sx.c b/drivers/char/sx.c
--- a/drivers/char/sx.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/char/sx.c	Sun Feb 23 22:25:23 2003
@@ -448,11 +448,11 @@
 	  KERN_ERR "sx: Warning: null sx port for device %s in %s\n";
  
 	if (!port) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (port->magic != SX_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 
diff -Nru a/drivers/char/synclink.c b/drivers/char/synclink.c
--- a/drivers/char/synclink.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/char/synclink.c	Sun Feb 23 22:25:23 2003
@@ -987,11 +987,11 @@
 		"Warning: null mgsl_struct for (%s) in %s\n";
 
 	if (!info) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (info->magic != MGSL_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
--- a/drivers/char/synclinkmp.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/char/synclinkmp.c	Sun Feb 23 22:25:22 2003
@@ -718,11 +718,11 @@
 		"Warning: null synclinkmp_struct for (%s) in %s\n";
 
 	if (!info) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (info->magic != MGSL_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/drivers/char/sysrq.c b/drivers/char/sysrq.c
--- a/drivers/char/sysrq.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/char/sysrq.c	Sun Feb 23 22:25:26 2003
@@ -153,7 +153,7 @@
 
 	if (remount_flag) { /* Remount R/O */
 		int ret, flags;
-		struct list_head *p;
+		struct file *file;
 
 		if (sb->s_flags & MS_RDONLY) {
 			printk("R/O\n");
@@ -161,8 +161,7 @@
 		}
 
 		file_list_lock();
-		for (p = sb->s_files.next; p != &sb->s_files; p = p->next) {
-			struct file *file = list_entry(p, struct file, f_list);
+		list_for_each_entry(file, &sb->s_files, f_list) {
 			if (file->f_dentry && file_count(file)
 				&& S_ISREG(file->f_dentry->d_inode->i_mode))
 				file->f_mode &= ~2;
@@ -205,15 +204,11 @@
 	remount_flag = (emergency_sync_scheduled == EMERG_REMOUNT);
 	emergency_sync_scheduled = 0;
 
-	for (sb = sb_entry(super_blocks.next);
-	     sb != sb_entry(&super_blocks); 
-	     sb = sb_entry(sb->s_list.next))
+	list_for_each_entry(sb, &super_blocks, s_list)
 		if (sb->s_bdev && is_local_disk(sb->s_bdev))
 			go_sync(sb, remount_flag);
 
-	for (sb = sb_entry(super_blocks.next);
-	     sb != sb_entry(&super_blocks); 
-	     sb = sb_entry(sb->s_list.next))
+	list_for_each_entry(sb, &super_blocks, s_list)
 		if (sb->s_bdev && !is_local_disk(sb->s_bdev))
 			go_sync(sb, remount_flag);
 
diff -Nru a/drivers/char/tipar.c b/drivers/char/tipar.c
--- a/drivers/char/tipar.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/char/tipar.c	Sun Feb 23 22:25:25 2003
@@ -531,8 +531,6 @@
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE(DRIVER_LICENSE);
 
-EXPORT_NO_SYMBOLS;
-
 MODULE_PARM(timeout, "i");
 MODULE_PARM_DESC(timeout, "Timeout (default=1.5 seconds)");
 MODULE_PARM(delay, "i");
diff -Nru a/drivers/char/tpqic02.c b/drivers/char/tpqic02.c
--- a/drivers/char/tpqic02.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/char/tpqic02.c	Sun Feb 23 22:25:24 2003
@@ -2076,7 +2076,7 @@
 
 
 	if (TP_DIAGS(dev)) {
-		printk("qic02_tape_open: dev=%s, flags=%x     ", kdevname(dev), flags);
+		printk("qic02_tape_open: dev=%s, flags=%x     ", cdevname(dev), flags);
 	}
 
 	if (minor(dev) == 255) {	/* special case for resetting */
@@ -2266,7 +2266,7 @@
 	kdev_t dev = inode->i_rdev;
 
 	if (TP_DIAGS(dev)) {
-		printk("qic02_tape_release: dev=%s\n", kdevname(dev));
+		printk("qic02_tape_release: dev=%s\n", cdevname(dev));
 	}
 
 	if (status_zombie == NO) {	/* don't rewind in zombie mode */
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/char/tty_io.c	Sun Feb 23 22:25:25 2003
@@ -155,6 +155,9 @@
 extern void uart_console_init(void);
 extern void sgi_serial_console_init(void);
 extern void sci_console_init(void);
+extern void m68328_console_init(void);
+extern void mcfrs_console_init(void);
+extern void rs_360_init(void);
 extern void tx3912_console_init(void);
 extern void tx3912_rs_init(void);
 extern void hvc_console_init(void);
@@ -211,11 +214,11 @@
 		"Warning: null TTY for (%s) in %s\n";
 
 	if (!tty) {
-		printk(badtty, kdevname(device), routine);
+		printk(badtty, cdevname(device), routine);
 		return 1;
 	}
 	if (tty->magic != TTY_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
@@ -229,9 +232,8 @@
 	int count = 0;
 	
 	file_list_lock();
-	for(p = tty->tty_files.next; p != &tty->tty_files; p = p->next) {
-		if(list_entry(p, struct file, f_list)->private_data == tty)
-			count++;
+	list_for_each(p, &tty->tty_files) {
+		count++;
 	}
 	file_list_unlock();
 	if (tty->driver.type == TTY_DRIVER_TYPE_PTY &&
@@ -241,7 +243,7 @@
 	if (tty->count != count) {
 		printk(KERN_WARNING "Warning: dev (%s) tty->count(%d) "
 				    "!= #fd's(%d) in %s\n",
-		       kdevname(tty->device), tty->count, count, routine);
+		       cdevname(tty->device), tty->count, count, routine);
 		return count;
        }	
 #endif
@@ -286,6 +288,10 @@
 
 	if (tty->ldisc.num == ldisc)
 		return 0;	/* We are already in the desired discipline */
+
+	if (!try_module_get(ldiscs[ldisc].owner))
+	       	return -EINVAL;
+	
 	o_ldisc = tty->ldisc;
 
 	tty_wait_until_sent(tty, 0);
@@ -300,9 +306,13 @@
 	if (tty->ldisc.open)
 		retval = (tty->ldisc.open)(tty);
 	if (retval < 0) {
+		module_put(tty->ldisc.owner);
+		
 		tty->ldisc = o_ldisc;
 		tty->termios->c_line = tty->ldisc.num;
 		if (tty->ldisc.open && (tty->ldisc.open(tty) < 0)) {
+			module_put(tty->ldisc.owner);
+
 			tty->ldisc = ldiscs[N_TTY];
 			tty->termios->c_line = N_TTY;
 			if (tty->ldisc.open) {
@@ -314,7 +324,10 @@
 					      tty_name(tty, buf), r);
 			}
 		}
+	} else {
+		module_put(o_ldisc.owner);
 	}
+	
 	if (tty->ldisc.num != o_ldisc.num && tty->driver.set_ldisc)
 		tty->driver.set_ldisc(tty);
 	return retval;
@@ -427,8 +440,8 @@
 {
 	struct tty_struct *tty = (struct tty_struct *) data;
 	struct file * cons_filp = NULL;
+	struct file *filp;
 	struct task_struct *p;
-	struct list_head *l;
 	struct pid *pid;
 	int    closecount = 0, n;
 
@@ -440,15 +453,7 @@
 	
 	check_tty_count(tty, "do_tty_hangup");
 	file_list_lock();
-	for (l = tty->tty_files.next; l != &tty->tty_files; l = l->next) {
-		struct file * filp = list_entry(l, struct file, f_list);
-		/*
-		 * If this file descriptor has been closed, ignore it; it
-		 * will be going away shortly. (We don't test filp->f_count
-		 * for zero since that could open another race.) --rmk
-		 */
-		if (filp->private_data == NULL)
-			continue;
+	list_for_each_entry(filp, &tty->tty_files, f_list) {
 		if (IS_CONSOLE_DEV(filp->f_dentry->d_inode->i_rdev) ||
 		    IS_SYSCONS_DEV(filp->f_dentry->d_inode->i_rdev)) {
 			cons_filp = filp;
@@ -490,6 +495,8 @@
 	if (tty->ldisc.num != ldiscs[N_TTY].num) {
 		if (tty->ldisc.close)
 			(tty->ldisc.close)(tty);
+		module_put(tty->ldisc.owner);
+		
 		tty->ldisc = ldiscs[N_TTY];
 		tty->termios->c_line = N_TTY;
 		if (tty->ldisc.open) {
@@ -501,7 +508,8 @@
 	}
 	
 	read_lock(&tasklist_lock);
-	if (tty->session > 0)
+	if (tty->session > 0) {
+		struct list_head *l;
 		for_each_task_pid(tty->session, PIDTYPE_SID, p, l, pid) {
 			if (p->tty == tty)
 				p->tty = NULL;
@@ -512,6 +520,7 @@
 			if (tty->pgrp > 0)
 				p->tty_old_pgrp = tty->pgrp;
 		}
+	}
 	read_unlock(&tasklist_lock);
 
 	tty->flags = 0;
@@ -1082,24 +1091,24 @@
 #ifdef TTY_PARANOIA_CHECK
 	if (idx < 0 || idx >= tty->driver.num) {
 		printk(KERN_DEBUG "release_dev: bad idx when trying to "
-				  "free (%s)\n", kdevname(tty->device));
+				  "free (%s)\n", cdevname(tty->device));
 		return;
 	}
 	if (tty != tty->driver.table[idx]) {
 		printk(KERN_DEBUG "release_dev: driver.table[%d] not tty "
-				  "for (%s)\n", idx, kdevname(tty->device));
+				  "for (%s)\n", idx, cdevname(tty->device));
 		return;
 	}
 	if (tty->termios != tty->driver.termios[idx]) {
 		printk(KERN_DEBUG "release_dev: driver.termios[%d] not termios "
 		       "for (%s)\n",
-		       idx, kdevname(tty->device));
+		       idx, cdevname(tty->device));
 		return;
 	}
 	if (tty->termios_locked != tty->driver.termios_locked[idx]) {
 		printk(KERN_DEBUG "release_dev: driver.termios_locked[%d] not "
 		       "termios_locked for (%s)\n",
-		       idx, kdevname(tty->device));
+		       idx, cdevname(tty->device));
 		return;
 	}
 #endif
@@ -1114,20 +1123,20 @@
 		if (o_tty != tty->driver.other->table[idx]) {
 			printk(KERN_DEBUG "release_dev: other->table[%d] "
 					  "not o_tty for (%s)\n",
-			       idx, kdevname(tty->device));
+			       idx, cdevname(tty->device));
 			return;
 		}
 		if (o_tty->termios != tty->driver.other->termios[idx]) {
 			printk(KERN_DEBUG "release_dev: other->termios[%d] "
 					  "not o_termios for (%s)\n",
-			       idx, kdevname(tty->device));
+			       idx, cdevname(tty->device));
 			return;
 		}
 		if (o_tty->termios_locked != 
 		      tty->driver.other->termios_locked[idx]) {
 			printk(KERN_DEBUG "release_dev: other->termios_locked["
 					  "%d] not o_termios_locked for (%s)\n",
-			       idx, kdevname(tty->device));
+			       idx, cdevname(tty->device));
 			return;
 		}
 		if (o_tty->link != tty) {
@@ -1211,14 +1220,16 @@
 	}
 
 	/*
-	 * We've decremented tty->count, so we should zero out
-	 * filp->private_data, to break the link between the tty and
-	 * the file descriptor.  Otherwise if filp_close() blocks before
-	 * the file descriptor is removed from the inuse_filp
-	 * list, check_tty_count() could observe a discrepancy and
-	 * printk a warning message to the user.
+	 * We've decremented tty->count, so we need to remove this file
+	 * descriptor off the tty->tty_files list; this serves two
+	 * purposes:
+	 *  - check_tty_count sees the correct number of file descriptors
+	 *    associated with this tty.
+	 *  - do_tty_hangup no longer sees this file descriptor as
+	 *    something that needs to be handled for hangups.
 	 */
-	filp->private_data = 0;
+	file_kill(filp);
+	filp->private_data = NULL;
 
 	/*
 	 * Perform some housekeeping before deciding whether to return.
@@ -1268,11 +1279,14 @@
 	 */
 	if (tty->ldisc.close)
 		(tty->ldisc.close)(tty);
+	module_put(tty->ldisc.owner);
+	
 	tty->ldisc = ldiscs[N_TTY];
 	tty->termios->c_line = N_TTY;
 	if (o_tty) {
 		if (o_tty->ldisc.close)
 			(o_tty->ldisc.close)(o_tty);
+		module_put(o_tty->ldisc.owner);
 		o_tty->ldisc = ldiscs[N_TTY];
 	}
 	
@@ -2263,6 +2277,15 @@
 #endif
 #ifdef CONFIG_ARC_CONSOLE
 	arc_console_init();
+#endif
+#ifdef CONFIG_SERIAL_68328
+	m68328_console_init();
+#endif
+#ifdef CONFIG_SERIAL_COLDFIRE
+	mcfrs_console_init();
+#endif
+#ifdef CONFIG_SERIAL_68360
+	rs_360_init();
 #endif
 #ifdef CONFIG_SERIAL_TX3912_CONSOLE
 	tx3912_console_init();
diff -Nru a/drivers/char/watchdog/sc520_wdt.c b/drivers/char/watchdog/sc520_wdt.c
--- a/drivers/char/watchdog/sc520_wdt.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/char/watchdog/sc520_wdt.c	Sun Feb 23 22:25:24 2003
@@ -385,4 +385,3 @@
 MODULE_AUTHOR("Scott and Bill Jennings");
 MODULE_DESCRIPTION("Driver for watchdog timer in AMD \"Elan\" SC520 uProcessor");
 MODULE_LICENSE("GPL");
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/char/watchdog/w83877f_wdt.c b/drivers/char/watchdog/w83877f_wdt.c
--- a/drivers/char/watchdog/w83877f_wdt.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/char/watchdog/w83877f_wdt.c	Sun Feb 23 22:25:25 2003
@@ -359,4 +359,3 @@
 MODULE_AUTHOR("Scott and Bill Jennings");
 MODULE_DESCRIPTION("Driver for watchdog timer in w83877f chip");
 MODULE_LICENSE("GPL");
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/char/watchdog/wafer5823wdt.c b/drivers/char/watchdog/wafer5823wdt.c
--- a/drivers/char/watchdog/wafer5823wdt.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/char/watchdog/wafer5823wdt.c	Sun Feb 23 22:25:26 2003
@@ -256,6 +256,5 @@
 
 MODULE_AUTHOR("Justin Cormack");
 MODULE_LICENSE("GPL");
-EXPORT_NO_SYMBOLS;
 
 /* end of wafer5823wdt.c */
diff -Nru a/drivers/hotplug/ibmphp_pci.c b/drivers/hotplug/ibmphp_pci.c
--- a/drivers/hotplug/ibmphp_pci.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/hotplug/ibmphp_pci.c	Sun Feb 23 22:25:21 2003
@@ -491,7 +491,7 @@
 				pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->pfmem[count]->start);
 
 				/*_______________This is for debugging purposes only______________________________*/				
-				debug ("b4 writing, start addres is %x\n", func->pfmem[count]->start);
+				debug ("b4 writing, start address is %x\n", func->pfmem[count]->start);
 				pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]);
 				debug ("after writing, start address is %x\n", bar[count]);
 				/*_________________________________________________________________________________*/
diff -Nru a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
--- a/drivers/i2c/chips/adm1021.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/i2c/chips/adm1021.c	Sun Feb 23 22:25:21 2003
@@ -19,12 +19,12 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/version.h>
 #include <linux/module.h>
+#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/i2c-proc.h>
-#include <linux/init.h>
+
 
 /* Registers */
 #define ADM1021_SYSCTL_TEMP		1200
@@ -123,8 +123,6 @@
 			  unsigned short flags, int kind);
 static void adm1021_init_client(struct i2c_client *client);
 static int adm1021_detach_client(struct i2c_client *client);
-static int adm1021_command(struct i2c_client *client, unsigned int cmd,
-			   void *arg);
 static int adm1021_read_value(struct i2c_client *client, u8 reg);
 static int adm1021_write_value(struct i2c_client *client, u8 reg,
 			       u16 value);
@@ -151,7 +149,6 @@
 	.flags		= I2C_DF_NOTIFY,
 	.attach_adapter	= adm1021_attach_adapter,
 	.detach_client	= adm1021_detach_client,
-	.command	= adm1021_command,
 };
 
 /* These files are created for each detected adm1021. This is just a template;
@@ -186,7 +183,7 @@
    take more memory than the datastructure takes now. */
 static int adm1021_id = 0;
 
-int adm1021_attach_adapter(struct i2c_adapter *adapter)
+static int adm1021_attach_adapter(struct i2c_adapter *adapter)
 {
 	return i2c_detect(adapter, &addr_data, adm1021_detect);
 }
@@ -339,7 +336,7 @@
 	return err;
 }
 
-void adm1021_init_client(struct i2c_client *client)
+static void adm1021_init_client(struct i2c_client *client)
 {
 	/* Initialize the adm1021 chip */
 	adm1021_write_value(client, ADM1021_REG_TOS_W,
@@ -356,7 +353,7 @@
 	adm1021_write_value(client, ADM1021_REG_CONV_RATE_W, 0x04);
 }
 
-int adm1021_detach_client(struct i2c_client *client)
+static int adm1021_detach_client(struct i2c_client *client)
 {
 
 	int err;
@@ -376,28 +373,20 @@
 
 }
 
-
-/* No commands defined yet */
-int adm1021_command(struct i2c_client *client, unsigned int cmd, void *arg)
-{
-	return 0;
-}
-
 /* All registers are byte-sized */
-int adm1021_read_value(struct i2c_client *client, u8 reg)
+static int adm1021_read_value(struct i2c_client *client, u8 reg)
 {
 	return i2c_smbus_read_byte_data(client, reg);
 }
 
-int adm1021_write_value(struct i2c_client *client, u8 reg, u16 value)
+static int adm1021_write_value(struct i2c_client *client, u8 reg, u16 value)
 {
-	if (read_only > 0)
-		return 0;
-
-	return i2c_smbus_write_byte_data(client, reg, value);
+	if (!read_only)
+		return i2c_smbus_write_byte_data(client, reg, value);
+	return 0;
 }
 
-void adm1021_update_client(struct i2c_client *client)
+static void adm1021_update_client(struct i2c_client *client)
 {
 	struct adm1021_data *data = client->data;
 
@@ -447,10 +436,11 @@
 }
 
 
-void adm1021_temp(struct i2c_client *client, int operation, int ctl_name,
-		  int *nrels_mag, long *results)
+static void adm1021_temp(struct i2c_client *client, int operation,
+			 int ctl_name, int *nrels_mag, long *results)
 {
 	struct adm1021_data *data = client->data;
+
 	if (operation == SENSORS_PROC_REAL_INFO)
 		*nrels_mag = 0;
 	else if (operation == SENSORS_PROC_REAL_READ) {
@@ -473,8 +463,8 @@
 	}
 }
 
-void adm1021_remote_temp(struct i2c_client *client, int operation,
-			 int ctl_name, int *nrels_mag, long *results)
+static void adm1021_remote_temp(struct i2c_client *client, int operation,
+				int ctl_name, int *nrels_mag, long *results)
 {
 	struct adm1021_data *data = client->data;
 	int prec = 0;
@@ -546,10 +536,11 @@
 	}
 }
 
-void adm1021_die_code(struct i2c_client *client, int operation,
-		      int ctl_name, int *nrels_mag, long *results)
+static void adm1021_die_code(struct i2c_client *client, int operation,
+			     int ctl_name, int *nrels_mag, long *results)
 {
 	struct adm1021_data *data = client->data;
+
 	if (operation == SENSORS_PROC_REAL_INFO)
 		*nrels_mag = 0;
 	else if (operation == SENSORS_PROC_REAL_READ) {
@@ -561,8 +552,8 @@
 	}
 }
 
-void adm1021_alarms(struct i2c_client *client, int operation, int ctl_name,
-		    int *nrels_mag, long *results)
+static void adm1021_alarms(struct i2c_client *client, int operation,
+			   int ctl_name, int *nrels_mag, long *results)
 {
 	struct adm1021_data *data = client->data;
 	if (operation == SENSORS_PROC_REAL_INFO)
@@ -578,7 +569,6 @@
 
 static int __init sensors_adm1021_init(void)
 {
-
 	return i2c_add_driver(&adm1021_driver);
 }
 
diff -Nru a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c
--- a/drivers/i2c/chips/lm75.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/i2c/chips/lm75.c	Sun Feb 23 22:25:21 2003
@@ -18,12 +18,11 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/version.h>
 #include <linux/module.h>
+#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/i2c-proc.h>
-#include <linux/init.h>
 
 
 #define LM75_SYSCTL_TEMP 1200	/* Degrees Celcius * 10 */
@@ -72,8 +71,6 @@
 		       unsigned short flags, int kind);
 static void lm75_init_client(struct i2c_client *client);
 static int lm75_detach_client(struct i2c_client *client);
-static int lm75_command(struct i2c_client *client, unsigned int cmd,
-			void *arg);
 static u16 swap_bytes(u16 val);
 static int lm75_read_value(struct i2c_client *client, u8 reg);
 static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value);
@@ -84,12 +81,12 @@
 
 /* This is the driver that will be inserted */
 static struct i2c_driver lm75_driver = {
+	.owner		= THIS_MODULE,
 	.name		= "LM75 sensor chip driver",
 	.id		= I2C_DRIVERID_LM75,
 	.flags		= I2C_DF_NOTIFY,
 	.attach_adapter	= lm75_attach_adapter,
 	.detach_client	= lm75_detach_client,
-	.command	= lm75_command,
 };
 
 /* These files are created for each detected LM75. This is just a template;
@@ -105,14 +102,14 @@
 
 static int lm75_id = 0;
 
-int lm75_attach_adapter(struct i2c_adapter *adapter)
+static int lm75_attach_adapter(struct i2c_adapter *adapter)
 {
 	return i2c_detect(adapter, &addr_data, lm75_detect);
 }
 
 /* This function is called by i2c_detect */
-int lm75_detect(struct i2c_adapter *adapter, int address,
-		unsigned short flags, int kind)
+static int lm75_detect(struct i2c_adapter *adapter, int address,
+		       unsigned short flags, int kind)
 {
 	int i, cur, conf, hyst, os;
 	struct i2c_client *new_client;
@@ -217,7 +214,7 @@
 	return err;
 }
 
-int lm75_detach_client(struct i2c_client *client)
+static int lm75_detach_client(struct i2c_client *client)
 {
 	struct lm75_data *data = client->data;
 
@@ -227,12 +224,7 @@
 	return 0;
 }
 
-int lm75_command(struct i2c_client *client, unsigned int cmd, void *arg)
-{
-	return 0;
-}
-
-u16 swap_bytes(u16 val)
+static u16 swap_bytes(u16 val)
 {
 	return (val >> 8) | (val << 8);
 }
@@ -240,7 +232,7 @@
 /* All registers are word-sized, except for the configuration register.
    LM75 uses a high-byte first convention, which is exactly opposite to
    the usual practice. */
-int lm75_read_value(struct i2c_client *client, u8 reg)
+static int lm75_read_value(struct i2c_client *client, u8 reg)
 {
 	if (reg == LM75_REG_CONF)
 		return i2c_smbus_read_byte_data(client, reg);
@@ -251,7 +243,7 @@
 /* All registers are word-sized, except for the configuration register.
    LM75 uses a high-byte first convention, which is exactly opposite to
    the usual practice. */
-int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
+static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
 {
 	if (reg == LM75_REG_CONF)
 		return i2c_smbus_write_byte_data(client, reg, value);
@@ -260,7 +252,7 @@
 						 swap_bytes(value));
 }
 
-void lm75_init_client(struct i2c_client *client)
+static void lm75_init_client(struct i2c_client *client)
 {
 	/* Initialize the LM75 chip */
 	lm75_write_value(client, LM75_REG_TEMP_OS,
@@ -270,7 +262,7 @@
 	lm75_write_value(client, LM75_REG_CONF, 0);
 }
 
-void lm75_update_client(struct i2c_client *client)
+static void lm75_update_client(struct i2c_client *client)
 {
 	struct lm75_data *data = client->data;
 
@@ -292,8 +284,8 @@
 }
 
 
-void lm75_temp(struct i2c_client *client, int operation, int ctl_name,
-	       int *nrels_mag, long *results)
+static void lm75_temp(struct i2c_client *client, int operation, int ctl_name,
+		      int *nrels_mag, long *results)
 {
 	struct lm75_data *data = client->data;
 	if (operation == SENSORS_PROC_REAL_INFO)
@@ -318,7 +310,7 @@
 	}
 }
 
-int __init sensors_lm75_init(void)
+static int __init sensors_lm75_init(void)
 {
 	return i2c_add_driver(&lm75_driver);
 }
diff -Nru a/drivers/i2c/i2c-algo-bit.c b/drivers/i2c/i2c-algo-bit.c
--- a/drivers/i2c/i2c-algo-bit.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/i2c/i2c-algo-bit.c	Sun Feb 23 22:25:24 2003
@@ -21,20 +21,18 @@
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
 
-/* $Id: i2c-algo-bit.c,v 1.37 2002/07/08 00:41:49 mds Exp $ */
+/* $Id: i2c-algo-bit.c,v 1.44 2003/01/21 08:08:16 kmalkki Exp $ */
 
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/version.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
-#include <linux/ioport.h>
 #include <linux/errno.h>
-
+#include <linux/sched.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
+
 
 /* ----- global defines ----------------------------------------------- */
 #define DEB(x) if (i2c_debug>=1) x;
diff -Nru a/drivers/i2c/i2c-algo-pcf.c b/drivers/i2c/i2c-algo-pcf.c
--- a/drivers/i2c/i2c-algo-pcf.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/i2c/i2c-algo-pcf.c	Sun Feb 23 22:25:25 2003
@@ -31,15 +31,12 @@
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/version.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
-#include <linux/ioport.h>
 #include <linux/errno.h>
-
 #include <linux/i2c.h>
 #include <linux/i2c-algo-pcf.h>
 #include "i2c-pcf8584.h"
+
 
 /* ----- global defines ----------------------------------------------- */
 #define DEB(x) if (i2c_debug>=1) x
diff -Nru a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/i2c/i2c-dev.c	Sun Feb 23 22:25:25 2003
@@ -28,25 +28,22 @@
 /* The devfs code is contributed by Philipp Matthias Hahn 
    <pmhahn@titan.lahn.de> */
 
-/* $Id: i2c-dev.c,v 1.48 2002/10/01 14:10:04 ac9410 Exp $ */
+/* $Id: i2c-dev.c,v 1.53 2003/01/21 08:08:16 kmalkki Exp $ */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/slab.h>
-#include <linux/version.h>
 #include <linux/smp_lock.h>
 #include <linux/devfs_fs_kernel.h>
-
+#include <linux/init.h>
+#include <linux/i2c.h>
+#include <linux/i2c-dev.h>
+#include <asm/uaccess.h>
 
 /* If you want debugging uncomment: */
 /* #define DEBUG */
 
-#include <linux/init.h>
-#include <asm/uaccess.h>
-#include <linux/i2c.h>
-#include <linux/i2c-dev.h>
 
 /* struct file_operations changed too often in the 2.1 series for nice code */
 
@@ -107,9 +104,9 @@
 
 	struct i2c_client *client = (struct i2c_client *)file->private_data;
 
-	if(count > 8192)
+	if (count > 8192)
 		count = 8192;
-		
+
 	/* copy user space data to kernel space. */
 	tmp = kmalloc(count,GFP_KERNEL);
 	if (tmp==NULL)
diff -Nru a/drivers/i2c/i2c-elv.c b/drivers/i2c/i2c-elv.c
--- a/drivers/i2c/i2c-elv.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/i2c/i2c-elv.c	Sun Feb 23 22:25:26 2003
@@ -21,20 +21,18 @@
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
 
-/* $Id: i2c-elv.c,v 1.21 2001/11/19 18:45:02 mds Exp $ */
+/* $Id: i2c-elv.c,v 1.27 2003/01/21 08:08:16 kmalkki Exp $ */
 
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/version.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
 #include <linux/ioport.h>
-#include <asm/io.h>
 #include <linux/errno.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
+#include <asm/io.h>
 
 #define DEFAULT_BASE 0x378
 static int base=0;
@@ -120,12 +118,13 @@
  * This is only done when more than one hardware adapter is supported.
  */
 static struct i2c_algo_bit_data bit_elv_data = {
-	NULL,
-	bit_elv_setsda,
-	bit_elv_setscl,
-	bit_elv_getsda,
-	bit_elv_getscl,
-	80, 80, 100,		/*	waits, timeout */
+	.setsda		= bit_elv_setsda,
+	.setscl		= bit_elv_setscl,
+	.getsda		= bit_elv_getsda,
+	.getscl		= bit_elv_getscl,
+	.udelay		= 80,
+	.mdelay		= 80,
+	.timeout	= HZ
 };
 
 static struct i2c_adapter bit_elv_ops = {
diff -Nru a/drivers/i2c/i2c-frodo.c b/drivers/i2c/i2c-frodo.c
--- a/drivers/i2c/i2c-frodo.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/i2c/i2c-frodo.c	Sun Feb 23 22:25:21 2003
@@ -12,18 +12,14 @@
  * version 2 as published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
-#include <linux/version.h>
 #include <linux/module.h>
-
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/delay.h>
-
-#include <asm/hardware.h>
-
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
+#include <asm/hardware.h>
+
 
 static void frodo_setsda (void *data,int state)
 {
@@ -58,7 +54,7 @@
 	.getscl		= frodo_getscl,
 	.udelay		= 80,
 	.mdelay		= 80,
-	.timeout	= 100
+	.timeout	= HZ
 };
 
 static struct i2c_adapter frodo_ops = {
diff -Nru a/drivers/i2c/i2c-philips-par.c b/drivers/i2c/i2c-philips-par.c
--- a/drivers/i2c/i2c-philips-par.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/i2c/i2c-philips-par.c	Sun Feb 23 22:25:22 2003
@@ -21,7 +21,7 @@
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
 
-/* $Id: i2c-philips-par.c,v 1.23 2002/02/06 08:50:58 simon Exp $ */
+/* $Id: i2c-philips-par.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
 
 #include <linux/kernel.h>
 #include <linux/ioport.h>
@@ -32,10 +32,6 @@
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
 
-#ifndef __exit
-#define __exit __init
-#endif
-
 static int type;
 
 struct i2c_par
@@ -135,21 +131,22 @@
  */
  
 static struct i2c_algo_bit_data bit_lp_data = {
-	NULL,
-	bit_lp_setsda,
-	bit_lp_setscl,
-	bit_lp_getsda,
-	bit_lp_getscl,
-	80, 80, 100,		/*	waits, timeout */
+	.setsda		= bit_lp_setsda,
+	.setscl		= bit_lp_setscl,
+	.getsda		= bit_lp_getsda,
+	.getscl		= bit_lp_getscl,
+	.udelay		= 80,
+	.mdelay		= 80,
+	.timeout	= HZ
 }; 
 
 static struct i2c_algo_bit_data bit_lp_data2 = {
-	NULL,
-	bit_lp_setsda2,
-	bit_lp_setscl2,
-	bit_lp_getsda2,
-	NULL,
-	80, 80, 100,		/*	waits, timeout */
+	.setsda		= bit_lp_setsda2,
+	.setscl		= bit_lp_setscl2,
+	.getsda		= bit_lp_getsda2,
+	.udelay		= 80,
+	.mdelay		= 80,
+	.timeout	= HZ
 }; 
 
 static struct i2c_adapter bit_lp_ops = {
diff -Nru a/drivers/i2c/i2c-proc.c b/drivers/i2c/i2c-proc.c
--- a/drivers/i2c/i2c-proc.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/i2c/i2c-proc.c	Sun Feb 23 22:25:24 2003
@@ -29,10 +29,10 @@
 #include <linux/ctype.h>
 #include <linux/sysctl.h>
 #include <linux/proc_fs.h>
+#include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/i2c.h>
 #include <linux/i2c-proc.h>
-#include <linux/init.h>
 #include <asm/uaccess.h>
 
 static int i2c_create_name(char **name, const char *prefix,
@@ -87,7 +87,7 @@
    (for a LM78 chip on the ISA bus at port 0x310), or lm75-i2c-3-4e (for
    a LM75 chip on the third i2c bus at address 0x4e).  
    name is allocated first. */
-int i2c_create_name(char **name, const char *prefix,
+static int i2c_create_name(char **name, const char *prefix,
 			struct i2c_adapter *adapter, int addr)
 {
 	char name_buffer[50];
@@ -200,7 +200,8 @@
 {
 	ctl_table *table;
 	char *temp;
-	id -= 256;
+
+	id -= 256;	
 	if (i2c_entries[id]) {
 		table = i2c_entries[id]->ctl_table;
 		unregister_sysctl_table(i2c_entries[id]);
@@ -213,7 +214,7 @@
 	}
 }
 
-int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
+static int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
 		       void *buffer, size_t * lenp)
 {
 	char BUF[SENSORS_PREFIX_MAX + 30];
@@ -251,7 +252,7 @@
 	return 0;
 }
 
-int i2c_sysctl_chips(ctl_table * table, int *name, int nlen,
+static int i2c_sysctl_chips(ctl_table * table, int *name, int nlen,
 			 void *oldval, size_t * oldlenp, void *newval,
 			 size_t newlen, void **context)
 {
@@ -413,7 +414,7 @@
    WARNING! This is tricky code. I have tested it, but there may still be
             hidden bugs in it, even leading to crashes and things!
 */
-int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
+static int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
 			 long *results, int magnitude)
 {
 	int maxels, min, mag;
@@ -822,11 +823,11 @@
 	unregister_sysctl_table(i2c_proc_header);
 }
 
+EXPORT_SYMBOL(i2c_register_entry);
 EXPORT_SYMBOL(i2c_deregister_entry);
-EXPORT_SYMBOL(i2c_detect);
 EXPORT_SYMBOL(i2c_proc_real);
-EXPORT_SYMBOL(i2c_register_entry);
 EXPORT_SYMBOL(i2c_sysctl_real);
+EXPORT_SYMBOL(i2c_detect);
 
 MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>");
 MODULE_DESCRIPTION("i2c-proc driver");
diff -Nru a/drivers/i2c/i2c-rpx.c b/drivers/i2c/i2c-rpx.c
--- a/drivers/i2c/i2c-rpx.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/i2c/i2c-rpx.c	Sun Feb 23 22:25:26 2003
@@ -17,12 +17,11 @@
 #include <linux/init.h>
 #include <linux/stddef.h>
 #include <linux/parport.h>
-
+#include <linux/i2c.h>
+#include <linux/i2c-algo-8xx.h>
 #include <asm/mpc8xx.h>
 #include <asm/commproc.h>
 
-#include <linux/i2c.h>
-#include <linux/i2c-algo-8xx.h>
 
 static void
 rpx_iic_init(struct i2c_algo_8xx_data *data)
diff -Nru a/drivers/i2c/i2c-velleman.c b/drivers/i2c/i2c-velleman.c
--- a/drivers/i2c/i2c-velleman.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/i2c/i2c-velleman.c	Sun Feb 23 22:25:26 2003
@@ -18,17 +18,16 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.		     */
 /* ------------------------------------------------------------------------- */
 
-/* $Id: i2c-velleman.c,v 1.23 2001/11/19 18:45:02 mds Exp $ */
+/* $Id: i2c-velleman.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
 
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/string.h>  /* for 2.0 kernels to get NULL   */
-#include <asm/errno.h>     /* for 2.0 kernels to get ENODEV */
-#include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
+#include <asm/io.h>
 
 /* ----- global defines -----------------------------------------------	*/
 #define DEB(x)		/* should be reasonable open, close &c. 	*/
@@ -104,12 +103,13 @@
  */
 
 static struct i2c_algo_bit_data bit_velle_data = {
-	NULL,
-	bit_velle_setsda,
-	bit_velle_setscl,
-	bit_velle_getsda,
-	bit_velle_getscl,
-	10, 10, 100,		/*	waits, timeout */
+	.setsda		= bit_velle_setsda,
+	.setscl		= bit_velle_setscl,
+	.getsda		= bit_velle_getsda,
+	.getscl		= bit_velle_getscl,
+	.udelay		= 10,
+	.mdelay		= 10,
+	.timeout	= HZ
 };
 
 static struct i2c_adapter bit_velle_ops = {
diff -Nru a/drivers/ide/Kconfig b/drivers/ide/Kconfig
--- a/drivers/ide/Kconfig	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/Kconfig	Sun Feb 23 22:25:24 2003
@@ -239,14 +239,13 @@
 	  and your BIOS does not already do this for you, then say Y here.
 	  Otherwise say N.
 
-config BLK_DEV_ISAPNP
-	bool "ISA-PNP EIDE support"
-	depends on BLK_DEV_IDE && ISAPNP
+config BLK_DEV_IDEPNP
+	bool "PNP EIDE support"
+	depends on BLK_DEV_IDE && PNP
 	help
-	  If you have an ISA EIDE card that is PnP (Plug and Play) and
-	  requires setup first before scanning for devices, say Y here.
-
-	  If unsure, say N.
+	  If you have a PnP (Plug and Play) compatible EIDE card and
+	  would like the kernel to automatically detect and activate
+	  it, say Y here.
 
 config BLK_DEV_IDEPCI
 	bool "PCI IDE chipset support" if PCI
diff -Nru a/drivers/ide/Makefile b/drivers/ide/Makefile
--- a/drivers/ide/Makefile	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/Makefile	Sun Feb 23 22:25:24 2003
@@ -21,7 +21,7 @@
 obj-$(CONFIG_BLK_DEV_IDEPCI)		+= setup-pci.o
 obj-$(CONFIG_BLK_DEV_IDEDMA_PCI)	+= ide-dma.o
 obj-$(CONFIG_BLK_DEV_IDE_TCQ)		+= ide-tcq.o
-obj-$(CONFIG_BLK_DEV_ISAPNP)		+= ide-pnp.o
+obj-$(CONFIG_BLK_DEV_IDEPNP)		+= ide-pnp.o
 
 ifeq ($(CONFIG_BLK_DEV_IDE),y)
 obj-$(CONFIG_PROC_FS)			+= ide-proc.o
diff -Nru a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
--- a/drivers/ide/arm/icside.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/arm/icside.c	Sun Feb 23 22:25:24 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/icside.c
+ * linux/drivers/ide/arm/icside.c
  *
  * Copyright (c) 1996-2002 Russell King.
  *
@@ -813,7 +813,7 @@
 
 	for (index = 0; index < MAX_HWIFS; ++index) {
 		hwif = &ide_hwifs[index];
-		if (hwif->io_ports[IDE_DATA_OFFSET] == (ide_ioreg_t)dataport)
+		if (hwif->io_ports[IDE_DATA_OFFSET] == dataport)
 			goto found;
 	}
 
@@ -841,8 +841,8 @@
 		memset(&hwif->hw, 0, sizeof(hw_regs_t));
 
 		for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-			hwif->hw.io_ports[i] = (ide_ioreg_t)port;
-			hwif->io_ports[i] = (ide_ioreg_t)port;
+			hwif->hw.io_ports[i] = port;
+			hwif->io_ports[i] = port;
 			port += 1 << info->stepping;
 		}
 		hwif->hw.io_ports[IDE_CONTROL_OFFSET] = base + info->ctrloffset;
diff -Nru a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c
--- a/drivers/ide/arm/rapide.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/ide/arm/rapide.c	Sun Feb 23 22:25:26 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/rapide.c
+ * linux/drivers/ide/arm/rapide.c
  *
  * Copyright (c) 1996-2002 Russell King.
  */
@@ -25,7 +25,7 @@
 	memset(&hw, 0, sizeof(hw));
 
 	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw.io_ports[i] = (ide_ioreg_t)port;
+		hw.io_ports[i] = port;
 		port += 1 << 4;
 	}
 	hw.io_ports[IDE_CONTROL_OFFSET] = port + 0x206;
diff -Nru a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
--- a/drivers/ide/ide-cd.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/ide-cd.c	Sun Feb 23 22:25:24 2003
@@ -846,6 +846,7 @@
 	}
 
 	/* Set up the controller registers. */
+	/* FIXME: for Virtual DMA we must check harder */
 	HWIF(drive)->OUTB(info->dma, IDE_FEATURE_REG);
 	HWIF(drive)->OUTB(0, IDE_IREASON_REG);
 	HWIF(drive)->OUTB(0, IDE_SECTOR_REG);
@@ -854,13 +855,10 @@
 	HWIF(drive)->OUTB(xferlen >> 8  , IDE_BCOUNTH_REG);
 	if (IDE_CONTROL_REG)
 		HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
-
+ 
 	if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
-		if (HWGROUP(drive)->handler != NULL)
-			BUG();
-		ide_set_handler (drive, handler, WAIT_CMD, cdrom_timer_expiry);
 		/* packet command */
-		HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG);
+		ide_execute_command(drive, WIN_PACKETCMD, handler, WAIT_CMD, cdrom_timer_expiry);
 		return ide_started;
 	} else {
 		/* packet command */
@@ -1276,9 +1274,7 @@
 			 * this condition is far too common, to bother
 			 * users about it
 			 */
-#if 0
-			printk("%s: disabled DSC seek overlap\n", drive->name);
-#endif
+			/* printk("%s: disabled DSC seek overlap\n", drive->name);*/ 
 			drive->dsc_overlap = 0;
 		}
 	}
@@ -2965,8 +2961,10 @@
 
 	printk(", %dkB Cache", be16_to_cpu(cap.buffer_size));
 
+#ifdef CONFIG_BLK_DEV_IDEDMA
 	if (drive->using_dma)
 		(void) HWIF(drive)->ide_dma_verbose(drive);
+#endif /* CONFIG_BLK_DEV_IDEDMA */
 	printk("\n");
 
 	return nslots;
@@ -3261,11 +3259,7 @@
 	.version		= IDECD_VERSION,
 	.media			= ide_cdrom,
 	.busy			= 0,
-#ifdef CONFIG_IDEDMA_ONLYDISK
-	.supports_dma		= 0,
-#else
 	.supports_dma		= 1,
-#endif
 	.supports_dsc_overlap	= 1,
 	.cleanup		= ide_cdrom_cleanup,
 	.do_request		= ide_do_rw_cdrom,
diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
--- a/drivers/ide/ide-dma.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/ide-dma.c	Sun Feb 23 22:25:24 2003
@@ -90,9 +90,6 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
-#define CONFIG_IDEDMA_NEW_DRIVE_LISTINGS
-#ifdef CONFIG_IDEDMA_NEW_DRIVE_LISTINGS
-
 struct drive_list_entry {
 	char * id_model;
 	char * id_firmware;
@@ -165,40 +162,6 @@
 	return 0;
 }
 
-#else /* !CONFIG_IDEDMA_NEW_DRIVE_LISTINGS */
-
-/*
- * good_dma_drives() lists the model names (from "hdparm -i")
- * of drives which do not support mode2 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",
-				 "ST34342A",	/* for Sun Ultra */
-				 NULL};
-
-/*
- * bad_dma_drives() lists the model names (from "hdparm -i")
- * of drives which supposedly support (U)DMA but which are
- * known to corrupt data with this interface under Linux.
- *
- * This is an empirical list. Its generated from bug reports. That means
- * while it reflects actual problem distributions it doesn't answer whether
- * the drive or the controller, or cabling, or software, or some combination
- * thereof is the fault. If you don't happen to agree with the kernel's 
- * opinion of your drive - use hdparm to turn DMA on.
- */
-const char *bad_dma_drives[] = {"WDC AC11000H",
-				"WDC AC22100H",
-				"WDC AC32100H",
-				"WDC AC32500H",
-				"WDC AC33100H",
-				"WDC AC31600H",
- 				NULL};
-
-#endif /* CONFIG_IDEDMA_NEW_DRIVE_LISTINGS */
-
 /**
  *	ide_dma_intr	-	IDE DMA interrupt handler
  *	@drive: the drive the interrupt is for
@@ -282,6 +245,7 @@
 		hwif->sg_dma_direction = PCI_DMA_TODEVICE;
 	else
 		hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
+
 #if 1
 	if (sector_count > 256)
 		BUG();
@@ -822,7 +786,6 @@
 	if (!drive->waiting_for_dma)
 		printk(KERN_WARNING "%s: (%s) called while not waiting\n",
 			drive->name, __FUNCTION__);
-	drive->waiting_for_dma++;
 	return 0;
 }
 
@@ -832,24 +795,11 @@
 {
 	struct hd_driveid *id = drive->id;
 
-#ifdef CONFIG_IDEDMA_NEW_DRIVE_LISTINGS
 	int blacklist = in_drive_list(id, drive_blacklist);
 	if (blacklist) {
-		printk("%s: Disabling (U)DMA for %s\n", drive->name, id->model);
+		printk(KERN_WARNING "%s: Disabling (U)DMA for %s\n", drive->name, id->model);
 		return(blacklist);
 	}
-#else /* !CONFIG_IDEDMA_NEW_DRIVE_LISTINGS */
-	const char **list;
-	/* Consult the list of known "bad" drives */
-	list = bad_dma_drives;
-	while (*list) {
-		if (!strcmp(*list++,id->model)) {
-			printk("%s: Disabling (U)DMA for %s\n",
-				drive->name, id->model);
-			return 1;
-		}
-	}
-#endif /* CONFIG_IDEDMA_NEW_DRIVE_LISTINGS */
 	return 0;
 }
 
@@ -858,19 +808,7 @@
 int __ide_dma_good_drive (ide_drive_t *drive)
 {
 	struct hd_driveid *id = drive->id;
-
-#ifdef CONFIG_IDEDMA_NEW_DRIVE_LISTINGS
 	return in_drive_list(id, drive_whitelist);
-#else /* !CONFIG_IDEDMA_NEW_DRIVE_LISTINGS */
-	const char **list;
-	/* Consult the list of known "good" drives */
-	list = good_dma_drives;
-	while (*list) {
-		if (!strcmp(*list++,id->model))
-			return 1;
-	}
-#endif /* CONFIG_IDEDMA_NEW_DRIVE_LISTINGS */
-	return 0;
 }
 
 EXPORT_SYMBOL(__ide_dma_good_drive);
diff -Nru a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
--- a/drivers/ide/ide-floppy.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/ide-floppy.c	Sun Feb 23 22:25:24 2003
@@ -1857,11 +1857,7 @@
 	.version		= IDEFLOPPY_VERSION,
 	.media			= ide_floppy,
 	.busy			= 0,
-#ifdef CONFIG_IDEDMA_ONLYDISK
-	.supports_dma		= 0,
-#else
 	.supports_dma		= 1,
-#endif
 	.supports_dsc_overlap	= 0,
 	.cleanup		= idefloppy_cleanup,
 	.do_request		= idefloppy_do_request,
diff -Nru a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
--- a/drivers/ide/ide-iops.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/ide-iops.c	Sun Feb 23 22:25:23 2003
@@ -31,60 +31,129 @@
 #include <asm/io.h>
 #include <asm/bitops.h>
 
+/*
+ *	IDE operator we assign to an unplugged device so that
+ *	we don't trash new hardware assigned the same resources
+ */
+ 
+static u8 ide_unplugged_inb (unsigned long port)
+{
+	return 0xFF;
+}
+
+static u16 ide_unplugged_inw (unsigned long port)
+{
+	return 0xFFFF;
+}
+
+static void ide_unplugged_insw (unsigned long port, void *addr, u32 count)
+{
+}
+
+static u32 ide_unplugged_inl (unsigned long port)
+{
+	return 0xFFFFFFFF;
+}
+
+static void ide_unplugged_insl (unsigned long port, void *addr, u32 count)
+{
+}
+
+static void ide_unplugged_outb (u8 addr, unsigned long port)
+{
+}
+
+static void ide_unplugged_outw (u16 addr, unsigned long port)
+{
+}
+
+static void ide_unplugged_outsw (unsigned long port, void *addr, u32 count)
+{
+}
+
+static void ide_unplugged_outl (u32 addr, unsigned long port)
+{
+}
+
+static void ide_unplugged_outsl (unsigned long port, void *addr, u32 count)
+{
+}
 
-static u8 ide_inb (ide_ioreg_t port)
+void unplugged_hwif_iops (ide_hwif_t *hwif)
+{
+	hwif->OUTB	= ide_unplugged_outb;
+	hwif->OUTBSYNC	= ide_unplugged_outb;
+	hwif->OUTW	= ide_unplugged_outw;
+	hwif->OUTL	= ide_unplugged_outl;
+	hwif->OUTSW	= ide_unplugged_outsw;
+	hwif->OUTSL	= ide_unplugged_outsl;
+	hwif->INB	= ide_unplugged_inb;
+	hwif->INW	= ide_unplugged_inw;
+	hwif->INL	= ide_unplugged_inl;
+	hwif->INSW	= ide_unplugged_insw;
+	hwif->INSL	= ide_unplugged_insl;
+}
+
+EXPORT_SYMBOL(unplugged_hwif_iops);
+
+/*
+ *	Conventional PIO operations for ATA devices
+ */
+
+static u8 ide_inb (unsigned long port)
 {
 	return (u8) inb(port);
 }
 
-static u16 ide_inw (ide_ioreg_t port)
+static u16 ide_inw (unsigned long port)
 {
 	return (u16) inw(port);
 }
 
-static void ide_insw (ide_ioreg_t port, void *addr, u32 count)
+static void ide_insw (unsigned long port, void *addr, u32 count)
 {
 	return insw(port, addr, count);
 }
 
-static u32 ide_inl (ide_ioreg_t port)
+static u32 ide_inl (unsigned long port)
 {
 	return (u32) inl(port);
 }
 
-static void ide_insl (ide_ioreg_t port, void *addr, u32 count)
+static void ide_insl (unsigned long port, void *addr, u32 count)
 {
 	insl(port, addr, count);
 }
 
-static void ide_outb (u8 value, ide_ioreg_t port)
+static void ide_outb (u8 addr, unsigned long port)
 {
-	outb(value, port);
+	outb(addr, port);
 }
 
-static void ide_outw (u16 value, ide_ioreg_t port)
+static void ide_outw (u16 addr, unsigned long port)
 {
-	outw(value, port);
+	outw(addr, port);
 }
 
-static void ide_outsw (ide_ioreg_t port, void *addr, u32 count)
+static void ide_outsw (unsigned long port, void *addr, u32 count)
 {
 	outsw(port, addr, count);
 }
 
-static void ide_outl (u32 value, ide_ioreg_t port)
+static void ide_outl (u32 addr, unsigned long port)
 {
-	outl(value, port);
+	outl(addr, port);
 }
 
-static void ide_outsl (ide_ioreg_t port, void *addr, u32 count)
+static void ide_outsl (unsigned long port, void *addr, u32 count)
 {
-	outsl(port, addr, count);
+	return outsl(port, addr, count);
 }
 
 void default_hwif_iops (ide_hwif_t *hwif)
 {
 	hwif->OUTB	= ide_outb;
+	hwif->OUTBSYNC	= ide_outb;
 	hwif->OUTW	= ide_outw;
 	hwif->OUTL	= ide_outl;
 	hwif->OUTSW	= ide_outsw;
@@ -98,78 +167,66 @@
 
 EXPORT_SYMBOL(default_hwif_iops);
 
-static u8 ide_mm_inb (ide_ioreg_t port)
+/*
+ *	MMIO operations, typically used for SATA controllers
+ */
+
+static u8 ide_mm_inb (unsigned long port)
 {
 	return (u8) readb(port);
 }
 
-static u16 ide_mm_inw (ide_ioreg_t port)
+static u16 ide_mm_inw (unsigned long port)
 {
 	return (u16) readw(port);
 }
 
-static void ide_mm_insw (ide_ioreg_t port, void *addr, u32 count)
+static void ide_mm_insw (unsigned long port, void *addr, u32 count)
 {
-#ifdef CONFIG_PPC
-	/* Can we move the barrier out of the loop ? */
-	while (count--) { *(u16 *)addr = __raw_readw(port); iobarrier_r(); addr += 2; }
-#else /* everything else is sane benh */
-	while (count--) { *(u16 *)addr = readw(port); addr += 2; }
-#endif
+	__ide_mm_insw(port, addr, count);
 }
 
-static u32 ide_mm_inl (ide_ioreg_t port)
+static u32 ide_mm_inl (unsigned long port)
 {
 	return (u32) readl(port);
 }
 
-static void ide_mm_insl (ide_ioreg_t port, void *addr, u32 count)
+static void ide_mm_insl (unsigned long port, void *addr, u32 count)
 {
-#ifdef CONFIG_PPC
-	/* Can we move the barrier out of the loop ? */
-	while (count--) { *(u32 *)addr = __raw_readl(port); iobarrier_r(); addr += 4; }
-#else /* everything else is sane benh */
-	while (count--) { *(u32 *)addr = readl(port); addr += 4; }
-#endif
+	__ide_mm_insl(port, addr, count);
 }
 
-static void ide_mm_outb (u8 value, ide_ioreg_t port)
+static void ide_mm_outb (u8 value, unsigned long port)
 {
 	writeb(value, port);
 }
 
-static void ide_mm_outw (u16 value, ide_ioreg_t port)
+static void ide_mm_outw (u16 value, unsigned long port)
 {
 	writew(value, port);
 }
 
-static void ide_mm_outsw (ide_ioreg_t port, void *addr, u32 count)
+static void ide_mm_outsw (unsigned long port, void *addr, u32 count)
 {
-#ifdef CONFIG_PPC
-	/* Can we move the barrier out of the loop ? */
-	while (count--) { __raw_writew(*(u16 *)addr, port); iobarrier_w(); addr += 2; }
-#else /* everything else is sane benh */
-	while (count--) { writew(*(u16 *)addr, port); addr += 2; }
-#endif
+	__ide_mm_outsw(port, addr, count);
 }
 
-static void ide_mm_outl (u32 value, ide_ioreg_t port)
+static void ide_mm_outl (u32 value, unsigned long port)
 {
 	writel(value, port);
 }
 
-static void ide_mm_outsl (ide_ioreg_t port, void *addr, u32 count)
+static void ide_mm_outsl (unsigned long port, void *addr, u32 count)
 {
-#ifdef CONFIG_PPC
-	while (count--) { __raw_writel(*(u32 *)addr, port); iobarrier_w(); addr += 4; }
-#else /* everything else is sane benh */
-	while (count--) { writel(*(u32 *)addr, port); addr += 4; }
-#endif
+	__ide_mm_outsl(port, addr, count);
 }
 
 void default_hwif_mmiops (ide_hwif_t *hwif)
 {
 	hwif->OUTB	= ide_mm_outb;
+	/* Most systems will need to override OUTBSYNC, alas however
+	   this one is controller specific! */
+	hwif->OUTBSYNC	= ide_mm_outb;
 	hwif->OUTW	= ide_mm_outw;
 	hwif->OUTL	= ide_mm_outl;
 	hwif->OUTSW	= ide_mm_outsw;
@@ -245,7 +302,7 @@
  * of the sector count register location, with interrupts disabled
  * to ensure that the reads all happen together.
  */
-void ata_vlb_sync (ide_drive_t *drive, ide_ioreg_t port)
+void ata_vlb_sync (ide_drive_t *drive, unsigned long port)
 {
 	(void) HWIF(drive)->INB(port);
 	(void) HWIF(drive)->INB(port);
@@ -819,9 +876,9 @@
 //	while (HWGROUP(drive)->busy)
 //		ide_delay_50ms();
 
-#if !defined(CONFIG_DMA_NONPCI)
+#if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI)
 	hwif->ide_dma_host_off(drive);
-#endif /* !(CONFIG_DMA_NONPCI) */
+#endif /* (CONFIG_BLK_DEV_IDEDMA) && !(CONFIG_DMA_NONPCI) */
 
 	/*
 	 * Don't use ide_wait_cmd here - it will
@@ -887,12 +944,12 @@
 	drive->id->dma_mword &= ~0x0F00;
 	drive->id->dma_1word &= ~0x0F00;
 
-#if !defined(CONFIG_DMA_NONPCI)
+#if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(CONFIG_DMA_NONPCI)
 	if (speed >= XFER_SW_DMA_0)
 		hwif->ide_dma_host_on(drive);
 	else
-		hwif->ide_dma_off(drive);
-#endif /* !(CONFIG_DMA_NONPCI) */
+		hwif->ide_dma_off_quietly(drive);
+#endif /* (CONFIG_BLK_DEV_IDEDMA) && !(CONFIG_DMA_NONPCI) */
 
 	switch(speed) {
 		case XFER_UDMA_7:   drive->id->dma_ultra |= 0x8080; break;
@@ -926,6 +983,8 @@
  * at the appropriate code to handle the next interrupt, and a
  * timer is started to prevent us from waiting forever in case
  * something goes wrong (see the ide_timer_expiry() handler later on).
+ *
+ * See also ide_execute_command
  */
 void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler,
 		      unsigned int timeout, ide_expiry_t *expiry)
@@ -935,7 +994,7 @@
 
 	spin_lock_irqsave(&ide_lock, flags);
 	if (hwgroup->handler != NULL) {
-		printk("%s: ide_set_handler: handler not null; "
+		printk(KERN_CRIT "%s: ide_set_handler: handler not null; "
 			"old=%p, new=%p\n",
 			drive->name, hwgroup->handler, handler);
 	}
@@ -947,6 +1006,47 @@
 }
 
 EXPORT_SYMBOL(ide_set_handler);
+
+/**
+ *	ide_execute_command	-	execute an IDE command
+ *	@drive: IDE drive to issue the command against
+ *	@command: command byte to write
+ *	@handler: handler for next phase
+ *	@timeout: timeout for command
+ *	@expiry:  handler to run on timeout
+ *
+ *	Helper function to issue an IDE command. This handles the
+ *	atomicity requirements, command timing and ensures that the 
+ *	handler and IRQ setup do not race. All IDE command kick off
+ *	should go via this function or do equivalent locking.
+ */
+ 
+void ide_execute_command(ide_drive_t *drive, task_ioreg_t cmd, ide_handler_t *handler, unsigned timeout, ide_expiry_t *expiry)
+{
+	unsigned long flags;
+	ide_hwgroup_t *hwgroup = HWGROUP(drive);
+	ide_hwif_t *hwif = HWIF(drive);
+	
+	spin_lock_irqsave(&ide_lock, flags);
+	
+	if(hwgroup->handler)
+		BUG();
+	hwgroup->handler	= handler;
+	hwgroup->expiry		= expiry;
+	hwgroup->timer.expires	= jiffies + timeout;
+	add_timer(&hwgroup->timer);
+	hwif->OUTBSYNC(cmd, IDE_COMMAND_REG);
+	/* Drive takes 400nS to respond, we must avoid the IRQ being
+	   serviced before that. 
+	   
+	   FIXME: we could skip this delay with care on non shared
+	   devices 
+	*/
+	ndelay(400);
+	spin_unlock_irqrestore(&ide_lock, flags);
+}
+
+EXPORT_SYMBOL(ide_execute_command);
 
 
 /* needed below */
diff -Nru a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c
--- a/drivers/ide/ide-pnp.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/ide/ide-pnp.c	Sun Feb 23 22:25:25 2003
@@ -19,9 +19,7 @@
 #include <linux/ide.h>
 #include <linux/init.h>
 
-#include <linux/isapnp.h>
-
-#define DEV_NAME(dev) (dev->name)
+#include <linux/pnp.h>
 
 #define GENERIC_HD_DATA		0
 #define GENERIC_HD_ERROR	1
@@ -32,35 +30,31 @@
 #define GENERIC_HD_SELECT	6
 #define GENERIC_HD_STATUS	7
 
-static int generic_ide_offsets[IDE_NR_PORTS] __initdata = {
+static int generic_ide_offsets[IDE_NR_PORTS] = {
 	GENERIC_HD_DATA, GENERIC_HD_ERROR, GENERIC_HD_NSECTOR, 
 	GENERIC_HD_SECTOR, GENERIC_HD_LCYL, GENERIC_HD_HCYL,
 	GENERIC_HD_SELECT, GENERIC_HD_STATUS, -1, -1
 };
 
-/* ISA PnP device table entry */
-struct pnp_dev_t {
-	unsigned short card_vendor, card_device, vendor, device;
-	int (*init_fn)(struct pnp_dev *dev, int enable);
+/* Add your devices here :)) */
+struct pnp_device_id idepnp_devices[] = {
+  	/* Generic ESDI/IDE/ATA compatible hard disk controller */
+	{.id = "PNP0600", .driver_data = 0},
+	{.id = ""}
 };
 
-/* Generic initialisation function for ISA PnP IDE interface */
-
-static int __init pnpide_generic_init(struct pnp_dev *dev, int enable)
+static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
 {
 	hw_regs_t hw;
 	ide_hwif_t *hwif;
 	int index;
 
-	if (!enable)
-		return 0;
-
 	if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0)))
-		return 1;
+		return -1;
 
-	ide_setup_ports(&hw, (ide_ioreg_t) pnp_port_start(dev, 0),
+	ide_setup_ports(&hw, (unsigned long) pnp_port_start(dev, 0),
 			generic_ide_offsets,
-			(ide_ioreg_t) pnp_port_start(dev, 1),
+			(unsigned long) pnp_port_start(dev, 1),
 			0, NULL,
 //			generic_pnp_ide_iops,
 			pnp_irq(dev, 0));
@@ -68,82 +62,36 @@
 	index = ide_register_hw(&hw, &hwif);
 
 	if (index != -1) {
-	    	printk(KERN_INFO "ide%d: %s IDE interface\n", index, DEV_NAME(dev));
+	    	printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index);
+		pnp_set_drvdata(dev,hwif);
 		hwif->pnp_dev = dev;
 		return 0;
 	}
 
-	return 1;
+	return -1;
 }
 
-/* Add your devices here :)) */
-struct pnp_dev_t idepnp_devices[] __initdata = {
-  	/* Generic ESDI/IDE/ATA compatible hard disk controller */
-	{	ISAPNP_ANY_ID, ISAPNP_ANY_ID,
-		ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0x0600),
-		pnpide_generic_init },
-	{	0 }
-};
+static void idepnp_remove(struct pnp_dev * dev)
+{
+	ide_hwif_t *hwif = pnp_get_drvdata(dev);
+	if (hwif) {
+		ide_unregister(hwif->index);
+	} else
+		printk(KERN_ERR "idepnp: Unable to remove device, please report.\n");
+}
 
-#define NR_PNP_DEVICES 8
-struct pnp_dev_inst {
-	struct pnp_dev *dev;
-	struct pnp_dev_t *dev_type;
+static struct pnp_driver idepnp_driver = {
+	.name		= "ide",
+	.id_table	= idepnp_devices,
+	.probe		= idepnp_probe,
+	.remove		= idepnp_remove,
 };
-static struct pnp_dev_inst devices[NR_PNP_DEVICES];
-static int pnp_ide_dev_idx = 0;
 
-/*
- * Probe for ISA PnP IDE interfaces.
- */
 
-void __init pnpide_init(int enable)
+void pnpide_init(int enable)
 {
-	struct pnp_dev *dev = NULL;
-	struct pnp_dev_t *dev_type;
-
-	if (!isapnp_present())
-		return;
-
-	/* Module unload, deactivate all registered devices. */
-	if (!enable) {
-		int i;
-		for (i = 0; i < pnp_ide_dev_idx; i++) {
-			dev = devices[i].dev;
-			devices[i].dev_type->init_fn(dev, 0);
-			pnp_device_detach(dev);
-		}
-		return;
-	}
-
-	for (dev_type = idepnp_devices; dev_type->vendor; dev_type++) {
-		while ((dev = pnp_find_dev(NULL, dev_type->vendor,
-			dev_type->device, dev))) {
-			
-			if (pnp_device_attach(dev) < 0)
-				continue;
-				
-			if (pnp_activate_dev(dev, NULL) < 0) {
-				printk(KERN_ERR"ide: %s activate failed\n", DEV_NAME(dev));
-				continue;
-			}
-
-			/* Call device initialization function */
-			if (dev_type->init_fn(dev, 1)) {
-				pnp_device_detach(dev);
-			} else {
-#ifdef MODULE
-				/*
-				 * Register device in the array to
-				 * deactivate it on a module unload.
-				 */
-				if (pnp_ide_dev_idx >= NR_PNP_DEVICES)
-					return;
-				devices[pnp_ide_dev_idx].dev = dev;
-				devices[pnp_ide_dev_idx].dev_type = dev_type;
-				pnp_ide_dev_idx++;
-#endif
-			}
-		}
-	}
+	if(enable)
+		pnp_register_driver(&idepnp_driver);
+	else
+		pnp_unregister_driver(&idepnp_driver);
 }
diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/ide-probe.c	Sun Feb 23 22:25:24 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/ide-probe.c	Version 1.07	March 18, 2001
+ *  linux/drivers/ide/ide-probe.c	Version 1.10	Feb 11, 2003
  *
  *  Copyright (C) 1994-1998  Linus Torvalds & authors (see below)
  */
@@ -27,6 +27,8 @@
  * Version 1.06		stream line request queue and prep for cascade project.
  * Version 1.07		max_sect <= 255; slower disks would get behind and
  * 			then fall over when they get to 256.	Paul G.
+ * Version 1.10		Update set for new IDE. drive->id is now always
+ *			valid after probe time even with noprobe
  */
 
 #undef REALLY_SLOW_IO		/* most systems can safely undef this */
@@ -54,22 +56,54 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
-/*
- * CompactFlash cards and their brethern pretend to be removable
- * hard disks, except:
- *	(1) they never have a slave unit, and
- *	(2) they don't have doorlock mechanisms.
- * This test catches them, and is invoked elsewhere when setting
- * appropriate config bits.
- *
- * FIXME: This treatment is probably applicable for *all* PCMCIA (PC CARD)
- * devices, so in linux 2.3.x we should change this to just treat all PCMCIA
- * drives this way, and get rid of the model-name tests below
- * (too big of an interface change for 2.2.x).
- * At that time, we might also consider parameterizing the timeouts and retries,
- * since these are MUCH faster than mechanical drives.	-M.Lord
+/**
+ *	generic_id		-	add a generic drive id
+ *	@drive:	drive to make an ID block for
+ *	
+ *	Add a fake id field to the drive we are passed. This allows
+ *	use to skip a ton of NULL checks (which people always miss) 
+ *	and make drive properties unconditional outside of this file
  */
-inline int drive_is_flashcard (ide_drive_t *drive)
+ 
+static int generic_id(ide_drive_t *drive)
+{
+	drive->id = kmalloc(SECTOR_WORDS *4, GFP_KERNEL);
+	if(drive->id == NULL)
+	{
+		printk(KERN_ERR "ide: out of memory for id data.\n");
+		return -ENOMEM;
+	}
+	memset(drive->id, 0, SECTOR_WORDS * 4);
+	drive->id->cyls = drive->cyl;
+	drive->id->heads = drive->head;
+	drive->id->sectors = drive->sect;
+	drive->id->cur_cyls = drive->cyl;
+	drive->id->cur_heads = drive->head;
+	drive->id->cur_sectors = drive->sect;
+	strcpy(drive->id->model, "UNKNOWN");
+	return 0;
+}
+		
+/**
+ *	drive_is_flashcard	-	check for compact flash
+ *	@drive: drive to check
+ *
+ *	CompactFlash cards and their brethern pretend to be removable
+ *	hard disks, except:
+ * 		(1) they never have a slave unit, and
+ *		(2) they don't have doorlock mechanisms.
+ *	This test catches them, and is invoked elsewhere when setting
+ *	appropriate config bits.
+ *
+ *	FIXME: This treatment is probably applicable for *all* PCMCIA (PC CARD)
+ *	devices, so in linux 2.3.x we should change this to just treat all
+ *	PCMCIA  drives this way, and get rid of the model-name tests below
+ *	(too big of an interface change for 2.4.x).
+ *	At that time, we might also consider parameterizing the timeouts and
+ *	retries, since these are MUCH faster than mechanical drives. -M.Lord
+ */
+ 
+static inline int drive_is_flashcard (ide_drive_t *drive)
 {
 	struct hd_driveid *id = drive->id;
 
@@ -88,6 +122,16 @@
 	return 0;	/* no, it is not a flash memory card */
 }
 
+/**
+ *	do_identify	-	identify a drive
+ *	@drive: drive to identify 
+ *	@cmd: command used
+ *
+ *	Called when we have issued a drive identify command to
+ *	read and parse the results. This function is run with
+ *	interrupts disabled. 
+ */
+ 
 static inline void do_identify (ide_drive_t *drive, u8 cmd)
 {
 	ide_hwif_t *hwif = HWIF(drive);
@@ -207,6 +251,7 @@
 	 */
 	if (id->config & (1<<7))
 		drive->removable = 1;
+		
 	/*
 	 * Prevent long system lockup probing later for non-existant
 	 * slave drive if the hwif is actually a flash memory card of
@@ -214,11 +259,17 @@
 	 */
 	drive->is_flash = 0;
 	if (drive_is_flashcard(drive)) {
+#if 0
+		/* The new IDE adapter widgets don't follow this heuristic
+		   so we must nowdays just bite the bullet and take the
+		   probe hit */	
+		ide_drive_t *mate = &hwif->drives[1^drive->select.b.unit];		
 		ide_drive_t *mate = &hwif->drives[1^drive->select.b.unit];
 		if (!mate->ata_flash) {
 			mate->present = 0;
 			mate->noprobe = 1;
 		}
+#endif		
 		drive->is_flash = 1;
 	}
 	drive->media = ide_disk;
@@ -244,21 +295,26 @@
 	return;
 }
 
-/*
- * try_to_identify() sends an ATA(PI) IDENTIFY request to a drive
- * and waits for a response.  It also monitors irqs while this is
- * happening, in hope of automatically determining which one is
- * being used by the interface.
+/**
+ *	actual_try_to_identify	-	send ata/atapi identify
+ *	@drive: drive to identify
+ *	@cmd: comamnd to use
  *
- * Returns:	0  device was identified
- *		1  device timed-out (no response to identify request)
- *		2  device aborted the command (refused to identify itself)
+ *	try_to_identify() sends an ATA(PI) IDENTIFY request to a drive
+ *	and waits for a response.  It also monitors irqs while this is
+ *	happening, in hope of automatically determining which one is
+ *	being used by the interface.
+ *
+ *	Returns:	0  device was identified
+ *			1  device timed-out (no response to identify request)
+ *			2  device aborted the command (refused to identify itself)
  */
+
 static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)
 {
 	ide_hwif_t *hwif = HWIF(drive);
 	int rc;
-	ide_ioreg_t hd_status;
+	unsigned long hd_status;
 	unsigned long timeout;
 	u8 s = 0, a = 0;
 
@@ -268,7 +324,7 @@
 		a = hwif->INB(IDE_ALTSTATUS_REG);
 		s = hwif->INB(IDE_STATUS_REG);
 		if ((a ^ s) & ~INDEX_STAT) {
-			printk("%s: probing with STATUS(0x%02x) instead of "
+			printk(KERN_INFO "%s: probing with STATUS(0x%02x) instead of "
 				"ALTSTATUS(0x%02x)\n", drive->name, s, a);
 			/* ancient Seagate drives, broken interfaces */
 			hd_status = IDE_STATUS_REG;
@@ -327,6 +383,16 @@
 	return rc;
 }
 
+/**
+ *	try_to_identify	-	try to identify a drive
+ *	@drive: drive to probe
+ *	@cmd: comamnd to use
+ *
+ *	Issue the identify command and then do IRQ probing to
+ *	complete the identification when needed by finding the
+ *	IRQ the drive is attached to
+ */
+ 
 static int try_to_identify (ide_drive_t *drive, u8 cmd)
 {
 	ide_hwif_t *hwif = HWIF(drive);
@@ -376,15 +442,19 @@
 }
 
 
-/*
- * do_probe() has the difficult job of finding a drive if it exists,
- * without getting hung up if it doesn't exist, without trampling on
- * ethernet cards, and without leaving any IRQs dangling to haunt us later.
- *
- * If a drive is "known" to exist (from CMOS or kernel parameters),
- * but does not respond right away, the probe will "hang in there"
- * for the maximum wait time (about 30 seconds), otherwise it will
- * exit much more quickly.
+/**
+ *	do_probe		-	probe an IDE device
+ *	@drive: drive to probe
+ *	@cmd: command to use
+ *
+ *	do_probe() has the difficult job of finding a drive if it exists,
+ *	without getting hung up if it doesn't exist, without trampling on
+ *	ethernet cards, and without leaving any IRQs dangling to haunt us later.
+ *
+ *	If a drive is "known" to exist (from CMOS or kernel parameters),
+ *	but does not respond right away, the probe will "hang in there"
+ *	for the maximum wait time (about 30 seconds), otherwise it will
+ *	exit much more quickly.
  *
  * Returns:	0  device was identified
  *		1  device timed-out (no response to identify request)
@@ -392,6 +462,7 @@
  *		3  bad status from device (possible for ATAPI drives)
  *		4  probe was not attempted because failure was obvious
  */
+
 static int do_probe (ide_drive_t *drive, u8 cmd)
 {
 	int rc;
@@ -507,44 +578,55 @@
 	}
 }
 
-/*
- * probe_for_drive() tests for existence of a given drive using do_probe().
+/**
+ *	probe_for_drives	-	upper level drive probe
+ *	@drive: drive to probe for
+ *
+ *	probe_for_drive() tests for existence of a given drive using do_probe()
+ *	and presents things to the user as needed.
  *
- * Returns:	0  no device was found
- *		1  device was found (note: drive->present might still be 0)
+ *	Returns:	0  no device was found
+ *			1  device was found (note: drive->present might
+ *			   still be 0)
  */
+ 
 static inline u8 probe_for_drive (ide_drive_t *drive)
 {
 	/* skip probing? */
-	if (drive->noprobe)
-		return drive->present;
-
-	/* if !(success||timed-out) */
-	if (do_probe(drive, WIN_IDENTIFY) >= 2) {
-		/* look for ATAPI device */
-		(void) do_probe(drive, WIN_PIDENTIFY);
+	if (!drive->noprobe)
+	{
+		/* if !(success||timed-out) */
+		if (do_probe(drive, WIN_IDENTIFY) >= 2) {
+			/* look for ATAPI device */
+			(void) do_probe(drive, WIN_PIDENTIFY);
+		}
+		if (drive->id && strstr(drive->id->model, "E X A B Y T E N E S T"))
+			enable_nest(drive);
+		if (!drive->present)
+			/* drive not found */
+			return 0;
+	
+		/* identification failed? */
+		if (drive->id == NULL) {
+			if (drive->media == ide_disk) {
+				printk(KERN_INFO "%s: non-IDE drive, CHS=%d/%d/%d\n",
+					drive->name, drive->cyl,
+					drive->head, drive->sect);
+			} else if (drive->media == ide_cdrom) {
+				printk(KERN_INFO "%s: ATAPI cdrom (?)\n", drive->name);
+			} else {
+				/* nuke it */
+				drive->present = 0;
+			}
+		}
+		/* drive was found */
 	}
-	if (drive->id && strstr(drive->id->model, "E X A B Y T E N E S T"))
-		enable_nest(drive);
-	if (!drive->present)
-		/* drive not found */
+	if(!drive->present)
 		return 0;
-
-	/* identification failed? */
-	if (drive->id == NULL) {
-		if (drive->media == ide_disk) {
-			printk("%s: non-IDE drive, CHS=%d/%d/%d\n",
-				drive->name, drive->cyl,
-				drive->head, drive->sect);
-		} else if (drive->media == ide_cdrom) {
-			printk("%s: ATAPI cdrom (?)\n", drive->name);
-		} else {
-			/* nuke it */
+	if(drive->id == NULL)
+		if(generic_id(drive) < 0)
 			drive->present = 0;
-		}
-	}
-	/* drive was found */
-	return 1;
+	return drive->present;
 }
 
 static int hwif_check_region(ide_hwif_t *hwif, unsigned long addr, int num)
@@ -560,12 +642,21 @@
 	{
 		printk("%s: %s resource 0x%lX-0x%lX not free.\n",
 			hwif->name, hwif->mmio?"MMIO":"I/O", addr, addr+num-1);
-		mdelay(2000);
 	}
 	return err;
 }
-		
+	
 
+/**
+ *	hwif_check_regions	-	check resources for IDE
+ *	@hwif: interface to use
+ *
+ *	Checks if all the needed resources for an interface are free
+ *	providing the interface is PIO. Right now core IDE code does
+ *	this work which is deeply wrong. MMIO leaves it to the controller
+ *	driver, PIO will migrate this way over time
+ */
+ 
 static int hwif_check_regions (ide_hwif_t *hwif)
 {
 	u32 i		= 0;
@@ -627,6 +718,72 @@
 
 //EXPORT_SYMBOL(hwif_register);
 
+/* Enable code below on all archs later, for now, I want it on PPC
+ */
+#ifdef CONFIG_PPC
+/*
+ * This function waits for the hwif to report a non-busy status
+ * see comments in probe_hwif()
+ */
+static int wait_not_busy(ide_hwif_t *hwif, unsigned long timeout)
+{
+	u8 stat = 0;
+	
+	while(timeout--) {
+		/* Turn this into a schedule() sleep once I'm sure
+		 * about locking issues (2.5 work ?)
+		 */
+		mdelay(1);
+		stat = hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]);
+		if ((stat & BUSY_STAT) == 0)
+			break;
+		/* Assume a value of 0xff means nothing is connected to
+		 * the interface and it doesn't implement the pull-down
+		 * resistor on D7
+		 */
+		if (stat == 0xff)
+			break;
+	}
+	return ((stat & BUSY_STAT) == 0) ? 0 : -EBUSY;
+}
+
+static int wait_hwif_ready(ide_hwif_t *hwif)
+{
+	int rc;
+
+	printk(KERN_INFO "Probing IDE interface %s...\n", hwif->name);
+
+	/* Let HW settle down a bit from whatever init state we
+	 * come from */
+	mdelay(2);
+
+	/* Wait for BSY bit to go away, spec timeout is 30 seconds,
+	 * I know of at least one disk who takes 31 seconds, I use 35
+	 * here to be safe
+	 */
+	rc = wait_not_busy(hwif, 35000);
+	if (rc)
+		return rc;
+
+	/* Now make sure both master & slave are ready */
+	SELECT_DRIVE(&hwif->drives[0]);
+	hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
+	mdelay(2);
+	rc = wait_not_busy(hwif, 10000);
+	if (rc)
+		return rc;
+	SELECT_DRIVE(&hwif->drives[1]);
+	hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
+	mdelay(2);
+	rc = wait_not_busy(hwif, 10000);
+
+	/* Exit function with master reselected (let's be sane) */
+	SELECT_DRIVE(&hwif->drives[0]);
+	
+	return rc;
+}
+#endif /* CONFIG_PPC */
+
 /*
  * This routine only knows how to look for drive units 0 and 1
  * on an interface, so any setting of MAX_DRIVES > 2 won't work here.
@@ -650,13 +807,13 @@
 			ide_drive_t *drive = &hwif->drives[unit];
 			if (drive->present) {
 				drive->present = 0;
-				printk("%s: ERROR, PORTS ALREADY IN USE\n",
+				printk(KERN_ERR "%s: ERROR, PORTS ALREADY IN USE\n",
 					drive->name);
 				msgout = 1;
 			}
 		}
 		if (!msgout)
-			printk("%s: ports already in use, skipping probe\n",
+			printk(KERN_ERR "%s: ports already in use, skipping probe\n",
 				hwif->name);
 		return;	
 	}
@@ -666,17 +823,35 @@
 	 * we'll install our IRQ driver much later...
 	 */
 	irqd = hwif->irq;
-	
-	if (irqd >= NR_IRQS)
-	{
-		printk(KERN_ERR "***WARNING***: Bogus interrupt reported. Probably a bug in the Linux ACPI\n");
-		printk(KERN_ERR "***WARNING***: Attempting to continue as best we can.\n");
-		irqd = 0;
-	}
 	if (irqd)
 		disable_irq(hwif->irq);
 
 	local_irq_set(flags);
+
+#ifdef CONFIG_PPC
+	/* This is needed on some PPCs and a bunch of BIOS-less embedded
+	 * platforms. Typical cases are:
+	 * 
+	 *  - The firmware hard reset the disk before booting the kernel,
+	 *    the drive is still doing it's poweron-reset sequence, that
+	 *    can take up to 30 seconds
+	 *  - The firmware does nothing (or no firmware), the device is
+	 *    still in POST state (same as above actually).
+	 *  - Some CD/DVD/Writer combo drives tend to drive the bus during
+	 *    their reset sequence even when they are non-selected slave
+	 *    devices, thus preventing discovery of the main HD
+	 *    
+	 *  Doing this wait-for-busy should not harm any existing configuration
+	 *  (at least things won't be worse than what current code does, that
+	 *  is blindly go & talk to the drive) and fix some issues like the
+	 *  above.
+	 *  
+	 *  BenH.
+	 */
+	if (wait_hwif_ready(hwif))
+		printk(KERN_WARNING "%s: Wait for ready failed before probe !\n", hwif->name);
+#endif /* CONFIG_PPC */
+
 	/*
 	 * Second drive should only exist if first drive was found,
 	 * but a lot of cdrom drives are configured as single slaves.
@@ -689,6 +864,7 @@
 		if (drive->present && !hwif->present) {
 			hwif->present = 1;
 			if (hwif->chipset != ide_4drives ||
+			    !hwif->mate || 
 			    !hwif->mate->present) {
 				hwif_register(hwif);
 			}
@@ -698,7 +874,7 @@
 		unsigned long timeout = jiffies + WAIT_WORSTCASE;
 		u8 stat;
 
-		printk("%s: reset\n", hwif->name);
+		printk(KERN_WARNING "%s: reset\n", hwif->name);
 		hwif->OUTB(12, hwif->io_ports[IDE_CONTROL_OFFSET]);
 		udelay(10);
 		hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
@@ -718,11 +894,18 @@
 
 	for (unit = 0; unit < MAX_DRIVES; ++unit) {
 		ide_drive_t *drive = &hwif->drives[unit];
+		int enable_dma = 1;
+
 		if (drive->present) {
 			if (hwif->tuneproc != NULL && 
 				drive->autotune == IDE_TUNE_AUTO)
 				/* auto-tune PIO mode */
 				hwif->tuneproc(drive, 255);
+
+#ifdef CONFIG_IDEDMA_ONLYDISK
+			if (drive->media != ide_disk)
+				enable_dma = 0;
+#endif
 			/*
 			 * MAJOR HACK BARF :-/
 			 *
@@ -742,7 +925,8 @@
 				 *   PARANOIA!!!
 				 */
 				hwif->ide_dma_off_quietly(drive);
-				hwif->ide_dma_check(drive);
+				if (enable_dma)
+					hwif->ide_dma_check(drive);
 			}
 		}
 	}
@@ -757,7 +941,6 @@
 	probe_hwif(hwif);
 	hwif_init(hwif);
 
-#if 1
 	if (hwif->present) {
 		u16 unit = 0;
 		for (unit = 0; unit < MAX_DRIVES; ++unit) {
@@ -767,7 +950,6 @@
 			}
 		}
 	}
-#endif
 	hwif->initializing = 0;
 	return 0;
 }
@@ -855,13 +1037,8 @@
 	ide_hwgroup_t *hwgroup, *new_hwgroup;
 	ide_hwif_t *match = NULL;
 
-#if 0
-	/* Allocate the buffer and no sleep allowed */
-	new_hwgroup = kmalloc(sizeof(ide_hwgroup_t),GFP_ATOMIC);
-#else
 	/* Allocate the buffer and potentially sleep first */
 	new_hwgroup = kmalloc(sizeof(ide_hwgroup_t),GFP_KERNEL);
-#endif
 	
 	spin_lock_irqsave(&ide_lock, flags);
 
@@ -1188,7 +1365,7 @@
 {
 	unsigned int index;
 	int probe[MAX_HWIFS];
-
+	
 	MOD_INC_USE_COUNT;
 	memset(probe, 0, MAX_HWIFS * sizeof(int));
 	for (index = 0; index < MAX_HWIFS; ++index)
diff -Nru a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
--- a/drivers/ide/ide-proc.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/ide-proc.c	Sun Feb 23 22:25:24 2003
@@ -407,20 +407,40 @@
 {
 	ide_drive_t	*drive = (ide_drive_t *)data;
 	int		len = 0, i = 0;
+	int		err = 0;
 
-	if (drive && !taskfile_lib_get_identify(drive, page)) {
+	len = sprintf(page, "\n");
+	
+	if (drive)
+	{
 		unsigned short *val = (unsigned short *) page;
-		char *out = ((char *)val) + (SECTOR_WORDS * 4);
-		page = out;
-		do {
-			out += sprintf(out, "%04x%c",
-				le16_to_cpu(*val), (++i & 7) ? ' ' : '\n');
-			val += 1;
-		} while (i < (SECTOR_WORDS * 2));
-		len = out - page;
+		
+		/*
+		 *	The current code can't handle a driverless
+		 *	identify query taskfile. Now the right fix is
+		 *	to add a 'default' driver but that is a bit
+		 *	more work. 
+		 *
+		 *	FIXME: this has to be fixed for hotswap devices
+		 */
+		 
+		if(DRIVER(drive))
+			err = taskfile_lib_get_identify(drive, page);
+		else	/* This relies on the ID changes */
+			val = (unsigned short *)drive->id;
+
+		if(!err)
+		{						
+			char *out = ((char *)page) + (SECTOR_WORDS * 4);
+			page = out;
+			do {
+				out += sprintf(out, "%04x%c",
+					le16_to_cpu(*val), (++i & 7) ? ' ' : '\n');
+				val += 1;
+			} while (i < (SECTOR_WORDS * 2));
+			len = out - page;
+		}
 	}
-	else
-		len = sprintf(page, "\n");
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
@@ -434,6 +454,7 @@
 	char		*out = page;
 	int		len, rc, mul_factor, div_factor;
 
+	down(&ide_setting_sem);
 	out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n");
 	out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n");
 	while(setting) {
@@ -453,6 +474,7 @@
 		setting = setting->next;
 	}
 	len = out - page;
+	up(&ide_setting_sem);
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
@@ -521,12 +543,17 @@
 				--n;
 				++p;
 			}
+			
+			down(&ide_setting_sem);
 			setting = ide_find_setting_by_name(drive, name);
 			if (!setting)
+			{
+				up(&ide_setting_sem);
 				goto parse_error;
-
+			}
 			if (for_real)
 				ide_write_setting(drive, setting, val * setting->div_factor / setting->mul_factor);
+			up(&ide_setting_sem);
 		}
 	} while (!for_real++);
 	return count;
diff -Nru a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
--- a/drivers/ide/ide-tape.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/ide-tape.c	Sun Feb 23 22:25:23 2003
@@ -6221,11 +6221,7 @@
 	.version		= IDETAPE_VERSION,
 	.media			= ide_tape,
 	.busy			= 1,
-#ifdef CONFIG_IDEDMA_ONLYDISK
-	.supports_dma		= 0,
-#else
 	.supports_dma		= 1,
-#endif
 	.supports_dsc_overlap 	= 1,
 	.cleanup		= idetape_cleanup,
 	.do_request		= idetape_do_request,
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/ide.c	Sun Feb 23 22:25:23 2003
@@ -775,6 +775,7 @@
 	hwif->iops			= old_hwif.iops;
 #else
 	hwif->OUTB		= old_hwif.OUTB;
+	hwif->OUTBSYNC		= old_hwif.OUTBSYNC;
 	hwif->OUTW		= old_hwif.OUTW;
 	hwif->OUTL		= old_hwif.OUTL;
 	hwif->OUTSW		= old_hwif.OUTSW;
@@ -817,6 +818,7 @@
 
 EXPORT_SYMBOL(ide_unregister);
 
+
 /**
  *	ide_setup_ports 	-	set up IDE interface ports
  *	@hw: register descriptions
@@ -833,8 +835,8 @@
  */
  
 void ide_setup_ports (	hw_regs_t *hw,
-			ide_ioreg_t base, int *offsets,
-			ide_ioreg_t ctrl, ide_ioreg_t intr,
+			unsigned long base, int *offsets,
+			unsigned long ctrl, unsigned long intr,
 			ide_ack_intr_t *ack_intr,
 /*
  *			ide_io_ops_t *iops,
@@ -930,38 +932,52 @@
 int ide_register (int arg1, int arg2, int irq)
 {
 	hw_regs_t hw;
-	ide_init_hwif_ports(&hw, (ide_ioreg_t) arg1, (ide_ioreg_t) arg2, NULL);
+	ide_init_hwif_ports(&hw, (unsigned long) arg1, (unsigned long) arg2, NULL);
 	hw.irq = irq;
 	return ide_register_hw(&hw, NULL);
 }
 
 EXPORT_SYMBOL(ide_register);
 
+
+/*
+ *	Locks for IDE setting functionality
+ */
+
+DECLARE_MUTEX(ide_setting_sem);
+EXPORT_SYMBOL(ide_setting_sem);
+
 /**
- *	ide_add_setting		-	attach an IDE setting
- *	drive: drive the setting is for
- *	name: name of setting
- *	rw: set if writable
- *	read_ioctl: read function
- *	write_ioctl: write function
- *	data_type: form expected
- *	min: minimum
- *	max: maximum
- *	mul_factor: multiply by
- *	div_factor: divide by
- *	data: value
- *	set: handling for setting
- *
- *	Add a setting to the IDE drive. Support automatic removal and allow
- *	all the work to be done by plugged in handlers. This code is also
- *	rather short on locking, but the current plan is to do the locking
- *	internally to the function. 
+ *	ide_add_setting	-	add an ide setting option
+ *	@drive: drive to use
+ *	@name: setting name
+ *	@rw: true if the function is read write
+ *	@read_ioctl: function to call on read
+ *	@write_ioctl: function to call on write
+ *	@data_type: type of data
+ *	@min: range minimum
+ *	@max: range maximum
+ *	@mul_factor: multiplication scale
+ *	@div_factor: divison scale
+ *	@data: private data field
+ *	@set: setting
+ *
+ *	Removes the setting named from the device if it is present.
+ *	The function takes the settings_lock to protect against 
+ *	parallel changes. This function must not be called from IRQ
+ *	context. Returns 0 on success or -1 on failure.
+ *
+ *	BUGS: This code is seriously over-engineered. There is also
+ *	magic about how the driver specific features are setup. If
+ *	a driver is attached we assume the driver settings are auto
+ *	remove.
  */
  
-void ide_add_setting (ide_drive_t *drive, const char *name, int rw, int read_ioctl, int write_ioctl, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set)
+int ide_add_setting (ide_drive_t *drive, const char *name, int rw, int read_ioctl, int write_ioctl, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set)
 {
 	ide_settings_t **p = (ide_settings_t **) &drive->settings, *setting = NULL;
 
+	down(&ide_setting_sem);
 	while ((*p) && strcmp((*p)->name, name) < 0)
 		p = &((*p)->next);
 	if ((setting = kmalloc(sizeof(*setting), GFP_KERNEL)) == NULL)
@@ -980,49 +996,76 @@
 	setting->div_factor = div_factor;
 	setting->data = data;
 	setting->set = set;
+	
 	setting->next = *p;
 	if (drive->driver)
 		setting->auto_remove = 1;
 	*p = setting;
-	return;
+	up(&ide_setting_sem);
+	return 0;
 abort:
+	up(&ide_setting_sem);
 	if (setting)
 		kfree(setting);
+	return -1;
 }
 
 EXPORT_SYMBOL(ide_add_setting);
 
 /**
- *	ide_remove_setting	-	remove an ioctl setting
- *	@name:	name of the property
+ *	__ide_remove_setting	-	remove an ide setting option
+ *	@drive: drive to use
+ *	@name: setting name
  *
- *	Remove a drive ioctl setting that was created by ide_add_setting.
- *	Again this needs the locking fixed
+ *	Removes the setting named from the device if it is present.
+ *	The caller must hold the setting semaphore.
  */
  
-void ide_remove_setting (ide_drive_t *drive, char *name)
+static void __ide_remove_setting (ide_drive_t *drive, char *name)
 {
-	ide_settings_t **p = (ide_settings_t **) &drive->settings, *setting;
+	ide_settings_t **p, *setting;
+
+	p = (ide_settings_t **) &drive->settings;
 
 	while ((*p) && strcmp((*p)->name, name))
 		p = &((*p)->next);
 	if ((setting = (*p)) == NULL)
 		return;
+
 	(*p) = setting->next;
+	
 	kfree(setting->name);
 	kfree(setting);
 }
 
+/**
+ *	ide_remove_setting	-	remove an ide setting option
+ *	@drive: drive to use
+ *	@name: setting name
+ *
+ *	Removes the setting named from the device if it is present.
+ *	The function takes the settings_lock to protect against 
+ *	parallel changes. This function must not be called from IRQ
+ *	context.
+ */
+ 
+void ide_remove_setting (ide_drive_t *drive, char *name)
+{
+	down(&ide_setting_sem);
+	__ide_remove_setting(drive, name);
+	up(&ide_setting_sem);
+}
+
 EXPORT_SYMBOL(ide_remove_setting);
 
 /**
- *	ide_find_setting_by_ioctl	-	find a setting handler by its command
- *	@drive: drive to act for
- *	@cmd: ioctl command code
- *
- *	Scan the drive handlers for an ioctl handler for this function.
- *	The handlers vary by drive and sometimes by drive state. 
- *	Needs locking fixes.
+ *	ide_find_setting_by_ioctl	-	find a drive specific ioctl
+ *	@drive: drive to scan
+ *	@cmd: ioctl command to handle
+ *
+ *	Scan's the device setting table for a matching entry and returns
+ *	this or NULL if no entry is found. The caller must hold the
+ *	setting semaphore
  */
  
 static ide_settings_t *ide_find_setting_by_ioctl (ide_drive_t *drive, int cmd)
@@ -1034,17 +1077,18 @@
 			break;
 		setting = setting->next;
 	}
+	
 	return setting;
 }
 
 /**
- *	ide_find_setting_by_name	-	find a setting handler by its name
- *	@drive: drive to act for
- *	@cmd: ioctl command code
- *
- *	Scan the drive handlers handler matching the name for this function.
- *	The handlers vary by drive and sometimes by drive state. 
- *	Needs locking fixes.
+ *	ide_find_setting_by_name	-	find a drive specific setting
+ *	@drive: drive to scan
+ *	@name: setting name
+ *
+ *	Scan's the device setting table for a matching entry and returns
+ *	this or NULL if no entry is found. The caller must hold the
+ *	setting semaphore
  */
  
 ide_settings_t *ide_find_setting_by_name (ide_drive_t *drive, char *name)
@@ -1060,30 +1104,43 @@
 }
 
 /**
- *	auto_remove_settings	-	remove driver settings on a device
- *	@drive: drive to clean
+ *	auto_remove_settings	-	remove driver specific settings
+ *	@drive: drive
  *
- *	Called when we change the driver bindings for a device, for 
- *	example if the device is hot plugged. We must scrub the driver
- *	bindings that are thus no longer relevant to the device in case
- *	it changes from say a CD-ROM to a disk
- *	Needs locking fixes
+ *	Automatically remove all the driver specific settings for this
+ *	drive. This function may sleep and must not be called from IRQ
+ *	context. Takes the settings_lock
  */
  
 static void auto_remove_settings (ide_drive_t *drive)
 {
 	ide_settings_t *setting;
+	down(&ide_setting_sem);
 repeat:
 	setting = drive->settings;
 	while (setting) {
 		if (setting->auto_remove) {
-			ide_remove_setting(drive, setting->name);
+			__ide_remove_setting(drive, setting->name);
 			goto repeat;
 		}
 		setting = setting->next;
 	}
+	up(&ide_setting_sem);
 }
 
+/**
+ *	ide_read_setting	-	read an IDE setting
+ *	@drive: drive to read from
+ *	@setting: drive setting
+ *
+ *	Read a drive setting and return the value. The caller
+ *	must hold the ide_setting_sem when making this call.
+ *
+ *	BUGS: the data return and error are the same return value
+ *	so an error -EINVAL and true return of the same value cannot
+ *	be told apart
+ */
+ 
 int ide_read_setting (ide_drive_t *drive, ide_settings_t *setting)
 {
 	int		val = -EINVAL;
@@ -1132,10 +1189,22 @@
 
 EXPORT_SYMBOL(ide_spin_wait_hwgroup);
 
-/*
- * FIXME:  This should be changed to enqueue a special request
- * to the driver to change settings, and then wait on a sema for completion.
- * The current scheme of polling is kludgey, though safe enough.
+/**
+ *	ide_write_setting	-	read an IDE setting
+ *	@drive: drive to read from
+ *	@setting: drive setting
+ *	@val: value
+ *
+ *	Write a drive setting if it is possible. The caller
+ *	must hold the ide_setting_sem when making this call.
+ *
+ *	BUGS: the data return and error are the same return value
+ *	so an error -EINVAL and true return of the same value cannot
+ *	be told apart
+ *
+ *	FIXME:  This should be changed to enqueue a special request
+ *	to the driver to change settings, and then wait on a sema for completion.
+ *	The current scheme of polling is kludgy, though safe enough.
  */
 int ide_write_setting (ide_drive_t *drive, ide_settings_t *setting, int val)
 {
@@ -1360,16 +1429,22 @@
 	ide_settings_t *setting;
 	int err = 0;
 
+	down(&ide_setting_sem);
 	if ((setting = ide_find_setting_by_ioctl(drive, cmd)) != NULL) {
 		if (cmd == setting->read_ioctl) {
 			err = ide_read_setting(drive, setting);
+			up(&ide_setting_sem);
 			return err >= 0 ? put_user(err, (long *) arg) : err;
 		} else {
 			if (bdev != bdev->bd_contains)
-				return -EINVAL;
-			return ide_write_setting(drive, setting, arg);
+				err = -EINVAL;
+			else
+				err = ide_write_setting(drive, setting, arg);
+			up(&ide_setting_sem);
+			return err;
 		}
 	}
+	up(&ide_setting_sem);
 
 	switch (cmd) {
 		case HDIO_GETGEO:
@@ -1976,7 +2051,7 @@
 				vals[2] = 0;	/* default irq = probe for it */
 			case 3: /* base,ctl,irq */
 				hwif->hw.irq = vals[2];
-				ide_init_hwif_ports(&hwif->hw, (ide_ioreg_t) vals[0], (ide_ioreg_t) vals[1], &hwif->irq);
+				ide_init_hwif_ports(&hwif->hw, (unsigned long) vals[0], (unsigned long) vals[1], &hwif->irq);
 				memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
 				hwif->irq      = vals[2];
 				hwif->noprobe  = 0;
@@ -2071,12 +2146,12 @@
 		buddha_init();
 	}
 #endif /* CONFIG_BLK_DEV_BUDDHA */
-#if defined(CONFIG_BLK_DEV_ISAPNP) && defined(CONFIG_ISAPNP)
+#if defined(CONFIG_BLK_DEV_IDEPNP) && defined(CONFIG_PNP)
 	{
 		extern void pnpide_init(int enable);
 		pnpide_init(1);
 	}
-#endif /* CONFIG_BLK_DEV_ISAPNP */
+#endif /* CONFIG_BLK_DEV_IDEPNP */
 }
 
 void __init ide_init_builtin_drivers (void)
@@ -2247,9 +2322,9 @@
 		spin_unlock_irqrestore(&ide_lock, flags);
 		return 1;
 	}
-#if defined(CONFIG_BLK_DEV_ISAPNP) && defined(CONFIG_ISAPNP) && defined(MODULE)
+#if defined(CONFIG_BLK_DEV_IDEPNP) && defined(CONFIG_PNP) && defined(MODULE)
 	pnpide_init(0);
-#endif /* CONFIG_BLK_DEV_ISAPNP */
+#endif /* CONFIG_BLK_DEV_IDEPNP */
 #ifdef CONFIG_PROC_FS
 	ide_remove_proc_entries(drive->proc, DRIVER(drive)->proc);
 	ide_remove_proc_entries(drive->proc, generic_subdriver_entries);
diff -Nru a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
--- a/drivers/ide/legacy/ali14xx.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/ide/legacy/ali14xx.c	Sun Feb 23 22:25:22 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/ali14xx.c		Version 0.03	Feb 09, 1996
+ *  linux/drivers/ide/legacy/ali14xx.c		Version 0.03	Feb 09, 1996
  *
  *  Copyright (C) 1996  Linus Torvalds & author (see below)
  */
diff -Nru a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c
--- a/drivers/ide/legacy/buddha.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/legacy/buddha.c	Sun Feb 23 22:25:23 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/buddha.c -- Amiga Buddha, Catweasel and X-Surf IDE Driver
+ *  linux/drivers/ide/legacy/buddha.c -- Amiga Buddha, Catweasel and X-Surf IDE Driver
  *
  *	Copyright (C) 1997, 2001 by Geert Uytterhoeven and others
  *
@@ -197,16 +197,16 @@
 		
 		for(i=0;i<buddha_num_hwifs;i++) {
 			if(type != BOARD_XSURF) {
-				ide_setup_ports(&hw, (ide_ioreg_t)(buddha_board+buddha_bases[i]),
+				ide_setup_ports(&hw, (buddha_board+buddha_bases[i]),
 						buddha_offsets, 0,
-						(ide_ioreg_t)(buddha_board+buddha_irqports[i]),
+						(buddha_board+buddha_irqports[i]),
 						buddha_ack_intr,
 //						budda_iops,
 						IRQ_AMIGA_PORTS);
 			} else {
-				ide_setup_ports(&hw, (ide_ioreg_t)(buddha_board+xsurf_bases[i]),
+				ide_setup_ports(&hw, (buddha_board+xsurf_bases[i]),
 						xsurf_offsets, 0,
-						(ide_ioreg_t)(buddha_board+xsurf_irqports[i]),
+						(buddha_board+xsurf_irqports[i]),
 						xsurf_ack_intr,
 //						xsurf_iops,
 						IRQ_AMIGA_PORTS);
diff -Nru a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
--- a/drivers/ide/legacy/dtc2278.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/legacy/dtc2278.c	Sun Feb 23 22:25:23 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/dtc2278.c		Version 0.02	Feb 10, 1996
+ *  linux/drivers/ide/legacy/dtc2278.c		Version 0.02	Feb 10, 1996
  *
  *  Copyright (C) 1996  Linus Torvalds & author (see below)
  */
diff -Nru a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
--- a/drivers/ide/legacy/falconide.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/ide/legacy/falconide.c	Sun Feb 23 22:25:25 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/falconide.c -- Atari Falcon IDE Driver
+ *  linux/drivers/ide/legacy/falconide.c -- Atari Falcon IDE Driver
  *
  *     Created 12 Jul 1997 by Geert Uytterhoeven
  *
@@ -66,7 +66,7 @@
 	hw_regs_t hw;
 	int index;
 
-	ide_setup_ports(&hw, (ide_ioreg_t)ATA_HD_BASE, falconide_offsets,
+	ide_setup_ports(&hw, ATA_HD_BASE, falconide_offsets,
 			0, 0, NULL,
 //			falconide_iops,
 			IRQ_MFP_IDE);
diff -Nru a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c
--- a/drivers/ide/legacy/gayle.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/ide/legacy/gayle.c	Sun Feb 23 22:25:25 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/gayle.c -- Amiga Gayle IDE Driver
+ *  linux/drivers/ide/legacy/gayle.c -- Amiga Gayle IDE Driver
  *
  *     Created 9 Jul 1997 by Geert Uytterhoeven
  *
@@ -122,7 +122,7 @@
 	return;
 
     for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) {
-	ide_ioreg_t base, ctrlport, irqport;
+	unsigned long base, ctrlport, irqport;
 	ide_ack_intr_t *ack_intr;
 	hw_regs_t hw;
 	int index;
@@ -130,11 +130,11 @@
 
 	if (a4000) {
 	    phys_base = GAYLE_BASE_4000;
-	    irqport = (ide_ioreg_t)ZTWO_VADDR(GAYLE_IRQ_4000);
+	    irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000);
 	    ack_intr = gayle_ack_intr_a4000;
 	} else {
 	    phys_base = GAYLE_BASE_1200;
-	    irqport = (ide_ioreg_t)ZTWO_VADDR(GAYLE_IRQ_1200);
+	    irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200);
 	    ack_intr = gayle_ack_intr_a1200;
 	}
 /*
@@ -149,7 +149,7 @@
 	if (!request_mem_region(res_start, res_n, "IDE"))
 	    continue;
 
-	base = (ide_ioreg_t)ZTWO_VADDR(phys_base);
+	base = (unsigned long)ZTWO_VADDR(phys_base);
 	ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0;
 
 	ide_setup_ports(&hw, base, gayle_offsets,
diff -Nru a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
--- a/drivers/ide/legacy/ht6560b.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/ide/legacy/ht6560b.c	Sun Feb 23 22:25:26 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/ht6560b.c		Version 0.07	Feb  1, 2000
+ *  linux/drivers/ide/legacy/ht6560b.c		Version 0.07	Feb  1, 2000
  *
  *  Copyright (C) 1995-2000  Linus Torvalds & author (see below)
  */
diff -Nru a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
--- a/drivers/ide/legacy/ide-cs.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/ide/legacy/ide-cs.c	Sun Feb 23 22:25:25 2003
@@ -225,10 +225,10 @@
 #define CFG_CHECK(fn, args...) \
 if (CardServices(fn, args) != 0) goto next_entry
 
-static int idecs_register(int io, int ctl, int irq)
+static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq)
 {
     hw_regs_t hw;
-    ide_init_hwif_ports(&hw, (ide_ioreg_t)io, (ide_ioreg_t)ctl, NULL);
+    ide_init_hwif_ports(&hw, io, ctl, NULL);
     hw.irq = irq;
     hw.chipset = ide_pci;
     return ide_register_hw(&hw, NULL);
@@ -244,7 +244,8 @@
     config_info_t conf;
     cistpl_cftable_entry_t *cfg = &parse.cftable_entry;
     cistpl_cftable_entry_t dflt = { 0 };
-    int i, pass, last_ret, last_fn, hd, io_base, ctl_base, is_kme = 0;
+    int i, pass, last_ret, last_fn, hd, is_kme = 0;
+    unsigned long io_base, ctl_base;
 
     DEBUG(0, "ide_config(0x%p)\n", link);
     
@@ -367,7 +368,7 @@
     }
     
     if (hd < 0) {
-	printk(KERN_NOTICE "ide-cs: ide_register() at 0x%3x & 0x%3x"
+	printk(KERN_NOTICE "ide-cs: ide_register() at 0x%3lx & 0x%3lx"
 	       ", irq %u failed\n", io_base, ctl_base,
 	       link->irq.AssignedIRQ);
 	goto failed;
diff -Nru a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
--- a/drivers/ide/legacy/macide.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/ide/legacy/macide.c	Sun Feb 23 22:25:21 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/macide.c -- Macintosh IDE Driver
+ *  linux/drivers/ide/legacy/macide.c -- Macintosh IDE Driver
  *
  *     Copyright (C) 1998 by Michael Schmitz
  *
@@ -98,21 +98,21 @@
 
 	switch (macintosh_config->ide_type) {
 	case MAC_IDE_QUADRA:
-		ide_setup_ports(&hw, (ide_ioreg_t)IDE_BASE, macide_offsets,
+		ide_setup_ports(&hw, IDE_BASE, macide_offsets,
 				0, 0, macide_ack_intr,
 //				quadra_ide_iops,
 				IRQ_NUBUS_F);
 		index = ide_register_hw(&hw, NULL);
 		break;
 	case MAC_IDE_PB:
-		ide_setup_ports(&hw, (ide_ioreg_t)IDE_BASE, macide_offsets,
+		ide_setup_ports(&hw, IDE_BASE, macide_offsets,
 				0, 0, macide_ack_intr,
 //				macide_pb_iops,
 				IRQ_NUBUS_C);
 		index = ide_register_hw(&hw, NULL);
 		break;
 	case MAC_IDE_BABOON:
-		ide_setup_ports(&hw, (ide_ioreg_t)BABOON_BASE, macide_offsets,
+		ide_setup_ports(&hw, BABOON_BASE, macide_offsets,
 				0, 0, NULL,
 //				macide_baboon_iops,
 				IRQ_BABOON_1);
diff -Nru a/drivers/ide/legacy/pdc4030.c b/drivers/ide/legacy/pdc4030.c
--- a/drivers/ide/legacy/pdc4030.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/legacy/pdc4030.c	Sun Feb 23 22:25:24 2003
@@ -1,5 +1,5 @@
 /*  -*- linux-c -*-
- *  linux/drivers/ide/pdc4030.c		Version 0.90  May 27, 1999
+ *  linux/drivers/ide/legacy/pdc4030.c		Version 0.90  May 27, 1999
  *
  *  Copyright (C) 1995-2002  Linus Torvalds & authors (see below)
  */
diff -Nru a/drivers/ide/legacy/pdc4030.h b/drivers/ide/legacy/pdc4030.h
--- a/drivers/ide/legacy/pdc4030.h	Sun Feb 23 22:25:25 2003
+++ b/drivers/ide/legacy/pdc4030.h	Sun Feb 23 22:25:25 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/pdc4030.h
+ *  linux/drivers/ide/legacy/pdc4030.h
  *
  *  Copyright (C) 1995-1998  Linus Torvalds & authors
  */
diff -Nru a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
--- a/drivers/ide/legacy/q40ide.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/ide/legacy/q40ide.c	Sun Feb 23 22:25:22 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/q40ide.c -- Q40 I/O port IDE Driver
+ *  linux/drivers/ide/legacy/q40ide.c -- Q40 I/O port IDE Driver
  *
  *     (c) Richard Zidlicky
  *
@@ -82,7 +82,7 @@
     for (i = 0; i < Q40IDE_NUM_HWIFS; i++) {
 	hw_regs_t hw;
 
-	ide_setup_ports(&hw,(ide_ioreg_t) pcide_bases[i], (int *)pcide_offsets, 
+	ide_setup_ports(&hw,(unsigned long) pcide_bases[i], (int *)pcide_offsets, 
 			pcide_bases[i]+0x206, 
 			0, NULL,
 //			pcide_iops,
diff -Nru a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
--- a/drivers/ide/legacy/qd65xx.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/ide/legacy/qd65xx.c	Sun Feb 23 22:25:22 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/qd65xx.c		Version 0.07	Sep 30, 2001
+ *  linux/drivers/ide/legacy/qd65xx.c		Version 0.07	Sep 30, 2001
  *
  *  Copyright (C) 1996-2001  Linus Torvalds & author (see below)
  */
diff -Nru a/drivers/ide/legacy/qd65xx.h b/drivers/ide/legacy/qd65xx.h
--- a/drivers/ide/legacy/qd65xx.h	Sun Feb 23 22:25:27 2003
+++ b/drivers/ide/legacy/qd65xx.h	Sun Feb 23 22:25:27 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/qd65xx.h
+ * linux/drivers/ide/legacy/qd65xx.h
  *
  * Copyright (c) 2000	Linus Torvalds & authors
  */
diff -Nru a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
--- a/drivers/ide/legacy/umc8672.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/ide/legacy/umc8672.c	Sun Feb 23 22:25:22 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/umc8672.c		Version 0.05	Jul 31, 1996
+ *  linux/drivers/ide/legacy/umc8672.c		Version 0.05	Jul 31, 1996
  *
  *  Copyright (C) 1995-1996  Linus Torvalds & author (see below)
  */
diff -Nru a/drivers/ide/pci/adma100.c b/drivers/ide/pci/adma100.c
--- a/drivers/ide/pci/adma100.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/pci/adma100.c	Sun Feb 23 22:25:23 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/adma100.c -- basic support for Pacific Digital ADMA-100 boards
+ *  linux/drivers/ide/pci/adma100.c -- basic support for Pacific Digital ADMA-100 boards
  *
  *     Created 09 Apr 2002 by Mark Lord
  *
diff -Nru a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
--- a/drivers/ide/pci/aec62xx.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/ide/pci/aec62xx.c	Sun Feb 23 22:25:26 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/aec62xx.c		Version 0.11	March 27, 2002
+ * linux/drivers/ide/pci/aec62xx.c		Version 0.11	March 27, 2002
  *
  * Copyright (C) 1999-2002	Andre Hedrick <andre@linux-ide.org>
  *
@@ -409,7 +409,7 @@
 
 	if (dev->resource[PCI_ROM_RESOURCE].start) {
 		pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
-		printk("%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
+		printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
 	}
 
 #if defined(DISPLAY_AEC62XX_TIMINGS) && defined(CONFIG_PROC_FS)
@@ -559,5 +559,3 @@
 MODULE_AUTHOR("Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for ARTOP AEC62xx IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
--- a/drivers/ide/pci/alim15x3.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/pci/alim15x3.c	Sun Feb 23 22:25:23 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/alim15x3.c		Version 0.15	2002/08/19
+ * linux/drivers/ide/pci/alim15x3.c		Version 0.16	2003/01/02
  *
  *  Copyright (C) 1998-2000 Michel Aubry, Maintainer
  *  Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer
@@ -19,6 +19,10 @@
  *	Don't use LBA48 mode on ALi <= 0xC4
  *	Don't poke 0x79 with a non ALi northbridge
  *	Don't flip undefined bits on newer chipsets (fix Fujitsu laptop hang)
+ *
+ *  Documentation
+ *	Chipset documentation available under NDA only
+ *
  */
 
 #include <linux/config.h>
@@ -94,7 +98,7 @@
  
 static int ali_get_info (char *buffer, char **addr, off_t offset, int count)
 {
-	u32 bibma;
+	unsigned long bibma;
 	u8 reg53h, reg5xh, reg5yh, reg5xh1, reg5yh1, c0, c1, rev, tmp;
 	char *q, *p = buffer;
 
@@ -106,14 +110,15 @@
 		fifo[3]  = "   ???  ";
 
 	/* first fetch bibma: */
-	pci_read_config_dword(bmide_dev, 0x20, &bibma);
-	bibma = (bibma & 0xfff0) ;
+	
+	bibma = pci_resource_start(bmide_dev, 4);
+
 	/*
 	 * at that point bibma+0x2 et bibma+0xa are byte
 	 * registers to investigate:
 	 */
-	c0 = inb((unsigned short)bibma + 0x02);
-	c1 = inb((unsigned short)bibma + 0x0a);
+	c0 = inb(bibma + 0x02);
+	c1 = inb(bibma + 0x0a);
 
 	p += sprintf(p,
 		"\n                                Ali M15x3 Chipset.\n");
@@ -295,6 +300,7 @@
 	int port = hwif->channel ? 0x5c : 0x58;
 	int portFIFO = hwif->channel ? 0x55 : 0x54;
 	u8 cd_dma_fifo = 0;
+	int unit = drive->select.b.unit & 1;
 
 	pio = ide_get_best_pio_mode(drive, pio, 5, &d);
 	s_time = ide_pio_timings[pio].setup_time;
@@ -323,13 +329,13 @@
 	 */
 	pci_read_config_byte(dev, portFIFO, &cd_dma_fifo);
 	if (drive->media==ide_disk) {
-		if (hwif->channel) {
+		if (unit) {
 			pci_write_config_byte(dev, portFIFO, (cd_dma_fifo & 0x0F) | 0x50);
 		} else {
 			pci_write_config_byte(dev, portFIFO, (cd_dma_fifo & 0xF0) | 0x05);
 		}
 	} else {
-		if (hwif->channel) {
+		if (unit) {
 			pci_write_config_byte(dev, portFIFO, cd_dma_fifo & 0x0F);
 		} else {
 			pci_write_config_byte(dev, portFIFO, cd_dma_fifo & 0xF0);
@@ -779,9 +785,10 @@
 static void __init init_hwif_ali15x3 (ide_hwif_t *hwif)
 {
 	u8 ideic, inmir;
-	u8 irq_routing_table[] = { -1,  9, 3, 10, 4,  5, 7,  6,
+	s8 irq_routing_table[] = { -1,  9, 3, 10, 4,  5, 7,  6,
 				      1, 11, 0, 12, 0, 14, 0, 15 };
-
+	int irq = -1;
+	
 	hwif->irq = hwif->channel ? 15 : 14;
 
 	if (isa_dev) {
@@ -801,15 +808,17 @@
 			 */
 			pci_read_config_byte(isa_dev, 0x44, &inmir);
 			inmir = inmir & 0x0f;
-			hwif->irq = irq_routing_table[inmir];
+			irq = irq_routing_table[inmir];
 		} else if (hwif->channel && !(ideic & 0x01)) {
 			/*
 			 * get SIRQ2 routing table
 			 */
 			pci_read_config_byte(isa_dev, 0x75, &inmir);
 			inmir = inmir & 0x0f;
-			hwif->irq = irq_routing_table[inmir];
+			irq = irq_routing_table[inmir];
 		}
+		if(irq >= 0)
+			hwif->irq = irq;
 	}
 
 	init_hwif_common_ali15x3(hwif);
@@ -850,10 +859,8 @@
 	ide_pci_device_t *d = &ali15x3_chipsets[id->driver_data];
 	
 	if(pci_find_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_IGP, NULL))
-	{
-		printk(KERN_ERR "Warning: ATI Radeon IGP Northbridge is not supported by Linux\n");
-		return 1;
-	}
+		printk(KERN_ERR "Warning: ATI Radeon IGP Northbridge is not yet fully tested.\n");
+
 #if defined(CONFIG_SPARC64)
 	d->init_hwif = init_hwif_common_ali15x3;
 #endif /* CONFIG_SPARC64 */
@@ -890,5 +897,3 @@
 MODULE_AUTHOR("Michael Aubry, Andrzej Krzysztofowicz, CJ, Andre Hedrick, Alan Cox");
 MODULE_DESCRIPTION("PCI driver module for ALi 15x3 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
--- a/drivers/ide/pci/amd74xx.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/ide/pci/amd74xx.c	Sun Feb 23 22:25:27 2003
@@ -472,5 +472,3 @@
 MODULE_AUTHOR("Vojtech Pavlik");
 MODULE_DESCRIPTION("AMD PCI IDE driver");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
--- a/drivers/ide/pci/cmd640.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/ide/pci/cmd640.c	Sun Feb 23 22:25:26 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/cmd640.c		Version 1.02  Sep 01, 1996
+ *  linux/drivers/ide/pci/cmd640.c		Version 1.02  Sep 01, 1996
  *
  *  Copyright (C) 1995-1996  Linus Torvalds & authors (see below)
  */
diff -Nru a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
--- a/drivers/ide/pci/cmd64x.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/ide/pci/cmd64x.c	Sun Feb 23 22:25:26 2003
@@ -1,6 +1,6 @@
 /* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16
  *
- * linux/drivers/ide/cmd64x.c		Version 1.30	Sept 10, 2002
+ * linux/drivers/ide/pci/cmd64x.c		Version 1.30	Sept 10, 2002
  *
  * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines.
  *           Note, this driver is not used at all on other systems because
@@ -596,7 +596,7 @@
 #ifdef __i386__
 	if (dev->resource[PCI_ROM_RESOURCE].start) {
 		pci_write_config_byte(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
-		printk("%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
+		printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
 	}
 #endif
 
@@ -604,7 +604,7 @@
 		case PCI_DEVICE_ID_CMD_643:
 			break;
 		case PCI_DEVICE_ID_CMD_646:
-			printk("%s: chipset revision 0x%02X, ", name, class_rev);
+			printk(KERN_INFO "%s: chipset revision 0x%02X, ", name, class_rev);
 			switch(class_rev) {
 				case 0x07:
 				case 0x05:
@@ -793,6 +793,3 @@
 MODULE_AUTHOR("Eddie Dost, David Miller, Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for CMD64x IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
-
diff -Nru a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
--- a/drivers/ide/pci/cs5520.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/ide/pci/cs5520.c	Sun Feb 23 22:25:21 2003
@@ -320,6 +320,3 @@
 MODULE_AUTHOR("Alan Cox");
 MODULE_DESCRIPTION("PCI driver module for Cyrix 5510/5520 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
-
diff -Nru a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
--- a/drivers/ide/pci/cs5530.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/pci/cs5530.c	Sun Feb 23 22:25:23 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/cs5530.c		Version 0.7	Sept 10, 2002
+ * linux/drivers/ide/pci/cs5530.c		Version 0.7	Sept 10, 2002
  *
  * Copyright (C) 2000			Andre Hedrick <andre@linux-ide.org>
  * Ditto of GNU General Public License.
@@ -9,6 +9,9 @@
  *
  * Development of this chipset driver was funded
  * by the nice folks at National Semiconductor.
+ *
+ * Documentation:
+ *	CS5530 documentation available from National Semiconductor.
  */
 
 #include <linux/config.h>
@@ -456,5 +459,3 @@
 MODULE_AUTHOR("Mark Lord");
 MODULE_DESCRIPTION("PCI driver module for Cyrix/NS 5530 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
--- a/drivers/ide/pci/cy82c693.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/ide/pci/cy82c693.c	Sun Feb 23 22:25:22 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/cy82c693.c		Version 0.40	Sep. 10, 2002
+ * linux/drivers/ide/pci/cy82c693.c		Version 0.40	Sep. 10, 2002
  *
  *  Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer
  *  Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrater
@@ -335,7 +335,7 @@
 /*
  * this function is called during init and is used to setup the cy82c693 chip
  */
-unsigned int __init init_chipset_cy82c693(struct pci_dev *dev, const char *name)
+static unsigned int __init init_chipset_cy82c693(struct pci_dev *dev, const char *name)
 {
 	if (PCI_FUNC(dev->devfn) != 1)
 		return 0;
@@ -387,7 +387,7 @@
 /*
  * the init function - called for each ide channel once
  */
-void __init init_hwif_cy82c693(ide_hwif_t *hwif)
+static void __init init_hwif_cy82c693(ide_hwif_t *hwif)
 {
 	hwif->autodma = 0;
 
@@ -466,5 +466,3 @@
 MODULE_AUTHOR("Andreas Krebs, Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for the Cypress CY82C693 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/cy82c693.h b/drivers/ide/pci/cy82c693.h
--- a/drivers/ide/pci/cy82c693.h	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/pci/cy82c693.h	Sun Feb 23 22:25:23 2003
@@ -64,9 +64,9 @@
 	u8	time_8;		/* clocks for 8bit (0xF0=Active/data, 0x0F=Recovery) */
 } pio_clocks_t;
 
-extern unsigned int init_chipset_cy82c693(struct pci_dev *, const char *);
-extern void init_hwif_cy82c693(ide_hwif_t *);
-extern void init_iops_cy82c693(ide_hwif_t *);
+static unsigned int init_chipset_cy82c693(struct pci_dev *, const char *);
+static void init_hwif_cy82c693(ide_hwif_t *);
+static void init_iops_cy82c693(ide_hwif_t *);
 
 static ide_pci_device_t cy82c693_chipsets[] __devinitdata = {
 	{	/* 0 */
diff -Nru a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
--- a/drivers/ide/pci/generic.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/pci/generic.c	Sun Feb 23 22:25:24 2003
@@ -1,10 +1,26 @@
 /*
- *  linux/drivers/ide/generic.c		Version 0.10	Sept 11, 2002
+ *  linux/drivers/ide/pci/generic.c	Version 0.11	December 30, 2002
  *
  *  Copyright (C) 2001-2002	Andre Hedrick <andre@linux-ide.org>
+ *  Portions (C) Copyright 2002  Red Hat Inc <alan@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * For the avoidance of doubt the "preferred form" of this code is one which
+ * is in an open non patent encumbered format. Where cryptographic key signing
+ * forms part of the process of creating an executable the information
+ * including keys needed to generate an equivalently functional executable
+ * are deemed to be part of the source code.
  */
 
-
 #undef REALLY_SLOW_IO		/* most systems can safely undef this */
 
 #include <linux/config.h> /* for CONFIG_BLK_DEV_IDEPCI */
@@ -89,6 +105,7 @@
 static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
 	ide_pci_device_t *d = &generic_chipsets[id->driver_data];
+	u16 command;
 
 	if (dev->device != d->device)
 		BUG();
@@ -102,6 +119,12 @@
 	    (!(PCI_FUNC(dev->devfn) & 1)))
 		return 1;
 
+	pci_read_config_word(dev, PCI_COMMAND, &command);
+	if(!(command & PCI_COMMAND_IO))
+	{
+		printk(KERN_INFO "Skipping disabled %s IDE controller.\n", d->name);
+		return 1; 
+	}
 	ide_setup_pci_device(dev, d);
 	MOD_INC_USE_COUNT;
 	return 0;
@@ -142,5 +165,3 @@
 MODULE_AUTHOR("Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for generic PCI IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
--- a/drivers/ide/pci/hpt34x.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/pci/hpt34x.c	Sun Feb 23 22:25:23 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/hpt34x.c		Version 0.40	Sept 10, 2002
+ * linux/drivers/ide/pci/hpt34x.c		Version 0.40	Sept 10, 2002
  *
  * Copyright (C) 1998-2000	Andre Hedrick <andre@linux-ide.org>
  * May be copied or modified under the terms of the GNU General Public License
@@ -362,5 +362,3 @@
 MODULE_AUTHOR("Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for Highpoint 34x IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
--- a/drivers/ide/pci/hpt366.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/pci/hpt366.c	Sun Feb 23 22:25:24 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/hpt366.c		Version 0.34	Sept 17, 2002
+ * linux/drivers/ide/pci/hpt366.c		Version 0.34	Sept 17, 2002
  *
  * Copyright (C) 1999-2002		Andre Hedrick <andre@linux-ide.org>
  * Portions Copyright (C) 2001	        Sun Microsystems, Inc.
@@ -807,7 +807,7 @@
 	} else if (freq < 0xc8) {
 		pll = F_LOW_PCI_50;
 		if (hpt_minimum_revision(dev,8))
-			return -EOPNOTSUPP;
+			pci_set_drvdata(dev, NULL);
 		else if (hpt_minimum_revision(dev,5))
 			pci_set_drvdata(dev, (void *) fifty_base_hpt372);
 		else if (hpt_minimum_revision(dev,4))
@@ -820,7 +820,7 @@
 		if (hpt_minimum_revision(dev,8))
 		{
 			printk(KERN_ERR "HPT37x: 66MHz timings are not supported.\n");
-			return -EOPNOTSUPP;
+			pci_set_drvdata(dev, NULL);
 		}
 		else if (hpt_minimum_revision(dev,5))
 			pci_set_drvdata(dev, (void *) sixty_six_base_hpt372);
@@ -923,7 +923,7 @@
 	if (!pci_get_drvdata(dev))
 	{
 		printk(KERN_ERR "hpt366: unknown bus timing.\n");
-		return -EOPNOTSUPP;
+		pci_set_drvdata(dev, NULL);
 	}
 	return 0;
 }
@@ -1061,6 +1061,12 @@
 
 	if (!dmabase)
 		return;
+		
+	if(pci_get_drvdata(hwif->pci_dev) == NULL)
+	{
+		printk(KERN_WARNING "hpt: no known IDE timings, disabling DMA.\n");
+		return;
+	}
 
 	dma_old = hwif->INB(dmabase+2);
 
@@ -1215,5 +1221,3 @@
 MODULE_AUTHOR("Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for Highpoint HPT366 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/it8172.c b/drivers/ide/pci/it8172.c
--- a/drivers/ide/pci/it8172.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/ide/pci/it8172.c	Sun Feb 23 22:25:25 2003
@@ -330,5 +330,3 @@
 MODULE_AUTHOR("SteveL@mvista.com");
 MODULE_DESCRIPTION("PCI driver module for ITE 8172 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
--- a/drivers/ide/pci/ns87415.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/pci/ns87415.c	Sun Feb 23 22:25:24 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/ns87415.c		Version 2.00  Sep. 10, 2002
+ * linux/drivers/ide/pci/ns87415.c		Version 2.00  Sep. 10, 2002
  *
  * Copyright (C) 1997-1998	Mark Lord <mlord@pobox.com>
  * Copyright (C) 1998		Eddie C. Dost <ecd@skynet.be>
@@ -263,5 +263,3 @@
 MODULE_AUTHOR("Mark Lord, Eddie Dost, Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for NS87415 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
--- a/drivers/ide/pci/opti621.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/pci/opti621.c	Sun Feb 23 22:25:23 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/opti621.c		Version 0.7	Sept 10, 2002
+ *  linux/drivers/ide/pci/opti621.c		Version 0.7	Sept 10, 2002
  *
  *  Copyright (C) 1996-1998  Linus Torvalds & authors (see below)
  */
@@ -399,5 +399,3 @@
 MODULE_AUTHOR("Jaromir Koutek, Jan Harkes, Mark Lord");
 MODULE_DESCRIPTION("PCI driver module for Opti621 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
--- a/drivers/ide/pci/pdc202xx_new.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/ide/pci/pdc202xx_new.c	Sun Feb 23 22:25:25 2003
@@ -224,7 +224,7 @@
 	decode_registers(REG_D, DP);
 #endif /* PDC202XX_DECODE_REGISTER_INFO */
 #if PDC202XX_DEBUG_DRIVE_INFO
-	printk("%s: %s drive%d 0x%08x ",
+	printk(KERN_DEBUG "%s: %s drive%d 0x%08x ",
 		drive->name, ide_xfer_verbose(speed),
 		drive->dn, drive_conf);
 		pci_read_config_dword(dev, drive_pci, &drive_conf);
@@ -321,7 +321,7 @@
 		case PCI_DEVICE_ID_PROMISE_20268:
 			cable = pdcnew_new_cable_detect(hwif);
 #if PDC202_DEBUG_CABLE
-			printk("%s: %s-pin cable, %s-pin cable, %d\n",
+			printk(KERN_DEBUG "%s: %s-pin cable, %s-pin cable, %d\n",
 				hwif->name, hwif->udma_four ? "80" : "40",
 				cable ? "40" : "80", cable);
 #endif /* PDC202_DEBUG_CABLE */
@@ -347,15 +347,15 @@
 
 	if ((ultra_66) && (cable)) {
 #ifdef DEBUG
-		printk("ULTRA 66/100/133: %s channel of Ultra 66/100/133 "
+		printk(KERN_DEBUG "ULTRA 66/100/133: %s channel of Ultra 66/100/133 "
 			"requires an 80-pin cable for Ultra66 operation.\n",
 			hwif->channel ? "Secondary" : "Primary");
-		printk("         Switching to Ultra33 mode.\n");
+		printk(KERN_DEBUG "         Switching to Ultra33 mode.\n");
 #endif /* DEBUG */
 		/* Primary   : zero out second bit */
 		/* Secondary : zero out fourth bit */
-		printk("Warning: %s channel requires an 80-pin cable for operation.\n", hwif->channel ? "Secondary":"Primary");
-		printk("%s reduced to Ultra33 mode.\n", drive->name);
+		printk(KERN_WARNING "Warning: %s channel requires an 80-pin cable for operation.\n", hwif->channel ? "Secondary":"Primary");
+		printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name);
 	}
 
 	if (drive->media != ide_disk)
@@ -444,7 +444,7 @@
 	/*
 	 * Deleted this because it is redundant from the caller.
 	 */
-	printk("PDC202XX: %s channel reset.\n",
+	printk(KERN_WARNING "PDC202XX: %s channel reset.\n",
 		HWIF(drive)->channel ? "Secondary" : "Primary");
 }
 
@@ -459,7 +459,7 @@
 	hwif->OUTB((udma_speed_flag & ~0x10), (high_16|0x001f));
 	mdelay(2000);	/* 2 seconds ?! */
 
-	printk("PDC202XX: %s channel reset.\n",
+	printk(KERN_WARNING "PDC202XX: %s channel reset.\n",
 		hwif->channel ? "Secondary" : "Primary");
 }
 
@@ -513,7 +513,7 @@
 	if (dev->resource[PCI_ROM_RESOURCE].start) {
 		pci_write_config_dword(dev, PCI_ROM_ADDRESS,
 			dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
-		printk("%s: ROM enabled at 0x%08lx\n",
+		printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n",
 			name, dev->resource[PCI_ROM_RESOURCE].start);
 	}
 
@@ -555,7 +555,7 @@
 		hwif->autodma = 1;
 	hwif->drives[0].autodma = hwif->drives[1].autodma = hwif->autodma;
 #if PDC202_DEBUG_CABLE
-	printk("%s: %s-pin cable\n",
+	printk(KERN_DEBUG "%s: %s-pin cable\n",
 		hwif->name, hwif->udma_four ? "80" : "40");
 #endif /* PDC202_DEBUG_CABLE */
 }
@@ -672,5 +672,3 @@
 MODULE_AUTHOR("Andre Hedrick, Frank Tiernan");
 MODULE_DESCRIPTION("PCI driver module for Promise PDC20268 and higher");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
--- a/drivers/ide/pci/pdc202xx_old.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/ide/pci/pdc202xx_old.c	Sun Feb 23 22:25:26 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/pdc202xx.c	Version 0.36	Sept 11, 2002
+ *  linux/drivers/ide/pci/pdc202xx_old.c	Version 0.36	Sept 11, 2002
  *
  *  Copyright (C) 1998-2002		Andre Hedrick <andre@linux-ide.org>
  *
@@ -323,7 +323,7 @@
 	decode_registers(REG_D, DP);
 #endif /* PDC202XX_DECODE_REGISTER_INFO */
 #if PDC202XX_DEBUG_DRIVE_INFO
-	printk("%s: %s drive%d 0x%08x ",
+	printk(KERN_DEBUG "%s: %s drive%d 0x%08x ",
 		drive->name, ide_xfer_verbose(speed),
 		drive->dn, drive_conf);
 		pci_read_config_dword(dev, drive_pci, &drive_conf);
@@ -379,7 +379,7 @@
 		case PCI_DEVICE_ID_PROMISE_20262:
 			cable = pdc202xx_old_cable_detect(hwif);
 #if PDC202_DEBUG_CABLE
-			printk("%s: %s-pin cable, %s-pin cable, %d\n",
+			printk(KERN_DEBUG "%s: %s-pin cable, %s-pin cable, %d\n",
 				hwif->name, hwif->udma_four ? "80" : "40",
 				cable ? "40" : "80", cable);
 #endif /* PDC202_DEBUG_CABLE */
@@ -408,16 +408,16 @@
 
 	if ((ultra_66) && (cable)) {
 #ifdef DEBUG
-		printk("ULTRA 66/100/133: %s channel of Ultra 66/100/133 "
+		printk(KERN_DEBUG "ULTRA 66/100/133: %s channel of Ultra 66/100/133 "
 			"requires an 80-pin cable for Ultra66 operation.\n",
 			hwif->channel ? "Secondary" : "Primary");
-		printk("         Switching to Ultra33 mode.\n");
+		printk(KERN_DEBUG "         Switching to Ultra33 mode.\n");
 #endif /* DEBUG */
 		/* Primary   : zero out second bit */
 		/* Secondary : zero out fourth bit */
 		hwif->OUTB(CLKSPD & ~mask, (hwif->dma_master + 0x11));
-		printk("Warning: %s channel requires an 80-pin cable for operation.\n", hwif->channel ? "Secondary":"Primary");
-		printk("%s reduced to Ultra33 mode.\n", drive->name);
+		printk(KERN_WARNING "Warning: %s channel requires an 80-pin cable for operation.\n", hwif->channel ? "Secondary":"Primary");
+		printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name);
 	} else {
 		if (ultra_66) {
 			/*
@@ -620,7 +620,7 @@
 	hwif->OUTB((udma_speed_flag & ~0x10), (high_16|0x001f));
 	mdelay(2000);	/* 2 seconds ?! */
 
-	printk("PDC202XX: %s channel reset.\n",
+	printk(KERN_WARNING "PDC202XX: %s channel reset.\n",
 		hwif->channel ? "Secondary" : "Primary");
 }
 
@@ -699,7 +699,7 @@
 	if (dev->resource[PCI_ROM_RESOURCE].start) {
 		pci_write_config_dword(dev, PCI_ROM_ADDRESS,
 			dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
-		printk("%s: ROM enabled at 0x%08lx\n",
+		printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n",
 			name, dev->resource[PCI_ROM_RESOURCE].start);
 	}
 
@@ -780,7 +780,7 @@
 		hwif->autodma = 1;
 	hwif->drives[0].autodma = hwif->drives[1].autodma = hwif->autodma;
 #if PDC202_DEBUG_CABLE
-	printk("%s: %s-pin cable\n",
+	printk(KERN_DEBUG "%s: %s-pin cable\n",
 		hwif->name, hwif->udma_four ? "80" : "40");
 #endif /* PDC202_DEBUG_CABLE */	
 }
@@ -797,7 +797,7 @@
 	udma_speed_flag	= hwif->INB((dmabase|0x1f));
 	primary_mode	= hwif->INB((dmabase|0x1a));
 	secondary_mode	= hwif->INB((dmabase|0x1b));
-	printk("%s: (U)DMA Burst Bit %sABLED " \
+	printk(KERN_INFO "%s: (U)DMA Burst Bit %sABLED " \
 		"Primary %s Mode " \
 		"Secondary %s Mode.\n", hwif->cds->name,
 		(udma_speed_flag & 1) ? "EN" : "DIS",
@@ -806,7 +806,7 @@
 
 #ifdef CONFIG_PDC202XX_BURST
 	if (!(udma_speed_flag & 1)) {
-		printk("%s: FORCING BURST BIT 0x%02x->0x%02x ",
+		printk(KERN_INFO "%s: FORCING BURST BIT 0x%02x->0x%02x ",
 			hwif->cds->name, udma_speed_flag,
 			(udma_speed_flag|1));
 		hwif->OUTB(udma_speed_flag|1,(dmabase|0x1f));
@@ -816,7 +816,7 @@
 #endif /* CONFIG_PDC202XX_BURST */
 #ifdef CONFIG_PDC202XX_MASTER
 	if (!(primary_mode & 1)) {
-		printk("%s: FORCING PRIMARY MODE BIT "
+		printk(KERN_INFO "%s: FORCING PRIMARY MODE BIT "
 			"0x%02x -> 0x%02x ", hwif->cds->name,
 			primary_mode, (primary_mode|1));
 		hwif->OUTB(primary_mode|1, (dmabase|0x1a));
@@ -825,7 +825,7 @@
 	}
 
 	if (!(secondary_mode & 1)) {
-		printk("%s: FORCING SECONDARY MODE BIT "
+		printk(KERN_INFO "%s: FORCING SECONDARY MODE BIT "
 			"0x%02x -> 0x%02x ", hwif->cds->name,
 			secondary_mode, (secondary_mode|1));
 		hwif->OUTB(secondary_mode|1, (dmabase|0x1b));
@@ -850,7 +850,7 @@
 		if (irq != irq2) {
 			pci_write_config_byte(dev,
 				(PCI_INTERRUPT_LINE)|0x80, irq);     /* 0xbc */
-			printk("%s: pci-config space interrupt "
+			printk(KERN_INFO "%s: pci-config space interrupt "
 				"mirror fixed.\n", d->name);
 		}
 	}
@@ -955,5 +955,3 @@
 MODULE_AUTHOR("Andre Hedrick, Frank Tiernan");
 MODULE_DESCRIPTION("PCI driver module for older Promise IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/pdcadma.c b/drivers/ide/pci/pdcadma.c
--- a/drivers/ide/pci/pdcadma.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/ide/pci/pdcadma.c	Sun Feb 23 22:25:25 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/pdcadma.c		Version 0.05	Sept 10, 2002
+ * linux/drivers/ide/pci/pdcadma.c		Version 0.05	Sept 10, 2002
  *
  * Copyright (C) 1999-2000		Andre Hedrick <andre@linux-ide.org>
  * May be copied or modified under the terms of the GNU General Public License
@@ -161,5 +161,3 @@
 MODULE_AUTHOR("Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for PDCADMA IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
--- a/drivers/ide/pci/piix.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/ide/pci/piix.c	Sun Feb 23 22:25:21 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/piix.c		Version 0.42	January 11, 2003
+ *  linux/drivers/ide/pci/piix.c	Version 0.42	January 11, 2003
  *
  *  Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
  *  Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
@@ -821,5 +821,3 @@
 MODULE_AUTHOR("Andre Hedrick, Andrzej Krzysztofowicz");
 MODULE_DESCRIPTION("PCI driver module for Intel PIIX IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c
--- a/drivers/ide/pci/rz1000.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/pci/rz1000.c	Sun Feb 23 22:25:23 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/rz1000.c		Version 0.05	December 8, 1997
+ *  linux/drivers/ide/pci/rz1000.c	Version 0.06	January 12, 2003
  *
  *  Copyright (C) 1995-1998  Linus Torvalds & author (see below)
  */
@@ -43,13 +43,13 @@
 	hwif->chipset = ide_rz1000;
 	if (!pci_read_config_word (dev, 0x40, &reg) &&
 	    !pci_write_config_word(dev, 0x40, reg & 0xdfff)) {
-		printk("%s: disabled chipset read-ahead "
+		printk(KERN_INFO "%s: disabled chipset read-ahead "
 			"(buggy RZ1000/RZ1001)\n", hwif->name);
 	} else {
 		hwif->serialized = 1;
 		hwif->drives[0].no_unmask = 1;
 		hwif->drives[1].no_unmask = 1;
-		printk("%s: serialized, disabled unmasking "
+		printk(KERN_INFO "%s: serialized, disabled unmasking "
 			"(buggy RZ1000/RZ1001)\n", hwif->name);
 	}
 }
@@ -94,6 +94,4 @@
 MODULE_AUTHOR("Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for RZ1000 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
 
diff -Nru a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
--- a/drivers/ide/pci/sc1200.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/ide/pci/sc1200.c	Sun Feb 23 22:25:25 2003
@@ -1,11 +1,14 @@
 /*
- * linux/drivers/ide/sc1200.c		Version 0.9	24-Oct-2002
+ * linux/drivers/ide/pci/sc1200.c		Version 0.91	28-Jan-2003
  *
  * Copyright (C) 2000-2002		Mark Lord <mlord@pobox.com>
  * May be copied or modified under the terms of the GNU General Public License
  *
  * Development of this chipset driver was funded
  * by the nice folks at National Semiconductor.
+ *
+ * Documentation:
+ *	Available from National Semiconductor
  */
 
 #include <linux/config.h>
@@ -587,5 +590,3 @@
 MODULE_AUTHOR("Mark Lord");
 MODULE_DESCRIPTION("PCI driver module for NS SC1200 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
--- a/drivers/ide/pci/serverworks.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/ide/pci/serverworks.c	Sun Feb 23 22:25:21 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/serverworks.c		Version 0.7	10 Sept 2002
+ * linux/drivers/ide/pci/serverworks.c		Version 0.7	10 Sept 2002
  *
  * Copyright (C) 1998-2000 Michel Aubry
  * Copyright (C) 1998-2000 Andrzej Krzysztofowicz
@@ -21,6 +21,9 @@
  *
  *   CSB6: `Champion South Bridge' IDE Interface (optional: third channel)
  *
+ * Documentation:
+ *	Available under NDA only. Errata info very hard to get.
+ *
  */
 
 #include <linux/config.h>
@@ -575,7 +578,7 @@
 			 * This is a device pin issue on CSB6.
 			 * Since there will be a future raid mode,
 			 * early versions of the chipset require the
-			 * interrupt pin to be set, and it is a compatablity
+			 * interrupt pin to be set, and it is a compatiblity
 			 * mode issue.
 			 */
 			dev->irq = 0;
@@ -828,5 +831,3 @@
 MODULE_AUTHOR("Michael Aubry. Andrzej Krzysztofowicz, Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for Serverworks OSB4/CSB5/CSB6 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
--- a/drivers/ide/pci/siimage.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/pci/siimage.c	Sun Feb 23 22:25:23 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/siimage.c		Version 1.01	Sept 11, 2002
+ * linux/drivers/ide/pci/siimage.c		Version 1.02	Jan 30, 2003
  *
  * Copyright (C) 2001-2002	Andre Hedrick <andre@linux-ide.org>
  */
@@ -31,15 +31,15 @@
 {
 	char *p		= buf;
 	u8 mmio		= (pci_get_drvdata(dev) != NULL) ? 1 : 0;
-	u32 bmdma	= (mmio) ? ((u32) pci_get_drvdata(dev)) :
+	unsigned long bmdma	= (mmio) ? ((unsigned long) pci_get_drvdata(dev)) :
 				    (pci_resource_start(dev, 4));
 
 	p += sprintf(p, "\nController: %d\n", index);
 	p += sprintf(p, "SiI%x Chipset.\n", dev->device);
 	if (mmio)
-		p += sprintf(p, "MMIO Base 0x%08x\n", bmdma);
-	p += sprintf(p, "%s-DMA Base 0x%08x\n", (mmio)?"MMIO":"BM", bmdma);
-	p += sprintf(p, "%s-DMA Base 0x%08x\n", (mmio)?"MMIO":"BM", bmdma+8);
+		p += sprintf(p, "MMIO Base 0x%lx\n", bmdma);
+	p += sprintf(p, "%s-DMA Base 0x%lx\n", (mmio)?"MMIO":"BM", bmdma);
+	p += sprintf(p, "%s-DMA Base 0x%lx\n", (mmio)?"MMIO":"BM", bmdma+8);
 
 	p += sprintf(p, "--------------- Primary Channel "
 			"---------------- Secondary Channel "
@@ -248,9 +248,9 @@
 {
 	u8 speed	= ide_dma_speed(drive, siimage_ratemask(drive));
 
-	config_chipset_for_pio(drive, (!(speed)));
+	config_chipset_for_pio(drive, !speed);
 
-	if ((!(speed)))
+	if (!speed)
 		return 0;
 
 	if (ide_set_xfer_rate(drive, speed))
@@ -267,7 +267,7 @@
 	ide_hwif_t *hwif	= HWIF(drive);
 	struct hd_driveid *id	= drive->id;
 
-	if ((id != NULL) && ((id->capability & 1) != 0) && drive->autodma) {
+	if (id != NULL && (id->capability & 1) != 0 && drive->autodma) {
 		if (!(hwif->atapi_dma))
 			goto fast_ata_pio;
 		/* Consult the list of known "bad" drives */
@@ -317,10 +317,9 @@
 		return 1;
 
 	/* return 1 if Device INTR asserted */
-	if ((pci_read_config_byte(hwif->pci_dev, SELREG(1), &dma_altstat)),
-	    ((dma_altstat & 8) == 8))
+	pci_read_config_byte(hwif->pci_dev, SELREG(1), &dma_altstat);
+	if (dma_altstat & 8)
 		return 0;	//return 1;
-
 	return 0;
 }
 
@@ -355,7 +354,7 @@
 			hwif->OUTL(sata_error, SATA_ERROR_REG);
 			watchdog = (sata_error & 0x00680000) ? 1 : 0;
 #if 1
-			printk("%s: sata_error = 0x%08x, "
+			printk(KERN_WARNING "%s: sata_error = 0x%08x, "
 				"watchdog = %d, %s\n",
 				drive->name, sata_error, watchdog,
 				__FUNCTION__);
@@ -426,7 +425,7 @@
 		ide_hwif_t *hwif	= HWIF(drive);
 
 		if ((hwif->INL(SATA_STATUS_REG) & 0x03) != 0x03) {
-			printk("%s: reset phy dead, status=0x%08x\n",
+			printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n",
 				hwif->name, hwif->INL(SATA_STATUS_REG));
 			HWGROUP(drive)->poll_timeout = 0;
 #if 0
@@ -475,10 +474,10 @@
 
 	if (SATA_STATUS_REG) {
 		u32 sata_stat = hwif->INL(SATA_STATUS_REG);
-		printk("%s: reset phy, status=0x%08x, %s\n",
+		printk(KERN_WARNING "%s: reset phy, status=0x%08x, %s\n",
 			hwif->name, sata_stat, __FUNCTION__);
 		if (!(sata_stat)) {
-			printk("%s: reset phy dead, status=0x%08x\n",
+			printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n",
 				hwif->name, sata_stat);
 			drive->failures++;
 		}
@@ -491,7 +490,7 @@
 	if (dev->device == PCI_DEVICE_ID_SII_3112)
 		goto sata_skip;
 
-	printk("%s: BASE CLOCK ", name);
+	printk(KERN_INFO "%s: BASE CLOCK ", name);
 	clocking &= ~0x0C;
 	switch(clocking) {
 		case 0x03: printk("DISABLED !\n"); break;
@@ -514,13 +513,12 @@
 #endif /* DISPLAY_SIIMAGE_TIMINGS && CONFIG_PROC_FS */
 }
 
-#ifdef CONFIG_TRY_MMIO_SIIMAGE
 static unsigned int setup_mmio_siimage (struct pci_dev *dev, const char *name)
 {
-	u32 bar5	= pci_resource_start(dev, 5);
-	u32 end5	= pci_resource_end(dev, 5);
+	unsigned long bar5	= pci_resource_start(dev, 5);
+	unsigned long end5	= pci_resource_end(dev, 5);
 	u8 tmpbyte	= 0;
-	u32 addr;
+	unsigned long addr;
 	void *ioaddr;
 
 	ioaddr = ioremap_nocache(bar5, (end5 - bar5));
@@ -529,82 +527,77 @@
 		return 0;
 
 	pci_set_master(dev);
-	addr = (u32) ioaddr;
-	pci_set_drvdata(dev, (void *) addr);
+	pci_set_drvdata(dev, ioaddr);
+	addr = (unsigned long) ioaddr;
 
 	if (dev->device == PCI_DEVICE_ID_SII_3112) {
-		sii_outl(0, DEVADDR(0x148));
-		sii_outl(0, DEVADDR(0x1C8));
+		writel(0, DEVADDR(0x148));
+		writel(0, DEVADDR(0x1C8));
 	}
 
-	sii_outb(0, DEVADDR(0xB4));
-	sii_outb(0, DEVADDR(0xF4));
-	tmpbyte = sii_inb(DEVADDR(0x4A));
+	writeb(0, DEVADDR(0xB4));
+	writeb(0, DEVADDR(0xF4));
+	tmpbyte = readb(DEVADDR(0x4A));
 
 	switch(tmpbyte) {
 		case 0x01:
-			sii_outb(tmpbyte|0x10, DEVADDR(0x4A));
-			tmpbyte = sii_inb(DEVADDR(0x4A));
+			writeb(tmpbyte|0x10, DEVADDR(0x4A));
+			tmpbyte = readb(DEVADDR(0x4A));
 		case 0x31:
 			/* if clocking is disabled */
 			/* 133 clock attempt to force it on */
-			sii_outb(tmpbyte & ~0x20, DEVADDR(0x4A));
-			tmpbyte = sii_inb(DEVADDR(0x4A));
+			writeb(tmpbyte & ~0x20, DEVADDR(0x4A));
+			tmpbyte = readb(DEVADDR(0x4A));
 		case 0x11:
 		case 0x21:
 			break;
 		default:
 			tmpbyte &= ~0x30;
 			tmpbyte |= 0x20;
-			sii_outb(tmpbyte, DEVADDR(0x4A));
+			writeb(tmpbyte, DEVADDR(0x4A));
 			break;
 	}
 	
-	sii_outb(0x72, DEVADDR(0xA1));
-	sii_outw(0x328A, DEVADDR(0xA2));
-	sii_outl(0x62DD62DD, DEVADDR(0xA4));
-	sii_outl(0x43924392, DEVADDR(0xA8));
-	sii_outl(0x40094009, DEVADDR(0xAC));
-	sii_outb(0x72, DEVADDR(0xE1));
-	sii_outw(0x328A, DEVADDR(0xE2));
-	sii_outl(0x62DD62DD, DEVADDR(0xE4));
-	sii_outl(0x43924392, DEVADDR(0xE8));
-	sii_outl(0x40094009, DEVADDR(0xEC));
+	writeb(0x72, DEVADDR(0xA1));
+	writew(0x328A, DEVADDR(0xA2));
+	writel(0x62DD62DD, DEVADDR(0xA4));
+	writel(0x43924392, DEVADDR(0xA8));
+	writel(0x40094009, DEVADDR(0xAC));
+	writeb(0x72, DEVADDR(0xE1));
+	writew(0x328A, DEVADDR(0xE2));
+	writel(0x62DD62DD, DEVADDR(0xE4));
+	writel(0x43924392, DEVADDR(0xE8));
+	writel(0x40094009, DEVADDR(0xEC));
 
 	if (dev->device == PCI_DEVICE_ID_SII_3112) {
-		sii_outl(0xFFFF0000, DEVADDR(0x108));
-		sii_outl(0xFFFF0000, DEVADDR(0x188));
-		sii_outl(0x00680000, DEVADDR(0x148));
-		sii_outl(0x00680000, DEVADDR(0x1C8));
+		writel(0xFFFF0000, DEVADDR(0x108));
+		writel(0xFFFF0000, DEVADDR(0x188));
+		writel(0x00680000, DEVADDR(0x148));
+		writel(0x00680000, DEVADDR(0x1C8));
 	}
 
-	tmpbyte = sii_inb(DEVADDR(0x4A));
+	tmpbyte = readb(DEVADDR(0x4A));
 
 	proc_reports_siimage(dev, (tmpbyte>>=4), name);
 	return 1;
 }
-#endif /* CONFIG_TRY_MMIO_SIIMAGE */
 
 static unsigned int __init init_chipset_siimage (struct pci_dev *dev, const char *name)
 {
 	u32 class_rev	= 0;
 	u8 tmpbyte	= 0;
-#ifdef CONFIG_TRY_MMIO_SIIMAGE
 	u8 BA5_EN	= 0;
-#endif /* CONFIG_TRY_MMIO_SIIMAGE */
 
         pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
         class_rev &= 0xff;
 	pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (class_rev) ? 1 : 255);	
 
-#ifdef CONFIG_TRY_MMIO_SIIMAGE
 	pci_read_config_byte(dev, 0x8A, &BA5_EN);
 	if ((BA5_EN & 0x01) || (pci_resource_start(dev, 5))) {
 		if (setup_mmio_siimage(dev, name)) {
 			return 0;
 		}
 	}
-#endif /* CONFIG_TRY_MMIO_SIIMAGE */
 
 	pci_write_config_byte(dev, 0x80, 0x00);
 	pci_write_config_byte(dev, 0x84, 0x00);
@@ -653,22 +646,12 @@
 static void __init init_mmio_iops_siimage (ide_hwif_t *hwif)
 {
 	struct pci_dev *dev	= hwif->pci_dev;
-	u32 addr		= (u32) pci_get_drvdata(hwif->pci_dev);
+	unsigned long addr	= (unsigned long) pci_get_drvdata(hwif->pci_dev);
 	u8 ch			= hwif->channel;
 //	u16 i			= 0;
 	hw_regs_t hw;
 
-	hwif->OUTB  = sii_outb;
-	hwif->OUTW  = sii_outw;
-	hwif->OUTL  = sii_outl;
-	hwif->OUTSW = sii_outsw;
-	hwif->OUTSL = sii_outsl;
-	hwif->INB   = sii_inb;
-	hwif->INW   = sii_inw;
-	hwif->INL   = sii_inl;
-	hwif->INSW  = sii_insw;
-	hwif->INSL  = sii_insl;
-
+	default_hwif_mmiops(hwif);
 	memset(&hw, 0, sizeof(hw_regs_t));
 
 #if 1
@@ -706,7 +689,7 @@
 #endif
 
 #if 0
-	printk("%s: ", hwif->name);
+	printk(KERN_DEBUG "%s: ", hwif->name);
 	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
 		printk("0x%08x ", DEVADDR((ch) ? 0xC0 : 0x80)|(i));
 	printk("0x%08x ", DEVADDR((ch) ? 0xCA : 0x8A)|(i));
@@ -726,7 +709,6 @@
 	hw.priv				= (void *) addr;
 //	hw.priv				= pci_get_drvdata(hwif->pci_dev);
 	hw.irq				= hwif->pci_dev->irq;
-//	hw.iops				= siimage_iops;
 
 	memcpy(&hwif->hw, &hw, sizeof(hw));
 	memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports));
@@ -777,9 +759,6 @@
 		pci_read_config_byte(hwif->pci_dev, SELREG(0), &ata66);
 		return (ata66 & 0x01) ? 1 : 0;
 	}
-#ifndef CONFIG_TRY_MMIO_SIIMAGE
-	if (hwif->mmio) BUG();
-#endif /* CONFIG_TRY_MMIO_SIIMAGE */
 
 	return (hwif->INB(SELADDR(0)) & 0x01) ? 1 : 0;
 }
@@ -870,5 +849,3 @@
 MODULE_AUTHOR("Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for SiI IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/siimage.h b/drivers/ide/pci/siimage.h
--- a/drivers/ide/pci/siimage.h	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/pci/siimage.h	Sun Feb 23 22:25:24 2003
@@ -9,8 +9,6 @@
 
 #define DISPLAY_SIIMAGE_TIMINGS
 
-#define CONFIG_TRY_MMIO_SIIMAGE
-//#undef CONFIG_TRY_MMIO_SIIMAGE
 #undef SIIMAGE_VIRTUAL_DMAPIO
 #undef SIIMAGE_BUFFERED_TASKFILE
 #undef SIIMAGE_LARGE_DMA
@@ -31,62 +29,10 @@
 
 #define ADJREG(B,R)	((B)|(R)|((hwif->channel)<<(4+(2*(hwif->mmio)))))
 #define SELREG(R)	ADJREG((0xA0),(R))
-#define SELADDR(R)	((((u32)hwif->hwif_data)*(hwif->mmio))|SELREG((R)))
-#define HWIFADDR(R)	((((u32)hwif->hwif_data)*(hwif->mmio))|(R))
-#define DEVADDR(R)	(((u32) pci_get_drvdata(dev))|(R))
+#define SELADDR(R)	((((unsigned long)hwif->hwif_data)*(hwif->mmio))|SELREG((R)))
+#define HWIFADDR(R)	((((unsigned long)hwif->hwif_data)*(hwif->mmio))|(R))
+#define DEVADDR(R)	(((unsigned long) pci_get_drvdata(dev))|(R))
 
-
-inline u8 sii_inb (u32 port)
-{
-	return (u8) readb(port);
-}
-
-inline u16 sii_inw (u32 port)
-{
-	return (u16) readw(port);
-}
-
-inline void sii_insw (u32 port, void *addr, u32 count)
-{
-	while (count--) { *(u16 *)addr = readw(port); addr += 2; }
-}
-
-inline u32 sii_inl (u32 port)
-{
-	return (u32) readl(port);
-}
-
-inline void sii_insl (u32 port, void *addr, u32 count)
-{
-	sii_insw(port, addr, (count)<<1);
-//	while (count--) { *(u32 *)addr = readl(port); addr += 4; }
-}
-
-inline void sii_outb (u8 value, u32 port)
-{
-	writeb(value, port);
-}
-
-inline void sii_outw (u16 value, u32 port)
-{
-	writew(value, port);
-}
-
-inline void sii_outsw (u32 port, void *addr, u32 count)
-{
-	while (count--) { writew(*(u16 *)addr, port); addr += 2; }
-}
-
-inline void sii_outl (u32 value, u32 port)
-{
-	writel(value, port);
-}
-
-inline void sii_outsl (u32 port, void *addr, u32 count)
-{
-	sii_outsw(port, addr, (count)<<1);
-//	while (count--) { writel(*(u32 *)addr, port); addr += 4; }
-}
 
 #if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS)
 #include <linux/stat.h>
diff -Nru a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
--- a/drivers/ide/pci/sis5513.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/ide/pci/sis5513.c	Sun Feb 23 22:25:24 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/sis5513.c		Version 0.14ac	Sept 11, 2002
+ * linux/drivers/ide/pci/sis5513.c		Version 0.14ac	Sept 11, 2002
  *
  * Copyright (C) 1999-2000	Andre Hedrick <andre@linux-ide.org>
  * Copyright (C) 2002		Lionel Bouton <Lionel.Bouton@inet6.fr>, Maintainer
@@ -10,7 +10,7 @@
  *
  * SiS Taiwan		: for direct support and hardware.
  * Daniela Engert	: for initial ATA100 advices and numerous others.
- * John Fremlin, Manfred Spraul, Dave Morgan :
+ * John Fremlin, Manfred Spraul, Dave Morgan, Peter Kjellerstedt	:
  *			  for checking code correctness, providing patches.
  *
  *
@@ -18,18 +18,27 @@
  * ATA100 tests and design on the SiS735/5513 chipset.
  * ATA16/33 support from specs
  * ATA133 support for SiS961/962 by L.C. Chang <lcchang@sis.com.tw>
+ *
+ * Documentation:
+ *	SiS chipset documentation available under NDA to companies not
+ *	individuals only.
  */
 
 /*
- * TODO:
- *	- Get ridden of SisHostChipInfo[] completness dependency.
- *	- Study drivers/ide/ide-timing.h.
- *	- Are there pre-ATA_16 SiS5513 chips ? -> tune init code for them
- *	  or remove ATA_00 define
- *	- More checks in the config registers (force values instead of
- *	  relying on the BIOS setting them correctly).
- *	- Further optimisations ?
- *	  . for example ATA66+ regs 0x48 & 0x4A
+ * Notes/Special cases:
+ * - SiS5513 derivatives usually have the same PCI IDE register layout when
+ *  supporting the same UDMA modes.
+ * - There are exceptions :
+ *  . SiS730 and SiS550 use the same layout than ATA_66 chipsets but support
+ *   ATA_100
+ *  . ATA_133 capable chipsets mark a shift in SiS chipset designs : previously
+ *   south and northbridge were integrated, making IDE (a southbridge function)
+ *   capabilities easily deduced from the northbridge PCI id. With ATA_133,
+ *   chipsets started to be split in the usual north/south bridges chips
+ *   -> the driver needs to detect the correct southbridge when faced to newest
+ *   northbridges.
+ *  . On ATA133 capable chipsets when bit 30 of dword at 0x54 is 1 the
+ *   configuration space is moved from 0x40 to 0x70.
  */
 
 #include <linux/config.h>
@@ -64,7 +73,7 @@
 /* Miscellaneaous flags */
 #define SIS5513_LATENCY		0x01
 
-/* registers layout and init values are chipset family dependent */
+/* registers layout and init values are chipset family dependant */
 /* 1/ define families */
 #define ATA_00		0x00
 #define ATA_16		0x01
@@ -298,6 +307,7 @@
 static char* get_drives_info (char *buffer, u8 pos)
 {
 	u8 reg00, reg01, reg10, reg11; /* timing registers */
+	u32 regdw0, regdw1;
 	char* p = buffer;
 
 /* Postwrite/Prefetch */
@@ -313,13 +323,31 @@
 		pci_read_config_byte(bmide_dev, 0x41+2*pos, &reg01);
 		pci_read_config_byte(bmide_dev, 0x44+2*pos, &reg10);
 		pci_read_config_byte(bmide_dev, 0x45+2*pos, &reg11);
+	} else {
+		u32 reg54h;
+		u8 drive_pci = 0x40;
+		pci_read_config_dword(bmide_dev, 0x54, &reg54h);
+		if (reg54h & 0x40000000) {
+			// Configuration space remapped to 0x70
+			drive_pci = 0x70;
+		}
+		pci_read_config_dword(bmide_dev, (unsigned long)drive_pci+8*pos, &regdw0);
+		pci_read_config_dword(bmide_dev, (unsigned long)drive_pci+8*pos+4, &regdw1);
+		p += sprintf(p, "Drive %d:\n", pos);
 	}
 
 
 /* UDMA */
-	if (chipset_family >= ATA_33) {
+	if (chipset_family >= ATA_133) {
+		p += sprintf(p, "                UDMA %s \t \t \t UDMA %s\n",
+			     (regdw0 & 0x04) ? "Enabled" : "Disabled",
+			     (regdw1 & 0x04) ? "Enabled" : "Disabled");
+		p += sprintf(p, "                UDMA Cycle Time    %s \t UDMA Cycle Time    %s\n",
+			     cycle_time[(regdw0 & 0xF0) >> 4],
+			     cycle_time[(regdw1 & 0xF0) >> 4]);
+	} else if (chipset_family >= ATA_33) {
 		p += sprintf(p, "                UDMA %s \t \t \t UDMA %s\n",
-			     (reg01 & 0x80)  ? "Enabled" : "Disabled",
+			     (reg01 & 0x80) ? "Enabled" : "Disabled",
 			     (reg11 & 0x80) ? "Enabled" : "Disabled");
 
 		p += sprintf(p, "                UDMA Cycle Time    ");
@@ -659,13 +687,11 @@
 	ide_hwif_t *hwif	= HWIF(drive);
 	struct pci_dev *dev	= hwif->pci_dev;
 
-	u8 drive_pci, reg;
+	u8 drive_pci, reg, speed;
 	u32 regdw;
 
 #ifdef DEBUG
 	sis5513_load_verify_registers(dev, "sis5513_tune_chipset start");
-	printk("SIS5513: sis5513_tune_chipset, drive %d, speed %d\n",
-	       drive->dn, speed);
 #endif
 
 #ifdef BROKEN_LEVEL
@@ -675,7 +701,12 @@
 	if (xferspeed > BROKEN_LEVEL) xferspeed = BROKEN_LEVEL;
 #endif
 
-	u8 speed = ide_rate_filter(sis5513_ratemask(drive), xferspeed);
+	speed = ide_rate_filter(sis5513_ratemask(drive), xferspeed);
+
+#ifdef DEBUG
+	printk("SIS5513: sis5513_tune_chipset, drive %d, speed %d\n",
+	       drive->dn, xferspeed);
+#endif
 
 	/* See config_art_rwp_pio for drive pci config registers */
 	drive_pci = 0x40;
@@ -770,7 +801,7 @@
 	u8 speed	= ide_dma_speed(drive, sis5513_ratemask(drive));
 
 #ifdef DEBUG
-	printk("SIS5513: config_chipset_for_dma, drive %d, ultra %x, udma_66 %x\n",
+	printk("SIS5513: config_chipset_for_dma, drive %d, ultra %x\n",
 	       drive->dn, drive->id->dma_ultra);
 #endif
 
@@ -1056,4 +1087,15 @@
 MODULE_DESCRIPTION("PCI driver module for SIS IDE");
 MODULE_LICENSE("GPL");
 
-EXPORT_NO_SYMBOLS;
+/*
+ * TODO:
+ *	- Get ridden of SisHostChipInfo[] completness dependancy.
+ *	- Study drivers/ide/ide-timing.h.
+ *	- Are there pre-ATA_16 SiS5513 chips ? -> tune init code for them
+ *	  or remove ATA_00 define
+ *	- More checks in the config registers (force values instead of
+ *	  relying on the BIOS setting them correctly).
+ *	- Further optimisations ?
+ *	  . for example ATA66+ regs 0x48 & 0x4A
+ */
+
diff -Nru a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
--- a/drivers/ide/pci/sl82c105.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/pci/sl82c105.c	Sun Feb 23 22:25:23 2003
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/sl82c105.c
+ * linux/drivers/ide/pci/sl82c105.c
  *
  * SL82C105/Winbond 553 IDE driver
  *
@@ -7,6 +7,10 @@
  *
  * Drive tuning added from Rebel.com's kernel sources
  *  -- Russell King (15/11/98) linux@arm.linux.org.uk
+ * 
+ * Merge in Russell's HW workarounds, fix various problems
+ * with the timing registers setup.
+ *  -- Benjamin Herrenschmidt (01/11/03) benh@kernel.crashing.org
  */
 
 #include <linux/config.h>
@@ -28,6 +32,24 @@
 #include "ide_modes.h"
 #include "sl82c105.h"
 
+#undef DEBUG
+
+#ifdef DEBUG
+#define DBG(arg) printk arg
+#else
+#define DBG(fmt,...)
+#endif
+/*
+ * SL82C105 PCI config register 0x40 bits.
+ */
+#define CTRL_IDE_IRQB   (1 << 30)
+#define CTRL_IDE_IRQA   (1 << 28)
+#define CTRL_LEGIRQ     (1 << 11)
+#define CTRL_P1F16      (1 << 5)
+#define CTRL_P1EN       (1 << 4)
+#define CTRL_P0F16      (1 << 1)
+#define CTRL_P0EN       (1 << 0)
+
 /*
  * Convert a PIO mode and cycle time to the required on/off
  * times for the interface.  This has protection against run-away
@@ -57,7 +79,7 @@
 /*
  * Configure the drive and chipset for PIO
  */
-static void config_for_pio(ide_drive_t *drive, int pio, int report)
+static void config_for_pio(ide_drive_t *drive, int pio, int report, int chipset_only)
 {
 	ide_hwif_t *hwif = HWIF(drive);
 	struct pci_dev *dev = hwif->pci_dev;
@@ -65,14 +87,20 @@
 	u16 drv_ctrl = 0x909;
 	unsigned int xfer_mode, reg;
 
+	DBG(("config_for_pio(drive:%s, pio:%d, report:%d, chipset_only:%d)\n",
+		drive->name, pio, report, chipset_only));
+		
 	reg = (hwif->channel ? 0x4c : 0x44) + (drive->select.b.unit ? 4 : 0);
 
 	pio = ide_get_best_pio_mode(drive, pio, 5, &p);
 
 	xfer_mode = XFER_PIO_0 + pio;
 
-	if (ide_config_drive_speed(drive, xfer_mode) == 0)
+	if (chipset_only || ide_config_drive_speed(drive, xfer_mode) == 0) {
 		drv_ctrl = get_timing_sl82c105(&p);
+		drive->pio_speed = xfer_mode;
+	} else
+		drive->pio_speed = XFER_PIO_0;
 
 	if (drive->using_dma == 0) {
 		/*
@@ -96,15 +124,16 @@
 {
 	ide_hwif_t *hwif = HWIF(drive);
 	struct pci_dev *dev = hwif->pci_dev;
-	u16 drv_ctrl = 0x909;
 	unsigned int reg;
 
+	DBG(("config_for_dma(drive:%s)\n", drive->name));
+
 	reg = (hwif->channel ? 0x4c : 0x44) + (drive->select.b.unit ? 4 : 0);
 
-	if (ide_config_drive_speed(drive, XFER_MW_DMA_2) == 0)
-		drv_ctrl = 0x0240;
+	if (ide_config_drive_speed(drive, XFER_MW_DMA_2) != 0)
+		return 1;
 
-	pci_write_config_word(dev, reg, drv_ctrl);
+	pci_write_config_word(dev, reg, 0x0240);
 
 	return 0;
 }
@@ -117,6 +146,9 @@
 static int sl82c105_check_drive (ide_drive_t *drive)
 {
 	ide_hwif_t *hwif	= HWIF(drive);
+
+	DBG(("sl82c105_check_drive(drive:%s)\n", drive->name));
+
 	do {
 		struct hd_driveid *id = drive->id;
 
@@ -143,34 +175,188 @@
 	return hwif->ide_dma_off_quietly(drive);
 }
 
+/*
+ * The SL82C105 holds off all IDE interrupts while in DMA mode until
+ * all DMA activity is completed.  Sometimes this causes problems (eg,
+ * when the drive wants to report an error condition).
+ *
+ * 0x7e is a "chip testing" register.  Bit 2 resets the DMA controller
+ * state machine.  We need to kick this to work around various bugs.
+ */
+static inline void sl82c105_reset_host(struct pci_dev *dev)
+{
+	u16 val;
+
+	pci_read_config_word(dev, 0x7e, &val);
+	pci_write_config_word(dev, 0x7e, val | (1 << 2));
+	pci_write_config_word(dev, 0x7e, val & ~(1 << 2));
+}
+
+/*
+ * If we get an IRQ timeout, it might be that the DMA state machine
+ * got confused.  Fix from Todd Inglett.  Details from Winbond.
+ *
+ * This function is called when the IDE timer expires, the drive
+ * indicates that it is READY, and we were waiting for DMA to complete.
+ */
+static int sl82c105_ide_dma_lost_irq(ide_drive_t *drive)
+{
+	ide_hwif_t *hwif = HWIF(drive);
+	struct pci_dev *dev = hwif->pci_dev;
+	u32 val, mask = hwif->channel ? CTRL_IDE_IRQB : CTRL_IDE_IRQA;
+	unsigned long dma_base = hwif->dma_base;
+
+	printk("sl82c105: lost IRQ: resetting host\n");
+
+	/*
+	 * Check the raw interrupt from the drive.
+	 */
+	pci_read_config_dword(dev, 0x40, &val);
+	if (val & mask)
+		printk("sl82c105: drive was requesting IRQ, but host lost it\n");
+
+	/*
+	 * Was DMA enabled?  If so, disable it - we're resetting the
+	 * host.  The IDE layer will be handling the drive for us.
+	 */
+	val = hwif->INB(dma_base);
+	if (val & 1) {
+		outb(val & ~1, dma_base);
+		printk("sl82c105: DMA was enabled\n");
+	}
+
+	sl82c105_reset_host(dev);
+
+	/* ide_dmaproc would return 1, so we do as well */
+	return 1;
+}
+
+/*
+ * ATAPI devices can cause the SL82C105 DMA state machine to go gaga.
+ * Winbond recommend that the DMA state machine is reset prior to
+ * setting the bus master DMA enable bit.
+ *
+ * The generic IDE core will have disabled the BMEN bit before this
+ * function is called.
+ */
+static int sl82c105_ide_dma_begin(ide_drive_t *drive)
+{
+	ide_hwif_t *hwif = HWIF(drive);
+	struct pci_dev *dev = hwif->pci_dev;
+
+//	DBG(("sl82c105_ide_dma_begin(drive:%s)\n", drive->name));
+
+	sl82c105_reset_host(dev);
+	return __ide_dma_begin(drive);
+}
+
+static int sl82c105_ide_dma_timeout(ide_drive_t *drive)
+{
+	ide_hwif_t *hwif = HWIF(drive);
+	struct pci_dev *dev = hwif->pci_dev;
+
+	DBG(("sl82c105_ide_dma_timeout(drive:%s)\n", drive->name));
+
+	sl82c105_reset_host(dev);
+	return __ide_dma_timeout(drive);
+}
+
 static int sl82c105_ide_dma_on (ide_drive_t *drive)
 {
+	DBG(("sl82c105_ide_dma_on(drive:%s)\n", drive->name));
+
 	if (config_for_dma(drive)) {
-		config_for_pio(drive, 4, 0);
+		config_for_pio(drive, 4, 0, 0);
 		return HWIF(drive)->ide_dma_off_quietly(drive);
 	}
+	printk(KERN_INFO "%s: DMA enabled\n", drive->name);
 	return __ide_dma_on(drive);
 }
 
 static int sl82c105_ide_dma_off (ide_drive_t *drive)
 {
-	config_for_pio(drive, 4, 0);
-	return __ide_dma_off(drive);
+	u8 speed = XFER_PIO_0;
+	int rc;
+	
+	DBG(("sl82c105_ide_dma_off(drive:%s)\n", drive->name));
+
+	rc = __ide_dma_off(drive);
+	if (drive->pio_speed)
+		speed = drive->pio_speed - XFER_PIO_0;
+	config_for_pio(drive, speed, 0, 1);
+	drive->current_speed = drive->pio_speed;
+
+	return rc;
 }
 
 static int sl82c105_ide_dma_off_quietly (ide_drive_t *drive)
 {
-	config_for_pio(drive, 4, 0);
-	return __ide_dma_off_quietly(drive);
+	u8 speed = XFER_PIO_0;
+	int rc;
+	
+	DBG(("sl82c105_ide_dma_off_quietly(drive:%s)\n", drive->name));
+
+	rc = __ide_dma_off_quietly(drive);
+	if (drive->pio_speed)
+		speed = drive->pio_speed - XFER_PIO_0;
+	config_for_pio(drive, speed, 0, 1);
+	drive->current_speed = drive->pio_speed;
+
+	return rc;
+}
+
+/*
+ * Ok, that is nasty, but we must make sure the DMA timings
+ * won't be used for a PIO access. The solution here is
+ * to make sure the 16 bits mode is diabled on the channel
+ * when DMA is enabled, thus causing the chip to use PIO0
+ * timings for those operations.
+ */
+static void sl82c105_selectproc(ide_drive_t *drive)
+{
+	ide_hwif_t *hwif = HWIF(drive);
+	struct pci_dev *dev = hwif->pci_dev;
+	u32 val, old, mask;
+
+	//DBG(("sl82c105_selectproc(drive:%s)\n", drive->name));
+
+	mask = hwif->channel ? CTRL_P1F16 : CTRL_P0F16;
+	old = val = *((u32 *)&hwif->hwif_data);
+	if (drive->using_dma)
+		val &= ~mask;
+	else
+		val |= mask;
+	if (old != val) {
+		pci_write_config_dword(dev, 0x40, val);	
+		*((u32 *)&hwif->hwif_data) = val;
+	}
 }
 
 /*
+ * ATA reset will clear the 16 bits mode in the control
+ * register, we need to update our cache
+ */
+static void sl82c105_resetproc(ide_drive_t *drive)
+{
+	ide_hwif_t *hwif = HWIF(drive);
+	struct pci_dev *dev = hwif->pci_dev;
+	u32 val;
+
+	DBG(("sl82c105_resetproc(drive:%s)\n", drive->name));
+
+	pci_read_config_dword(dev, 0x40, &val);
+	*((u32 *)&hwif->hwif_data) = val;
+}
+	
+/*
  * We only deal with PIO mode here - DMA mode 'using_dma' is not
  * initialised at the point that this function is called.
  */
 static void tune_sl82c105(ide_drive_t *drive, u8 pio)
 {
-	config_for_pio(drive, pio, 1);
+	DBG(("tune_sl82c105(drive:%s)\n", drive->name));
+
+	config_for_pio(drive, pio, 1, 0);
 
 	/*
 	 * We support 32-bit I/O on this interface, and it
@@ -189,16 +375,20 @@
 	struct pci_dev *bridge;
 	u8 rev;
 
-	bridge = pci_find_device(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_83C553, NULL);
-
 	/*
-	 * If we are part of a Winbond 553
+	 * The bridge should be part of the same device, but function 0.
 	 */
-	if (!bridge || bridge->class >> 8 != PCI_CLASS_BRIDGE_ISA)
+	bridge = pci_find_slot(dev->bus->number,
+			       PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
+	if (!bridge)
 		return -1;
 
-	if (bridge->bus != dev->bus ||
-	    PCI_SLOT(bridge->devfn) != PCI_SLOT(dev->devfn))
+	/*
+	 * Make sure it is a Winbond 553 and is an ISA bridge.
+	 */
+	if (bridge->vendor != PCI_VENDOR_ID_WINBOND ||
+	    bridge->device != PCI_DEVICE_ID_WINBOND_83C553 ||
+	    bridge->class >> 8 != PCI_CLASS_BRIDGE_ISA)
 		return -1;
 
 	/*
@@ -211,16 +401,21 @@
 
 /*
  * Enable the PCI device
+ * 
+ * --BenH: It's arch fixup code that should enable channels that
+ * have not been enabled by firmware. I decided we can still enable
+ * channel 0 here at least, but channel 1 has to be enabled by
+ * firmware or arch code. We still set both to 16 bits mode.
  */
 static unsigned int __init init_chipset_sl82c105(struct pci_dev *dev, const char *msg)
 {
-	u8 ctrl_stat;
+	u32 val;
 
-	/*
-	 * Enable the ports
-	 */
-	pci_read_config_byte(dev, 0x40, &ctrl_stat);
-	pci_write_config_byte(dev, 0x40, ctrl_stat | 0x33);
+	DBG(("init_chipset_sl82c105()\n"));
+
+	pci_read_config_dword(dev, 0x40, &val);
+	val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16;
+	pci_write_config_dword(dev, 0x40, val);
 
 	return dev->irq;
 }
@@ -230,6 +425,8 @@
 	unsigned int rev;
 	u8 dma_state;
 
+	DBG(("init_dma_sl82c105(hwif: ide%d, dma_base: 0x%08x)\n", hwif->index, dma_base));
+
 	hwif->autodma = 0;
 
 	if (!dma_base)
@@ -238,8 +435,6 @@
 	dma_state = hwif->INB(dma_base + 2);
 	rev = sl82c105_bridge_revision(hwif->pci_dev);
 	if (rev <= 5) {
-		hwif->drives[0].autotune = 1;
-		hwif->drives[1].autotune = 1;
 		printk("    %s: Winbond 553 bridge revision %d, BM-DMA disabled\n",
 		       hwif->name, rev);
 		dma_state &= ~0x60;
@@ -259,8 +454,28 @@
 
 static void __init init_hwif_sl82c105(ide_hwif_t *hwif)
 {
-	hwif->tuneproc = tune_sl82c105;
+	struct pci_dev *dev = hwif->pci_dev;
+	u32 val;
+	
+	DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index));
 
+	hwif->tuneproc = tune_sl82c105;
+	hwif->selectproc = sl82c105_selectproc;
+	hwif->resetproc = sl82c105_resetproc;
+	
+	/* Default to PIO 0 for fallback unless tuned otherwise,
+	 * we always autotune PIO, this is done before DMA is
+	 * checked, so there is no risk of accidentally disabling
+	 * DMA
+	  */
+	hwif->drives[0].pio_speed = XFER_PIO_0;
+	hwif->drives[0].autotune = 1;
+	hwif->drives[1].pio_speed = XFER_PIO_1;
+	hwif->drives[1].autotune = 1;
+
+	pci_read_config_dword(dev, 0x40, &val);
+	*((u32 *)&hwif->hwif_data) = val;
+	
 	if (!hwif->dma_base)
 		return;
 
@@ -273,6 +488,10 @@
 	hwif->ide_dma_on = &sl82c105_ide_dma_on;
 	hwif->ide_dma_off = &sl82c105_ide_dma_off;
 	hwif->ide_dma_off_quietly = &sl82c105_ide_dma_off_quietly;
+	hwif->ide_dma_lostirq = &sl82c105_ide_dma_lost_irq;
+	hwif->ide_dma_begin = &sl82c105_ide_dma_begin;
+	hwif->ide_dma_timeout = &sl82c105_ide_dma_timeout;
+
 	if (!noautodma)
 		hwif->autodma = 1;
 	hwif->drives[0].autodma = hwif->autodma;
@@ -318,5 +537,3 @@
 
 MODULE_DESCRIPTION("PCI driver module for W82C105 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
--- a/drivers/ide/pci/slc90e66.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/ide/pci/slc90e66.c	Sun Feb 23 22:25:25 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/slc90e66.c	Version 0.11	September 11, 2002
+ *  linux/drivers/ide/pci/slc90e66.c	Version 0.11	September 11, 2002
  *
  *  Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org>
  *
@@ -403,5 +403,3 @@
 MODULE_AUTHOR("Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for SLC90E66 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
--- a/drivers/ide/pci/trm290.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/ide/pci/trm290.c	Sun Feb 23 22:25:22 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/trm290.c		Version 1.02	Mar. 18, 2000
+ *  linux/drivers/ide/pci/trm290.c		Version 1.02	Mar. 18, 2000
  *
  *  Copyright (c) 1997-1998  Mark Lord
  *  May be copied or modified under the terms of the GNU General Public License
@@ -176,6 +176,7 @@
 	trm290_prepare_drive(drive, drive->using_dma);
 }
 
+#ifdef CONFIG_BLK_DEV_IDEDMA
 static int trm290_ide_dma_write (ide_drive_t *drive /*, struct request *rq */)
 {
 	ide_hwif_t *hwif	= HWIF(drive);
@@ -296,6 +297,7 @@
 	status = hwif->INW(hwif->dma_status);
 	return (status == 0x00ff);
 }
+#endif /* CONFIG_BLK_DEV_IDEDMA */
 
 /*
  * Invoked from ide-dma.c at boot time.
@@ -342,11 +344,13 @@
 
 	ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3);
 
+#ifdef CONFIG_BLK_DEV_IDEDMA
 	hwif->ide_dma_write = &trm290_ide_dma_write;
 	hwif->ide_dma_read = &trm290_ide_dma_read;
 	hwif->ide_dma_begin = &trm290_ide_dma_begin;
 	hwif->ide_dma_end = &trm290_ide_dma_end;
 	hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq;
+#endif /* CONFIG_BLK_DEV_IDEDMA */
 
 	hwif->selectproc = &trm290_selectproc;
 	hwif->autodma = 0;		/* play it safe for now */
@@ -430,5 +434,3 @@
 MODULE_AUTHOR("Mark Lord");
 MODULE_DESCRIPTION("PCI driver module for Tekram TRM290 IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
--- a/drivers/ide/pci/via82cxxx.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/ide/pci/via82cxxx.c	Sun Feb 23 22:25:21 2003
@@ -667,5 +667,3 @@
 MODULE_AUTHOR("Vojtech Pavlik, Michel Aubry, Jeff Garzik, Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for VIA IDE");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
--- a/drivers/ide/ppc/mpc8xx.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/ide/ppc/mpc8xx.c	Sun Feb 23 22:25:26 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/ide-m8xx.c
+ *  linux/drivers/ide/ppc/ide-m8xx.c
  *
  *  Copyright (C) 2000, 2001 Wolfgang Denk, wd@denx.de
  *  Modified for direct IDE interface
@@ -54,7 +54,7 @@
 
 typedef	struct ide_ioport_desc {
 	unsigned long	base_off;		/* Offset to PCMCIA memory	*/
-	ide_ioreg_t	reg_off[IDE_NR_PORTS];	/* controller register offsets	*/
+	unsigned long	reg_off[IDE_NR_PORTS];	/* controller register offsets	*/
 	int		irq;			/* IRQ				*/
 } ide_ioport_desc_t;
 
@@ -113,7 +113,7 @@
  * IDE stuff.
  */
 static int
-m8xx_ide_default_irq(ide_ioreg_t base)
+m8xx_ide_default_irq(unsigned long base)
 {
 #ifdef CONFIG_BLK_DEV_MPC8xx_IDE
 	if (base >= MAX_HWIFS)
@@ -127,7 +127,7 @@
 #endif
 }
 
-static ide_ioreg_t
+static unsigned long
 m8xx_ide_default_io_base(int index)
 {
         return index;
@@ -161,10 +161,10 @@
  */
 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
 static void
-m8xx_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, 
-		ide_ioreg_t ctrl_port, int *irq)
+m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, 
+		unsigned long ctrl_port, int *irq)
 {
-	ide_ioreg_t *p = hw->io_ports;
+	unsigned long *p = hw->io_ports;
 	int i;
 
 	typedef struct {
@@ -346,9 +346,9 @@
  */
 #if defined(CONFIG_IDE_EXT_DIRECT)
 void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
-	ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
+	unsigned long data_port, unsigned long ctrl_port, int *irq)
 {
-	ide_ioreg_t *p = hw->io_ports;
+	unsigned long *p = hw->io_ports;
 	int i;
 
 	u32 ide_phy_base;
diff -Nru a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
--- a/drivers/ide/ppc/pmac.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/ide/ppc/pmac.c	Sun Feb 23 22:25:22 2003
@@ -51,7 +51,7 @@
 #define DMA_WAIT_TIMEOUT	500
 
 typedef struct pmac_ide_hwif {
-	ide_ioreg_t			regbase;
+	unsigned long			regbase;
 	int				irq;
 	int				kind;
 	int				aapl_bus_id;
@@ -267,7 +267,7 @@
  */
 void __pmac
 pmac_ide_init_hwif_ports(hw_regs_t *hw,
-			      ide_ioreg_t data_port, ide_ioreg_t ctrl_port,
+			      unsigned long data_port, unsigned long ctrl_port,
 			      int *irq)
 {
 	int i, ix;
@@ -672,14 +672,14 @@
 	pmif->timings[0] = pmif->timings[1] = value;
 }
 
-ide_ioreg_t __pmac
+unsigned long __pmac
 pmac_ide_get_base(int index)
 {
 	return pmac_ide[index].regbase;
 }
 
 int __pmac
-pmac_ide_check_base(ide_ioreg_t base)
+pmac_ide_check_base(unsigned long base)
 {
 	int ix;
 	
@@ -690,7 +690,7 @@
 }
 
 int __pmac
-pmac_ide_get_irq(ide_ioreg_t base)
+pmac_ide_get_irq(unsigned long base)
 {
 	int ix;
 
diff -Nru a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
--- a/drivers/ide/setup-pci.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ide/setup-pci.c	Sun Feb 23 22:25:23 2003
@@ -662,7 +662,7 @@
 		 *	This is in the wrong place. The driver may
 		 *	do set up based on the autotune value and this
 		 *	will then trash it. Torben please move it and
-		 *	propogate the fixes into the drivers
+		 *	propagate the fixes into the drivers
 		 */		
 		if (drive0_tune == IDE_TUNE_BIOS) /* biostimings */
 			hwif->drives[0].autotune = IDE_TUNE_BIOS;
diff -Nru a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c
--- a/drivers/ieee1394/hosts.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ieee1394/hosts.c	Sun Feb 23 22:25:23 2003
@@ -11,6 +11,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/module.h>
 #include <linux/types.h>
 #include <linux/list.h>
 #include <linux/init.h>
@@ -69,8 +70,10 @@
         spin_lock_irqsave(&hosts_lock, flags);
         list_for_each(lh, &hosts) {
                 if (host == list_entry(lh, struct hpsb_host, host_list)) {
-			if (host->driver->devctl(host, MODIFY_USAGE, 1)) {
-				host->driver->devctl(host, MODIFY_USAGE, 1);
+			if (try_module_get(host->driver->owner)) {
+				/* we're doing this twice and don't seem
+				   to undo it..  --hch */
+				(void)try_module_get(host->driver->owner);
 				host->refcount++;
 				retval = 1;
 			}
@@ -95,7 +98,7 @@
 {
         unsigned long flags;
 
-        host->driver->devctl(host, MODIFY_USAGE, 0);
+	module_put(host->driver->owner);
 
         spin_lock_irqsave(&hosts_lock, flags);
         host->refcount--;
diff -Nru a/drivers/ieee1394/hosts.h b/drivers/ieee1394/hosts.h
--- a/drivers/ieee1394/hosts.h	Sun Feb 23 22:25:22 2003
+++ b/drivers/ieee1394/hosts.h	Sun Feb 23 22:25:22 2003
@@ -92,12 +92,6 @@
          * Return void. */
         CANCEL_REQUESTS,
 
-        /* Decrease host usage count if arg == 0, increase otherwise.  Return
-         * 1 for success, 0 for failure.  Increase usage may fail if the driver
-         * is in the process of shutting itself down.  Decrease usage can not
-         * fail. */
-        MODIFY_USAGE,
-
         /* Start or stop receiving isochronous channel in arg.  Return void.
          * This acts as an optimization hint, hosts are not required not to
          * listen on unrequested channels. */
@@ -147,6 +141,7 @@
 };
 
 struct hpsb_host_driver {
+	struct module *owner;
 	const char *name;
 
         /* This function must store a pointer to the configuration ROM into the
diff -Nru a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
--- a/drivers/ieee1394/ohci1394.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/ieee1394/ohci1394.c	Sun Feb 23 22:25:26 2003
@@ -966,16 +966,6 @@
 		dma_trm_reset(&ohci->at_resp_context);
 		break;
 
-	case MODIFY_USAGE:
-		if (arg) {
-			if (try_module_get(THIS_MODULE))
-				retval = 1;
-		} else {
-			module_put(THIS_MODULE);
-			retval = 1;
-		}
-                break;
-
 	case ISO_LISTEN_CHANNEL:
         {
 		u64 mask;
@@ -3202,6 +3192,7 @@
 }
 
 static struct hpsb_host_driver ohci1394_driver = {
+	.owner =		THIS_MODULE,
 	.name =			OHCI1394_DRIVER_NAME,
 	.get_rom =		ohci_get_rom,
 	.transmit_packet =	ohci_transmit,
diff -Nru a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c
--- a/drivers/ieee1394/pcilynx.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/ieee1394/pcilynx.c	Sun Feb 23 22:25:23 2003
@@ -801,17 +801,6 @@
 
                 break;
 
-        case MODIFY_USAGE:
-		if (arg) {
-			if (try_module_get(THIS_MODULE))
-				retval = 1;
-		} else {
-			module_put(THIS_MODULE);
-			retval = 1;
-		}
-
-                break;
-
         case ISO_LISTEN_CHANNEL:
                 spin_lock_irqsave(&lynx->iso_rcv.lock, flags);
                 
@@ -1904,6 +1893,7 @@
 };
 
 static struct hpsb_host_driver lynx_driver = {
+	.owner =	   THIS_MODULE,
 	.name =		   PCILYNX_DRIVER_NAME,
         .get_rom =         get_lynx_rom,
         .transmit_packet = lynx_transmit,
diff -Nru a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
--- a/drivers/ieee1394/raw1394.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/ieee1394/raw1394.c	Sun Feb 23 22:25:21 2003
@@ -238,7 +238,7 @@
                 list_del(&hi->list);
                 host_count--;
                 /* 
-                   FIXME: adressranges should be removed 
+                   FIXME: addressranges should be removed 
                    and fileinfo states should be initialized
                    (including setting generation to 
                    internal-generation ...)
diff -Nru a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c
--- a/drivers/input/joystick/grip_mp.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/input/joystick/grip_mp.c	Sun Feb 23 22:25:26 2003
@@ -22,10 +22,7 @@
 
 MODULE_AUTHOR("Brian Bonnlander");
 MODULE_DESCRIPTION("Gravis Grip Multiport driver");
-#ifdef MODULE_LICENSE
 MODULE_LICENSE("GPL");
-#endif
-EXPORT_NO_SYMBOLS;
 
 #ifdef GRIP_DEBUG
 #define dbg(format, arg...) printk(KERN_ERR __FILE__ ": " format "\n" , ## arg)
diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
--- a/drivers/input/serio/i8042.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/input/serio/i8042.c	Sun Feb 23 22:25:21 2003
@@ -257,7 +257,7 @@
 /*
  * i8042_close() frees the interrupt, so that it can possibly be used
  * by another driver. We never know - if the user doesn't have a mouse,
- * the BIOS could have used the AUX interupt for PCI.
+ * the BIOS could have used the AUX interrupt for PCI.
  */
 
 static void i8042_close(struct serio *port)
diff -Nru a/drivers/isdn/eicon/divalog.h b/drivers/isdn/eicon/divalog.h
--- a/drivers/isdn/eicon/divalog.h	Sun Feb 23 22:25:27 2003
+++ b/drivers/isdn/eicon/divalog.h	Sun Feb 23 22:25:27 2003
@@ -1,5 +1,5 @@
 /*
- * Include file for defining the kernel loggger messages
+ * Include file for defining the kernel logger messages
  * These definitions are shared between the klog driver and the
  * klogd daemon process
  *
diff -Nru a/drivers/isdn/hardware/eicon/capimain.c b/drivers/isdn/hardware/eicon/capimain.c
--- a/drivers/isdn/hardware/eicon/capimain.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/isdn/hardware/eicon/capimain.c	Sun Feb 23 22:25:22 2003
@@ -29,8 +29,6 @@
 #include "cp_vers.h"
 #include "capifunc.h"
 
-EXPORT_NO_SYMBOLS;
-
 static char *main_revision = "$Revision: 1.1.2.11 $";
 static char *DRIVERNAME =
     "Eicon DIVA - CAPI Interface driver (http://www.melware.net)";
diff -Nru a/drivers/isdn/hardware/eicon/divamnt.c b/drivers/isdn/hardware/eicon/divamnt.c
--- a/drivers/isdn/hardware/eicon/divamnt.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/isdn/hardware/eicon/divamnt.c	Sun Feb 23 22:25:24 2003
@@ -28,8 +28,6 @@
 #include "di_defs.h"
 #include "debug_if.h"
 
-EXPORT_NO_SYMBOLS;
-
 static char *main_revision = "$Revision: 1.1.2.4 $";
 
 static int major = 241;
diff -Nru a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c
--- a/drivers/isdn/hardware/eicon/divasi.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/isdn/hardware/eicon/divasi.c	Sun Feb 23 22:25:23 2003
@@ -28,8 +28,6 @@
 #include "um_xdi.h"
 #include "um_idi.h"
 
-EXPORT_NO_SYMBOLS;
-
 static char *main_revision = "$Revision: 1.1.2.7 $";
 
 static int major = 242;
diff -Nru a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
--- a/drivers/isdn/hardware/eicon/divasmain.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/isdn/hardware/eicon/divasmain.c	Sun Feb 23 22:25:22 2003
@@ -45,7 +45,6 @@
 #include "xdi_vers.h"
 #include "diva_dma.h"
 
-EXPORT_NO_SYMBOLS;
 static char *main_revision = "$Revision: 1.1.2.8 $";
 
 int errno = 0;
diff -Nru a/drivers/isdn/hardware/eicon/divasproc.c b/drivers/isdn/hardware/eicon/divasproc.c
--- a/drivers/isdn/hardware/eicon/divasproc.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/isdn/hardware/eicon/divasproc.c	Sun Feb 23 22:25:25 2003
@@ -33,8 +33,6 @@
 #include "diva.h"
 
 
-EXPORT_NO_SYMBOLS;
-
 extern PISDN_ADAPTER IoAdapters[MAX_ADAPTER];
 extern diva_entity_queue_t adapter_queue;
 extern void divas_get_version(char *);
diff -Nru a/drivers/isdn/hardware/eicon/i4lididrv.c b/drivers/isdn/hardware/eicon/i4lididrv.c
--- a/drivers/isdn/hardware/eicon/i4lididrv.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/isdn/hardware/eicon/i4lididrv.c	Sun Feb 23 22:25:26 2003
@@ -27,8 +27,6 @@
 
 #include "../avmb1/capicmd.h"  /* this should be moved in a common place */
 
-EXPORT_NO_SYMBOLS;
-
 #define INCLUDE_INLINE_FUNCS
 
 static eicon_card *cards = (eicon_card *) NULL;   /* glob. var , contains
diff -Nru a/drivers/isdn/hardware/eicon/io.c b/drivers/isdn/hardware/eicon/io.c
--- a/drivers/isdn/hardware/eicon/io.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/isdn/hardware/eicon/io.c	Sun Feb 23 22:25:22 2003
@@ -534,7 +534,7 @@
   goto Trapped ;
  }
 /*
- * memory based shared ram is accessable from different
+ * memory based shared ram is accessible from different
  * processors without disturbing concurrent processes.
  */
  a->ram_out (a, &IoAdapter->pcm->rc, 0) ;
diff -Nru a/drivers/isdn/hardware/eicon/mi_pc.h b/drivers/isdn/hardware/eicon/mi_pc.h
--- a/drivers/isdn/hardware/eicon/mi_pc.h	Sun Feb 23 22:25:24 2003
+++ b/drivers/isdn/hardware/eicon/mi_pc.h	Sun Feb 23 22:25:24 2003
@@ -120,7 +120,7 @@
 #define MQ_CACHED_ADDR(x)               (((x) & 0x1fffffffL) | 0x80000000L)
 #define MQ_UNCACHED_ADDR(x)             (((x) & 0x1fffffffL) | 0xa0000000L)
 /*--------------------------------------------------------------------------------------------*/
-/* Additional definitions reflecting the different adress map of the  SERVER 4BRI V2          */
+/* Additional definitions reflecting the different address map of the  SERVER 4BRI V2          */
 #define MQ2_BREG_RISC                   0x0200      /* RISC Reset ect                         */
 #define MQ2_BREG_IRQ_TEST               0x0400      /* Interrupt request, no CPU interaction  */
 #define MQ2_BOARD_DSP_OFFSET            0x800000    /* PC relative On board DSP regs offset   */
diff -Nru a/drivers/md/linear.c b/drivers/md/linear.c
--- a/drivers/md/linear.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/md/linear.c	Sun Feb 23 22:25:24 2003
@@ -110,9 +110,18 @@
 		goto out;
 	}
 
+	/*
+	 * This code was restructured to work around a gcc-2.95.3 internal
+	 * compiler error.  Alter it with care.
+	 */
 	{
-		sector_t sz = md_size[mdidx(mddev)];
-		unsigned round = sector_div(sz, conf->smallest->size);
+		sector_t sz;
+		unsigned round;
+		unsigned long base;
+
+		sz = md_size[mdidx(mddev)];
+		base = conf->smallest->size;
+		round = sector_div(sz, base);
 		nb_zone = conf->nr_zones = sz + (round ? 1 : 0);
 	}
 			
diff -Nru a/drivers/md/md.c b/drivers/md/md.c
--- a/drivers/md/md.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/md/md.c	Sun Feb 23 22:25:23 2003
@@ -83,21 +83,45 @@
 static struct ctl_table_header *raid_table_header;
 
 static ctl_table raid_table[] = {
-	{DEV_RAID_SPEED_LIMIT_MIN, "speed_limit_min",
-	 &sysctl_speed_limit_min, sizeof(int), 0644, NULL, &proc_dointvec},
-	{DEV_RAID_SPEED_LIMIT_MAX, "speed_limit_max",
-	 &sysctl_speed_limit_max, sizeof(int), 0644, NULL, &proc_dointvec},
-	{0}
+	{
+		.ctl_name	= DEV_RAID_SPEED_LIMIT_MIN,
+		.procname	= "speed_limit_min",
+		.data		= &sysctl_speed_limit_min,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= DEV_RAID_SPEED_LIMIT_MAX,
+		.procname	= "speed_limit_max",
+		.data		= &sysctl_speed_limit_max,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{ .ctl_name = 0 }
 };
 
 static ctl_table raid_dir_table[] = {
-	{DEV_RAID, "raid", NULL, 0, 0555, raid_table},
-	{0}
+	{
+		.ctl_name	= DEV_RAID,
+		.procname	= "raid",
+		.maxlen		= 0,
+		.mode		= 0555,
+		.child		= raid_table,
+	},
+	{ .ctl_name = 0 }
 };
 
 static ctl_table raid_root_table[] = {
-	{CTL_DEV, "dev", NULL, 0, 0555, raid_dir_table},
-	{0}
+	{
+		.ctl_name	= CTL_DEV,
+		.procname	= "dev",
+		.maxlen		= 0,
+		.mode		= 0555,
+		.proc_handler	= raid_dir_table,
+	},
+	{ .ctl_name = 0 }
 };
 
 static void md_recover_arrays(void);
@@ -209,6 +233,11 @@
 	return down_interruptible(&mddev->reconfig_sem);
 }
 
+static inline void mddev_lock_uninterruptible(mddev_t * mddev)
+{
+	down(&mddev->reconfig_sem);
+}
+
 static inline int mddev_trylock(mddev_t * mddev)
 {
 	return down_trylock(&mddev->reconfig_sem);
@@ -700,7 +729,7 @@
 		if (rdev2->raid_disk >= 0)
 			d->raid_disk = rdev2->raid_disk;
 		else
-			d->raid_disk = rdev2->desc_nr; /* compatability */
+			d->raid_disk = rdev2->desc_nr; /* compatibility */
 		if (rdev2->faulty) {
 			d->state = (1<<MD_DISK_FAULTY);
 			failed++;
@@ -1050,8 +1079,8 @@
 	if (!mddev->persistent)
 		return;
 
-	printk(KERN_INFO "md: updating md%d RAID superblock on device\n",
-					mdidx(mddev));
+	printk(KERN_INFO "md: updating md%d RAID superblock on device (in sync %d)\n",
+					mdidx(mddev),mddev->in_sync);
 
 	err = 0;
 	ITERATE_RDEV(mddev,rdev,tmp) {
@@ -1490,6 +1519,8 @@
 		mddev->pers = NULL;
 		return -EINVAL;
 	}
+ 	atomic_set(&mddev->writes_pending,0);
+	mddev->safemode = 0;
 	if (mddev->pers->sync_request)
 		mddev->in_sync = 0;
 	else
@@ -1521,6 +1552,7 @@
 		if (!mddev->ro)
 			goto out;
 
+		mddev->safemode = 0;
 		mddev->in_sync = 0;
 		md_update_sb(mddev);
 		mddev->ro = 0;
@@ -1925,7 +1957,7 @@
 		if (!list_empty(&mddev->disks)) {
 			mdk_rdev_t *rdev0 = list_entry(mddev->disks.next,
 							mdk_rdev_t, same_set);
-			int err = super_90_load(rdev, NULL);
+			int err = super_90_load(rdev, rdev0);
 			if (err < 0) {
 				printk(KERN_WARNING "md: %s has different UUID to %s\n",
 				       bdev_partition_name(rdev->bdev), bdev_partition_name(rdev0->bdev));
@@ -2794,6 +2826,48 @@
 }
 
 
+void md_write_start(mddev_t *mddev)
+{
+	if (mddev->safemode && !atomic_read(&mddev->writes_pending)) {
+		mddev_lock_uninterruptible(mddev);
+		atomic_inc(&mddev->writes_pending);
+		if (mddev->in_sync) {
+			mddev->in_sync = 0;
+			md_update_sb(mddev);
+		}
+		mddev_unlock(mddev);
+	} else
+		atomic_inc(&mddev->writes_pending);
+}
+
+void md_write_end(mddev_t *mddev, mdk_thread_t *thread)
+{
+	if (atomic_dec_and_test(&mddev->writes_pending) && mddev->safemode)
+		md_wakeup_thread(thread);
+}
+static inline void md_enter_safemode(mddev_t *mddev)
+{
+
+	mddev_lock_uninterruptible(mddev);
+	if (mddev->safemode && !atomic_read(&mddev->writes_pending) && !mddev->in_sync && !mddev->recovery_running) {
+		mddev->in_sync = 1;
+		md_update_sb(mddev);
+	}
+	mddev_unlock(mddev);
+}
+
+void md_handle_safemode(mddev_t *mddev)
+{
+	if (signal_pending(current)) {
+		printk(KERN_INFO "md: md%d in safe mode\n",mdidx(mddev));
+		mddev->safemode= 1;
+		flush_curr_signals();
+	}
+	if (mddev->safemode)
+		md_enter_safemode(mddev);
+}
+
+
 DECLARE_WAIT_QUEUE_HEAD(resync_wait);
 
 #define SYNC_MARKS	10
@@ -2971,6 +3045,8 @@
 		mddev->recovery_running = 0;
 	if (mddev->recovery_running == 0)
 		mddev->recovery_cp = MaxSector;
+	if (mddev->safemode)
+		md_enter_safemode(mddev);
 	md_recover_arrays();
 }
 
@@ -3246,6 +3322,9 @@
 EXPORT_SYMBOL(md_error);
 EXPORT_SYMBOL(md_sync_acct);
 EXPORT_SYMBOL(md_done_sync);
+EXPORT_SYMBOL(md_write_start);
+EXPORT_SYMBOL(md_write_end);
+EXPORT_SYMBOL(md_handle_safemode);
 EXPORT_SYMBOL(md_register_thread);
 EXPORT_SYMBOL(md_unregister_thread);
 EXPORT_SYMBOL(md_wakeup_thread);
diff -Nru a/drivers/md/multipath.c b/drivers/md/multipath.c
--- a/drivers/md/multipath.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/md/multipath.c	Sun Feb 23 22:25:24 2003
@@ -283,6 +283,7 @@
 			p->rdev = rdev;
 			conf->working_disks++;
 			rdev->raid_disk = path;
+			rdev->in_sync = 1;
 			found = 1;
 		}
 	spin_unlock_irq(&conf->device_lock);
diff -Nru a/drivers/md/raid1.c b/drivers/md/raid1.c
--- a/drivers/md/raid1.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/md/raid1.c	Sun Feb 23 22:25:24 2003
@@ -319,8 +319,10 @@
 		 * Let's see if all mirrored write operations have finished
 		 * already.
 		 */
-		if (atomic_dec_and_test(&r1_bio->remaining))
+		if (atomic_dec_and_test(&r1_bio->remaining)) {
+			md_write_end(r1_bio->mddev,conf->thread);
 			raid_end_bio_io(r1_bio, uptodate);
+		}	
 	}
 	atomic_dec(&conf->mirrors[mirror].rdev->nr_pending);
 	return 0;
@@ -540,6 +542,7 @@
 		 * If all mirrors are non-operational
 		 * then return an IO error:
 		 */
+		md_write_end(mddev,conf->thread);
 		raid_end_bio_io(r1_bio, 0);
 		return 0;
 	}
@@ -555,6 +558,8 @@
 	 * do end_request by hand if all requests finish until we had a
 	 * chance to set up the semaphore correctly ... lots of races).
 	 */
+
+	md_write_start(mddev);
 	for (i=disks; i--; ) {
 		struct bio *mbio;
 		mbio = r1_bio->write_bios[i];
@@ -902,10 +907,11 @@
 	struct bio *bio;
 	unsigned long flags;
 	mddev_t *mddev;
-	conf_t *conf;
+	conf_t *conf = data;
 	mdk_rdev_t *rdev;
 
-
+	md_handle_safemode(conf->mddev);
+	
 	for (;;) {
 		spin_lock_irqsave(&retry_list_lock, flags);
 		if (list_empty(head))
@@ -1184,9 +1190,9 @@
 
 
 	{
-		const char * name = "raid1d";
+		snprintf(conf->thread_name,MD_THREAD_NAME_MAX,"raid1d_md%d",mdidx(mddev));
 
-		conf->thread = md_register_thread(raid1d, conf, name);
+		conf->thread = md_register_thread(raid1d, conf, conf->thread_name);
 		if (!conf->thread) {
 			printk(THREAD_ERROR, mdidx(mddev));
 			goto out_free_conf;
diff -Nru a/drivers/md/raid5.c b/drivers/md/raid5.c
--- a/drivers/md/raid5.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/md/raid5.c	Sun Feb 23 22:25:22 2003
@@ -913,6 +913,7 @@
 				struct bio *nextbi = bi->bi_next;
 				clear_bit(BIO_UPTODATE, &bi->bi_flags);
 				if (--bi->bi_phys_segments == 0) {
+					md_write_end(conf->mddev, conf->thread);
 					bi->bi_next = return_bi;
 					return_bi = bi;
 				}
@@ -963,16 +964,19 @@
 			/* We can return any write requests */
 			    struct bio *wbi, *wbi2;
 			    PRINTK("Return write for disc %d\n", i);
+			    spin_lock_irq(&conf->device_lock);
 			    wbi = dev->written;
 			    dev->written = NULL;
 			    while (wbi && wbi->bi_sector < dev->sector + STRIPE_SECTORS) {
 				    wbi2 = wbi->bi_next;
 				    if (--wbi->bi_phys_segments == 0) {
+					    md_write_end(conf->mddev, conf->thread);
 					    wbi->bi_next = return_bi;
 					    return_bi = wbi;
 				    }
 				    wbi = wbi2;
 			    }
+			    spin_unlock_irq(&conf->device_lock);
 		    }
 		}
 	}
@@ -1275,6 +1279,8 @@
 
 	bi->bi_next = NULL;
 	bi->bi_phys_segments = 1;	/* over-loaded to count active stripes */
+	if ( bio_data_dir(bi) == WRITE )
+		md_write_start(mddev);
 	for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) {
 		
 		new_sector = raid5_compute_sector(logical_sector,
@@ -1297,6 +1303,8 @@
 	if (--bi->bi_phys_segments == 0) {
 		int bytes = bi->bi_size;
 
+		if ( bio_data_dir(bi) == WRITE )
+			md_write_end(mddev,conf->thread);
 		bi->bi_size = 0;
 		bi->bi_end_io(bi, bytes, 0);
 	}
@@ -1357,6 +1365,7 @@
 
 	PRINTK("+++ raid5d active\n");
 
+	md_handle_safemode(mddev);
 	handled = 0;
 	spin_lock_irq(&conf->device_lock);
 	while (1) {
@@ -1477,9 +1486,9 @@
 	}
 
 	{
-		const char * name = "raid5d";
+		snprintf(conf->thread_name,MD_THREAD_NAME_MAX,"raid5d_md%d",mdidx(mddev));
 
-		conf->thread = md_register_thread(raid5d, conf, name);
+		conf->thread = md_register_thread(raid5d, conf, conf->thread_name);
 		if (!conf->thread) {
 			printk(KERN_ERR "raid5: couldn't allocate thread for md%d\n", mdidx(mddev));
 			goto abort;
diff -Nru a/drivers/media/dvb/av7110/saa7146_core.c b/drivers/media/dvb/av7110/saa7146_core.c
--- a/drivers/media/dvb/av7110/saa7146_core.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/media/dvb/av7110/saa7146_core.c	Sun Feb 23 22:25:25 2003
@@ -494,7 +494,7 @@
 
 	saa->revision = (rev & 0xf);
 
-	/* remap the memory from virtual to physical adress */
+	/* remap the memory from virtual to physical address */
 	saa->mem = ioremap ((saa->device->resource[0].start)
 			    &PCI_BASE_ADDRESS_MEM_MASK, 0x1000);
 
diff -Nru a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
--- a/drivers/media/radio/radio-cadet.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/media/radio/radio-cadet.c	Sun Feb 23 22:25:24 2003
@@ -1,4 +1,4 @@
-/* radio-cadet.c - A video4linux driver for the ADS Cadet AM/FM Radio Card 
+/* radio-cadet.c - A video4linux driver for the ADS Cadet AM/FM Radio Card
  *
  * by Fred Gleason <fredg@wava.com>
  * Version 0.3.3
@@ -20,6 +20,9 @@
  *		Removed dead CONFIG_RADIO_CADET_PORT code
  *		PnP detection on load is now default (no args necessary)
  *
+ * 2002-01-17	Adam Belay <ambx1@neo.rr.com>
+ *		Updated to latest pnp code
+ *
 */
 
 #include <linux/module.h>	/* Modules 			*/
@@ -30,7 +33,7 @@
 #include <asm/uaccess.h>	/* copy to/from user		*/
 #include <linux/videodev.h>	/* kernel radio structs		*/
 #include <linux/param.h>
-#include <linux/isapnp.h>
+#include <linux/pnp.h>
 
 #define RDS_BUFFER 256
 
@@ -47,8 +50,6 @@
 static int cadet_lock=0;
 
 static int cadet_probe(void);
-static struct pnp_dev *dev = NULL;
-static int isapnp_cadet_probe(void);
 
 /*
  * Signal Strength Threshold Values
@@ -152,7 +153,7 @@
          */
         outb(curvol,io+1);
 	cadet_lock--;
-	
+
 	return fifo;
 }
 
@@ -541,22 +542,23 @@
 	.fops           = &cadet_fops,
 };
 
-static int isapnp_cadet_probe(void)
-{
-	dev = pnp_find_dev (NULL, ISAPNP_VENDOR('M','S','M'),
-			    ISAPNP_FUNCTION(0x0c24), NULL);
+static struct pnp_device_id cadet_pnp_devices[] = {
+	/* ADS Cadet AM/FM Radio Card */
+	{.id = "MSM0c24", .driver_data = 0},
+	{.id = ""}
+};
 
+MODULE_DEVICE_TABLE(pnp, id_table);
+
+static int cadet_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
+{
 	if (!dev)
 		return -ENODEV;
-	if (pnp_device_attach(dev) < 0)
-		return -EAGAIN;
-	if (pnp_activate_dev(dev, NULL) < 0) {
-		printk ("radio-cadet: pnp configure failed (out of resources?)\n");
-		pnp_device_detach(dev);
-		return -EIO;
-	}
+	/* only support one device */
+	if (io > 0)
+		return -EBUSY;
+
 	if (!pnp_port_valid(dev, 0)) {
-		pnp_device_detach(dev);
 		return -ENODEV;
 	}
 
@@ -567,6 +569,13 @@
 	return io;
 }
 
+static struct pnp_driver cadet_pnp_driver = {
+	.name		= "radio-cadet",
+	.id_table	= cadet_pnp_devices,
+	.probe		= cadet_pnp_probe,
+	.remove		= NULL,
+};
+
 static int cadet_probe(void)
 {
         static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e};
@@ -597,7 +606,7 @@
 	 *	If a probe was requested then probe ISAPnP first (safest)
 	 */
 	if (io < 0)
-		io = isapnp_cadet_probe();
+		pnp_register_driver(&cadet_pnp_driver);
 	/*
 	 *	If that fails then probe unsafely if probe is requested
 	 */
@@ -612,16 +621,19 @@
 #ifdef MODULE        
 		printk(KERN_ERR "You must set an I/O address with io=0x???\n");
 #endif
-	        return -EINVAL;
+	        goto fail;
 	}
 	if (!request_region(io,2,"cadet"))
-		return -EBUSY;
+		goto fail;
 	if(video_register_device(&cadet_radio,VFL_TYPE_RADIO,radio_nr)==-1) {
 		release_region(io,2);
-		return -EINVAL;
+		goto fail;
 	}
 	printk(KERN_INFO "ADS Cadet Radio Card at 0x%x\n",io);
 	return 0;
+fail:
+	pnp_unregister_driver(&cadet_pnp_driver);
+	return -1;
 }
 
 
@@ -634,21 +646,11 @@
 MODULE_PARM_DESC(io, "I/O address of Cadet card (0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e)");
 MODULE_PARM(radio_nr, "i");
 
-static struct isapnp_device_id id_table[] __devinitdata = {
-	{ 	ISAPNP_ANY_ID, ISAPNP_ANY_ID,
-		ISAPNP_VENDOR('M','S','M'), ISAPNP_FUNCTION(0x0c24), 0 },
-	{0}
-};
-
-MODULE_DEVICE_TABLE(isapnp, id_table);
-
 static void __exit cadet_cleanup_module(void)
 {
 	video_unregister_device(&cadet_radio);
 	release_region(io,2);
-
-	if (dev)
-		pnp_device_detach(dev);
+	pnp_unregister_driver(&cadet_pnp_driver);
 }
 
 module_init(cadet_init);
diff -Nru a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c
--- a/drivers/media/video/bt832.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/media/video/bt832.c	Sun Feb 23 22:25:25 2003
@@ -1,5 +1,5 @@
 /* Driver for Bt832 CMOS Camera Video Processor
-    i2c-adresses: 0x88 or 0x8a
+    i2c-addresses: 0x88 or 0x8a
 
   The BT832 interfaces to a Quartzsight Digital Camera (352x288, 25 or 30 fps)
   via a 9 pin connector ( 4-wire SDATA, 2-wire i2c, SCLK, VCC, GND).
diff -Nru a/drivers/media/video/bt832.h b/drivers/media/video/bt832.h
--- a/drivers/media/video/bt832.h	Sun Feb 23 22:25:25 2003
+++ b/drivers/media/video/bt832.h	Sun Feb 23 22:25:25 2003
@@ -4,7 +4,7 @@
   color digital camera directly to video capture devices via an 8-bit,
   4:2:2 YUV or YCrCb video interface.
 
- i2c adresses: 0x88 or 0x8a
+ i2c addresses: 0x88 or 0x8a
  */
 
 /* The 64 registers: */
diff -Nru a/drivers/media/video/meye.c b/drivers/media/video/meye.c
--- a/drivers/media/video/meye.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/media/video/meye.c	Sun Feb 23 22:25:25 2003
@@ -1,7 +1,7 @@
 /* 
  * Motion Eye video4linux driver for Sony Vaio PictureBook
  *
- * Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
+ * Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
  *
  * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
  *
@@ -1225,6 +1225,42 @@
 	.fops		= &meye_fops,
 };
 
+#ifdef CONFIG_PM
+static int meye_suspend(struct pci_dev *pdev, u32 state)
+{
+	pci_save_state(pdev, meye.pm_state);
+	meye.pm_mchip_mode = meye.mchip_mode;
+	mchip_hic_stop();
+	mchip_set(MCHIP_MM_INTA, 0x0);
+	return 0;
+}
+
+static int meye_resume(struct pci_dev *pdev)
+{
+	pci_restore_state(pdev, meye.pm_state);
+	pci_write_config_word(meye.mchip_dev, MCHIP_PCI_SOFTRESET_SET, 1);
+
+	mchip_delay(MCHIP_HIC_CMD, 0);
+	mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE);
+	wait_ms(1);
+	mchip_set(MCHIP_VRJ_SOFT_RESET, 1);
+	wait_ms(1);
+	mchip_set(MCHIP_MM_PCI_MODE, 5);
+	wait_ms(1);
+	mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK);
+
+	switch (meye.pm_mchip_mode) {
+	case MCHIP_HIC_MODE_CONT_OUT:
+		mchip_continuous_start();
+		break;
+	case MCHIP_HIC_MODE_CONT_COMP:
+		mchip_cont_compression_start();
+		break;
+	}
+	return 0;
+}
+#endif
+
 static int __devinit meye_probe(struct pci_dev *pcidev, 
 		                const struct pci_device_id *ent) {
 	int ret;
@@ -1391,6 +1427,10 @@
 	.id_table	= meye_pci_tbl,
 	.probe		= meye_probe,
 	.remove		= __devexit_p(meye_remove),
+#ifdef CONFIG_PM
+	.suspend	= meye_suspend,
+	.resume		= meye_resume,
+#endif
 };
 
 static int __init meye_init_module(void) {
diff -Nru a/drivers/media/video/meye.h b/drivers/media/video/meye.h
--- a/drivers/media/video/meye.h	Sun Feb 23 22:25:24 2003
+++ b/drivers/media/video/meye.h	Sun Feb 23 22:25:24 2003
@@ -1,7 +1,7 @@
 /* 
  * Motion Eye video4linux driver for Sony Vaio PictureBook
  *
- * Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
+ * Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
  *
  * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
  *
@@ -31,7 +31,13 @@
 #define _MEYE_PRIV_H_
 
 #define MEYE_DRIVER_MAJORVERSION	1
-#define MEYE_DRIVER_MINORVERSION	5
+#define MEYE_DRIVER_MINORVERSION	6
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/pci.h>
+#include <linux/sonypi.h>
+#include <linux/meye.h>
 
 /****************************************************************************/
 /* Motion JPEG chip registers                                               */
@@ -309,6 +315,10 @@
 	struct video_device video_dev;	/* video device parameters */
 	struct video_picture picture;	/* video picture parameters */
 	struct meye_params params;	/* additional parameters */
+#ifdef CONFIG_PM
+	u32 pm_state[16];		/* PCI configuration space */
+	u8 pm_mchip_mode;		/* old mchip mode */
+#endif
 };
 
 #endif
diff -Nru a/drivers/message/fusion/isense.c b/drivers/message/fusion/isense.c
--- a/drivers/message/fusion/isense.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/message/fusion/isense.c	Sun Feb 23 22:25:24 2003
@@ -89,9 +89,9 @@
 #define my_VERSION	MPT_LINUX_VERSION_COMMON
 #define MYNAM		"isense"
 
-EXPORT_NO_SYMBOLS;
 MODULE_AUTHOR(MODULEAUTHOR);
 MODULE_DESCRIPTION(my_NAME);
+MODULE_LICENSE("GPL");
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 int __init isense_init(void)
diff -Nru a/drivers/message/fusion/linux_compat.h b/drivers/message/fusion/linux_compat.h
--- a/drivers/message/fusion/linux_compat.h	Sun Feb 23 22:25:23 2003
+++ b/drivers/message/fusion/linux_compat.h	Sun Feb 23 22:25:23 2003
@@ -270,6 +270,13 @@
 #define mptscsih_sync_irq(_irq) synchronize_irq()
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,58)
+#define mpt_inc_use_count()
+#define mpt_dec_use_count()
+#else
+#define mpt_inc_use_count() MOD_INC_USE_COUNT
+#define mpt_dec_use_count() MOD_DEC_USE_COUNT
+#endif
 
 
 /*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
diff -Nru a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
--- a/drivers/message/fusion/mptbase.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/message/fusion/mptbase.c	Sun Feb 23 22:25:22 2003
@@ -49,7 +49,7 @@
  *  (mailto:sjralston1@netscape.net)
  *  (mailto:Pam.Delaney@lsil.com)
  *
- *  $Id: mptbase.c,v 1.125 2002/12/03 21:26:32 pdelaney Exp $
+ *  $Id: mptbase.c,v 1.126 2002/12/16 15:28:45 pdelaney Exp $
  */
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
@@ -123,8 +123,10 @@
 /*
  *  cmd line parameters
  */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,59)
 MODULE_PARM(PortIo, "0-1i");
 MODULE_PARM_DESC(PortIo, "[0]=Use mmap, 1=Use port io");
+#endif
 static int PortIo = 0;
 
 #ifdef MFCNT
@@ -580,8 +582,6 @@
 		dcprintk((MYIOC_s_INFO_FMT "config_complete (mf=%p,mr=%p)\n",
 				ioc->name, mf, reply));
 
-		DBG_DUMP_REPLY_FRAME(reply)
-
 		pCfg = * ((CONFIGPARMS **)((u8 *) mf + ioc->req_sz - sizeof(void *)));
 
 		if (pCfg) {
@@ -686,7 +686,7 @@
 			MptEvHandlers[i] = NULL;
 			last_drv_idx = i;
 			if (cbfunc != mpt_base_reply) {
-				MOD_INC_USE_COUNT;
+				mpt_inc_use_count();
 			}
 			break;
 		}
@@ -706,7 +706,7 @@
 void
 mpt_deregister(int cb_idx)
 {
-	if (cb_idx && (cb_idx < MPT_MAX_PROTOCOL_DRIVERS)) {
+	if ((cb_idx >= 0) && (cb_idx < MPT_MAX_PROTOCOL_DRIVERS)) {
 		MptCallbacks[cb_idx] = NULL;
 		MptDriverClass[cb_idx] = MPTUNKNOWN_DRIVER;
 		MptEvHandlers[cb_idx] = NULL;
@@ -716,7 +716,7 @@
 			isense_idx++;
 
 		if (cb_idx != mpt_base_index) {
-			MOD_DEC_USE_COUNT;
+			mpt_dec_use_count();
 		}
 	}
 }
@@ -2107,9 +2107,7 @@
 	 *  Loop here waiting for IOC to come READY.
 	 */
 	ii = 0;
-	cntdn = HZ * 15;
-	if (sleepFlag != CAN_SLEEP)
-		cntdn *= 10;	/* 1500 iterations @ 1msec per */
+	cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 15;	/* 15 seconds */
 
 	while ((ioc_state = mpt_GetIocState(ioc, 1)) != MPI_IOC_STATE_READY) {
 		if (ioc_state == MPI_IOC_STATE_OPERATIONAL) {
@@ -2483,9 +2481,7 @@
 	 *  LoopInit and TargetDiscovery!
 	 */
 	count = 0;
-	cntdn = HZ * 60;					/* chg'd from 30 to 60 seconds */
-	if (sleepFlag != CAN_SLEEP)
-		cntdn *= 10;					/* scale for 1msec delays */
+	cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 60;	/* 60 seconds */
 	state = mpt_GetIocState(ioc, 1);
 	while (state != MPI_IOC_STATE_OPERATIONAL && --cntdn) {
 		if (sleepFlag == CAN_SLEEP) {
@@ -3478,10 +3474,8 @@
 
 	/* FW ACK'd request, wait for READY state
 	 */
-	cntdn = HZ * 15;
 	count = 0;
-	if (sleepFlag != CAN_SLEEP)
-		cntdn *= 10;	/* 1500 iterations @ 1msec per */
+	cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 15;	/* 15 seconds */
 
 	while ((state = mpt_GetIocState(ioc, 1)) != MPI_IOC_STATE_READY) {
 		cntdn--;
@@ -3640,9 +3634,6 @@
 	}
 	spin_unlock_irqrestore(&ioc->FreeQlock, flags);
 
-#ifdef MFCNT
-	ioc->mfcnt = 0;
-#endif
 
 	if (ioc->sense_buf_pool == NULL) {
 		sz = (ioc->req_depth * MPT_SENSE_BUFFER_ALLOC);
@@ -3822,10 +3813,12 @@
 static int
 WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
 {
-	int cntdn = HZ * howlong;
+	int cntdn;
 	int count = 0;
 	u32 intstat;
 
+	cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * howlong;
+
 	if (sleepFlag == CAN_SLEEP) {
 		while (--cntdn) {
 			intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
@@ -3836,7 +3829,6 @@
 			count++;
 		}
 	} else {
-		cntdn *= 10; /* convert to msec */
 		while (--cntdn) {
 			intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
 			if (! (intstat & MPI_HIS_IOP_DOORBELL_STATUS))
@@ -3844,7 +3836,6 @@
 			mdelay (1);
 			count++;
 		}
-		count /= 10;
 	}
 
 	if (cntdn) {
@@ -3873,10 +3864,11 @@
 static int
 WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
 {
-	int cntdn = HZ * howlong;
+	int cntdn;
 	int count = 0;
 	u32 intstat;
 
+	cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * howlong;
 	if (sleepFlag == CAN_SLEEP) {
 		while (--cntdn) {
 			intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
@@ -3887,7 +3879,6 @@
 			count++;
 		}
 	} else {
-		cntdn *= 10; /* convert to msec */
 		while (--cntdn) {
 			intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
 			if (intstat & MPI_HIS_DOORBELL_INTERRUPT)
@@ -3895,7 +3886,6 @@
 			mdelay(1);
 			count++;
 		}
-		count /= 10;
 	}
 
 	if (cntdn) {
@@ -4953,7 +4943,6 @@
 		/* Search the configQ for internal commands.
 		 * Flush the Q, and wake up all suspended threads.
 		 */
-#if 1
 		spin_lock_irqsave(&ioc->FreeQlock, flags);
 		if (! Q_IS_EMPTY(&ioc->configQ)){
 			pCfg = (CONFIGPARMS *)ioc->configQ.head;
@@ -4970,23 +4959,6 @@
 			} while (pCfg != (CONFIGPARMS *)&ioc->configQ);
 		}
 		spin_unlock_irqrestore(&ioc->FreeQlock, flags);
-#else
-		while (1) {
-			spin_lock_irqsave(&ioc->FreeQlock, flags);
-			if (! Q_IS_EMPTY(&ioc->configQ)){
-				spin_unlock_irqrestore(&ioc->FreeQlock, flags);
-				break;
-			}
-			pCfg = (CONFIGPARMS *)ioc->configQ.head;
-
-			Q_DEL_ITEM(&pCfg->linkage);
-			spin_unlock_irqrestore(&ioc->FreeQlock, flags);
-
-			pCfg->status = MPT_CONFIG_ERROR;
-			pCfg->wait_done = 1;
-			wake_up(&mpt_waitq);
-		}
-#endif
 	}
 
 	return 1;		/* currently means nothing really */
@@ -5845,7 +5817,7 @@
 		isense_idx = last_drv_idx;
 		r = 1;
 	}
-	MOD_INC_USE_COUNT;
+	mpt_inc_use_count();
 	return r;
 }
 
@@ -5864,7 +5836,7 @@
 	mpt_ScsiOpcodesPtr = NULL;
 	printk(KERN_INFO MYNAM ": English readable SCSI-3 strings disabled)-:\n");
 	isense_idx = -1;
-	MOD_DEC_USE_COUNT;
+	mpt_dec_use_count();
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
diff -Nru a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
--- a/drivers/message/fusion/mptbase.h	Sun Feb 23 22:25:22 2003
+++ b/drivers/message/fusion/mptbase.h	Sun Feb 23 22:25:22 2003
@@ -13,7 +13,7 @@
  *  (mailto:sjralston1@netscape.net)
  *  (mailto:Pam.Delaney@lsil.com)
  *
- *  $Id: mptbase.h,v 1.141 2002/12/03 21:26:32 pdelaney Exp $
+ *  $Id: mptbase.h,v 1.144 2003/01/28 21:31:56 pdelaney Exp $
  */
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
@@ -80,8 +80,8 @@
 #define COPYRIGHT	"Copyright (c) 1999-2002 " MODULEAUTHOR
 #endif
 
-#define MPT_LINUX_VERSION_COMMON	"2.03.01.01"
-#define MPT_LINUX_PACKAGE_NAME		"@(#)mptlinux-2.03.01.01"
+#define MPT_LINUX_VERSION_COMMON	"2.05.00.03"
+#define MPT_LINUX_PACKAGE_NAME		"@(#)mptlinux-2.05.00.03"
 #define WHAT_MAGIC_STRING		"@" "(" "#" ")"
 
 #define show_mptmod_ver(s,ver)  \
@@ -383,12 +383,9 @@
 	u8			 maxWidth;	/* 0 if narrow, 1 if wide*/
 	u8			 negoFlags;	/* bit field, 0 if WDTR/SDTR/QAS allowed */
 	u8			 raidVolume;	/* set, if RAID Volume */
-#ifdef ABORT_FIX
-	u8			 numAborts;
-#else
-	u8			 rsvd;
-#endif
-	u16			 rsvd1raid;
+	u8			 type;		/* byte 0 of Inquiry data */
+	u8			 cflags;	/* controller flags */
+	u8			 rsvd1raid;
 	int			 npaths;
 	u16			 fc_phys_lun;
 	u16			 fc_xlat_lun;
@@ -400,11 +397,8 @@
 	ScsiCmndTracker		 WaitQ;
 	ScsiCmndTracker		 SentQ;
 	ScsiCmndTracker		 DoneQ;
+	u32			 num_luns;
 //--- LUN split here?
-#ifdef MPT_SAVE_AUTOSENSE
-	u8			 sense[SCSI_STD_SENSE_BYTES];		/* 18 */
-	u8			 rsvd2[2];	/* alignment */
-#endif
 	u32			 luns;		/* Max LUNs is 32 */
 	u8			 inq_data[SCSI_STD_INQUIRY_BYTES];	/* 36 */
 	u8			 pad0[4];
@@ -428,13 +422,15 @@
  *  Fibre Channel (SCSI) target device and associated defines...
  */
 #define MPT_TARGET_DEFAULT_DV_STATUS	0
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,55)
+#define MPT_TARGET_FLAGS_CONFIGURED	0x02
+#define MPT_TARGET_FLAGS_Q_YES		0x08
+#else
 #define MPT_TARGET_FLAGS_VALID_NEGO	0x01
 #define MPT_TARGET_FLAGS_VALID_INQUIRY	0x02
-#ifdef MPT_SAVE_AUTOSENSE
-#define MPT_TARGET_FLAGS_VALID_SENSE	0x04
-#endif
 #define MPT_TARGET_FLAGS_Q_YES		0x08
 #define MPT_TARGET_FLAGS_VALID_56	0x10
+#endif
 
 #define MPT_TARGET_NO_NEGO_WIDE		0x01
 #define MPT_TARGET_NO_NEGO_SYNC		0x02
@@ -603,7 +599,7 @@
 	dma_addr_t		 sense_buf_pool_dma;
 	u32			 sense_buf_low_dma;
 	int			 mtrr_reg;
-	void			*pcidev;	/* struct pci_dev pointer */
+	struct pci_dev		*pcidev;	/* struct pci_dev pointer */
 	u8			*memmap;	/* mmap address */
 	struct Scsi_Host	*sh;		/* Scsi Host pointer */
 	ScsiCfgData		spi_data;	/* Scsi config. data */
@@ -764,6 +760,13 @@
 #define dcprintk(x)
 #endif
 
+#if defined(MPT_DEBUG_SCSI) || defined(MPT_DEBUG) || defined(MPT_DEBUG_MSG_FRAME)
+#define dsprintk(x) printk x
+#else
+#define dsprintk(x)
+#endif
+
+
 #define MPT_INDEX_2_MFPTR(ioc,idx) \
 	(MPT_FRAME_HDR*)( (u8*)(ioc)->req_frames + (ioc)->req_sz * (idx) )
 
@@ -1050,7 +1053,7 @@
 #define offsetof(t, m)	((size_t) (&((t *)0)->m))
 #endif
 
-#if defined(__alpha__) || defined(__sparc_v9__) || defined(__ia64__)
+#if defined(__alpha__) || defined(__sparc_v9__) || defined(__ia64__) || defined(__x86_64__)
 #define CAST_U32_TO_PTR(x)	((void *)(u64)x)
 #define CAST_PTR_TO_U32(x)	((u32)(u64)x)
 #else
diff -Nru a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
--- a/drivers/message/fusion/mptctl.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/message/fusion/mptctl.c	Sun Feb 23 22:25:21 2003
@@ -102,7 +102,9 @@
 #define my_VERSION	MPT_LINUX_VERSION_COMMON
 #define MYNAM		"mptctl"
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,62)
 EXPORT_NO_SYMBOLS;
+#endif
 MODULE_AUTHOR(MODULEAUTHOR);
 MODULE_DESCRIPTION(my_NAME);
 MODULE_LICENSE("GPL");
@@ -136,7 +138,7 @@
 static int mptctl_replace_fw (unsigned long arg);
 
 static int mptctl_do_reset(unsigned long arg);
-static int mptctl_hp_hostinfo(unsigned long arg);
+static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd);
 static int mptctl_hp_targetinfo(unsigned long arg);
 
 /*
@@ -659,25 +661,19 @@
 
 	dctlprintk((MYIOC_s_INFO_FMT ": mptctl_ioctl()\n", iocp->name));
 
-	switch(cmd) {
-	case MPTFWDOWNLOAD:
+	if (cmd == MPTFWDOWNLOAD)
 		ret = mptctl_fw_download(arg);
-		break;
-	case MPTCOMMAND:
+	else if (cmd == MPTCOMMAND)
 		ret = mptctl_mpt_command(arg);
-		break;
-	case MPTHARDRESET:
+	else if (cmd == MPTHARDRESET)
 		ret = mptctl_do_reset(arg);
-		break;
-	case HP_GETHOSTINFO:
-		ret = mptctl_hp_hostinfo(arg);
-		break;
-	case HP_GETTARGETINFO:
+	else if ((cmd & ~IOCSIZE_MASK) == (HP_GETHOSTINFO & ~IOCSIZE_MASK))
+		ret = mptctl_hp_hostinfo(arg, _IOC_SIZE(cmd));
+	else if (cmd == HP_GETTARGETINFO)
 		ret = mptctl_hp_targetinfo(arg);
-		break;
-	default:
+	else
 		ret = -EINVAL;
-	}
+
 
 	up(&mptctl_syscall_sem_ioc[iocp->id]);
 
@@ -874,7 +870,7 @@
 	 *	96		8
 	 *	64		4
 	 */
-	maxfrags = (iocp->req_sz - sizeof(MPIHeader_t) - sizeof(FWDownloadTCSGE_t)) 
+	maxfrags = (iocp->req_sz - sizeof(MPIHeader_t) - sizeof(FWDownloadTCSGE_t))
 			/ (sizeof(dma_addr_t) + sizeof(u32));
 	if (numfrags > maxfrags) {
 		ret = -EMLINK;
@@ -1228,10 +1224,16 @@
 	u8			revision;
 
 	dctlprintk((": mptctl_getiocinfo called.\n"));
-	if (data_size == sizeof(struct mpt_ioctl_iocinfo))
-		cim_rev = 1;
-	else if (data_size == (sizeof(struct mpt_ioctl_iocinfo) - sizeof(struct mpt_ioctl_pci_info)))
+	/* Add of PCI INFO results in unaligned access for
+	 * IA64 and Sparc. Reset long to int. Return no PCI
+	 * data for obsolete format.
+	 */
+	if (data_size == sizeof(struct mpt_ioctl_iocinfo_rev0))
 		cim_rev = 0;
+	else if (data_size == sizeof(struct mpt_ioctl_iocinfo))
+		cim_rev = 1;
+	else if (data_size == (sizeof(struct mpt_ioctl_iocinfo_rev0)+12))
+		cim_rev = 0;	/* obsolete */
 	else
 		return -EFAULT;
 
@@ -1415,7 +1417,7 @@
 
 	/* Get number of devices
          */
-	if ( (sh = ioc->sh) != NULL) {
+	if ((sh = ioc->sh) != NULL) {
 
 		max_id = sh->max_id - 1;
 		hd = (MPT_SCSI_HOST *) sh->hostdata;
@@ -1438,9 +1440,8 @@
 
 							pdata++;
 
-							if (maxWordsLeft <= 0) {
+							if (maxWordsLeft <= 0)
 								break;
-							}
 						}
 					}
 				}
@@ -1713,7 +1714,7 @@
 	/* Allocate memory for the new FW image
 	 */
 	newFwSize = karg.newImageSize;
-	fwmem = mpt_alloc_fw_memory(ioc, newFwSize, &num_frags, &alloc_sz); 
+	fwmem = mpt_alloc_fw_memory(ioc, newFwSize, &num_frags, &alloc_sz);
 	if (fwmem == NULL)
 		return -ENOMEM;
 
@@ -1733,7 +1734,7 @@
 	}
 
 
-	/* Free the old FW image 
+	/* Free the old FW image
 	 */
 	if (ioc->cached_fw) {
 		mpt_free_fw_memory(ioc, 0);
@@ -1906,6 +1907,7 @@
 	case MPI_FUNCTION_FW_UPLOAD:
 	case MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR:
 	case MPI_FUNCTION_FW_DOWNLOAD:
+	case MPI_FUNCTION_FC_PRIMITIVE_SEND:
 		break;
 
 	case MPI_FUNCTION_SCSI_IO_REQUEST:
@@ -2033,7 +2035,7 @@
 		break;
 
 	case MPI_FUNCTION_SCSI_TASK_MGMT:
-		{ 
+		{
 			MPT_SCSI_HOST *hd = NULL;
 			if ((ioc->sh == NULL) || ((hd = (MPT_SCSI_HOST *)ioc->sh->hostdata) == NULL)) {
 				printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
@@ -2066,7 +2068,7 @@
 			}
 
 			if ((pInit->Flags != 0) || (pInit->MaxDevices != ioc->facts.MaxDevices) ||
-				(pInit->MaxBuses != ioc->facts.MaxBuses) || 
+				(pInit->MaxBuses != ioc->facts.MaxBuses) ||
 				(pInit->ReplyFrameSize != cpu_to_le16(ioc->reply_sz)) ||
 				(pInit->HostMfaHighAddr != high_addr) ||
 				(pInit->SenseBufferHighAddr != sense_high)) {
@@ -2098,7 +2100,6 @@
 			MPI_FUNCTION_FC_LINK_SRVC_BUF_POST
 			MPI_FUNCTION_FC_LINK_SRVC_RSP
 			MPI_FUNCTION_FC_ABORT
-			MPI_FUNCTION_FC_PRIMITIVE_SEND
 			MPI_FUNCTION_LAN_SEND
 			MPI_FUNCTION_LAN_RECEIVE
 		 	MPI_FUNCTION_LAN_RESET
@@ -2396,7 +2397,7 @@
  *		-ENOMEM if memory allocation error
  */
 static int
-mptctl_hp_hostinfo(unsigned long arg)
+mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
 {
 	hp_host_info_t	*uarg = (hp_host_info_t *) arg;
 	MPT_ADAPTER		*ioc;
@@ -2407,9 +2408,18 @@
 	CONFIGPARMS		cfg;
 	ConfigPageHeader_t	hdr;
 	int			iocnum;
-	int			rc;
+	int			rc, cim_rev;
 
 	dctlprintk((": mptctl_hp_hostinfo called.\n"));
+	/* Reset long to int. Should affect IA64 and SPARC only
+	 */
+	if (data_size == sizeof(hp_host_info_t))
+		cim_rev = 1;
+	else if (data_size == (sizeof(hp_host_info_t) + 12))
+		cim_rev = 0;	/* obsolete */
+	else
+		return -EFAULT;
+
 	if (copy_from_user(&karg, uarg, sizeof(hp_host_info_t))) {
 		printk(KERN_ERR "%s@%d::mptctl_hp_host_info - "
 			"Unable to read in hp_host_info struct @ %p\n",
@@ -2439,7 +2449,7 @@
 	karg.bus = pdev->bus->number;
 
 	/* Save the SCSI host no. if
-	 * SCSI driver loaded 
+	 * SCSI driver loaded
 	 */
 	if (ioc->sh != NULL)
 		karg.host_no = ioc->sh->host_no;
@@ -2527,7 +2537,7 @@
 	if (ioc->sh != NULL) {
 		MPT_SCSI_HOST *hd =  (MPT_SCSI_HOST *)ioc->sh->hostdata;
 
-		if (hd) {
+		if (hd && (cim_rev == 1)) {
 			karg.hard_resets = hd->hard_resets;
 			karg.soft_resets = hd->soft_resets;
 			karg.timeouts = hd->timeouts;
@@ -2621,7 +2631,7 @@
 
 		if ((rc = mpt_config(ioc, &cfg)) == 0) {
 			np = le32_to_cpu(pg0_alloc->NegotiatedParameters);
-			karg.negotiated_width = np & MPI_SCSIDEVPAGE0_NP_WIDE ? 
+			karg.negotiated_width = np & MPI_SCSIDEVPAGE0_NP_WIDE ?
 					HP_BUS_WIDTH_16 : HP_BUS_WIDTH_8;
 
 			if (np & MPI_SCSIDEVPAGE0_NP_NEG_SYNC_OFFSET_MASK) {
@@ -2700,7 +2710,7 @@
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,51)
-#define	owner_THIS_MODULE  owner:		THIS_MODULE,
+#define	owner_THIS_MODULE  .owner = THIS_MODULE,
 #else
 #define	owner_THIS_MODULE
 #endif
@@ -2886,6 +2896,8 @@
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)		/*{*/
 	err = register_ioctl32_conversion(MPTIOCINFO, NULL);
 	if (++where && err) goto out_fail;
+	err = register_ioctl32_conversion(MPTIOCINFO1, NULL);
+	if (++where && err) goto out_fail;
 	err = register_ioctl32_conversion(MPTTARGETINFO, NULL);
 	if (++where && err) goto out_fail;
 	err = register_ioctl32_conversion(MPTTEST, NULL);
@@ -2946,6 +2958,7 @@
 	printk(KERN_ERR MYNAM ": ERROR: Failed to register ioctl32_conversion!"
 			" (%d:err=%d)\n", where, err);
 	unregister_ioctl32_conversion(MPTIOCINFO);
+	unregister_ioctl32_conversion(MPTIOCINFO1);
 	unregister_ioctl32_conversion(MPTTARGETINFO);
 	unregister_ioctl32_conversion(MPTTEST);
 	unregister_ioctl32_conversion(MPTEVENTQUERY);
diff -Nru a/drivers/message/fusion/mptctl.h b/drivers/message/fusion/mptctl.h
--- a/drivers/message/fusion/mptctl.h	Sun Feb 23 22:25:24 2003
+++ b/drivers/message/fusion/mptctl.h	Sun Feb 23 22:25:24 2003
@@ -90,6 +90,7 @@
 #endif	/*}*/
 
 #define MPTIOCINFO		_IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo)
+#define MPTIOCINFO1		_IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev0)
 #define MPTTARGETINFO		_IOWR(MPT_MAGIC_NUMBER,18,struct mpt_ioctl_targetinfo)
 #define MPTTEST			_IOWR(MPT_MAGIC_NUMBER,19,struct mpt_ioctl_test)
 #define MPTEVENTQUERY		_IOWR(MPT_MAGIC_NUMBER,21,struct mpt_ioctl_eventquery)
@@ -99,7 +100,7 @@
 #define MPTFWREPLACE		_IOWR(MPT_MAGIC_NUMBER,25,struct mpt_ioctl_replace_fw)
 
 /*
- * SPARC PLATFORM REMARK:
+ * SPARC PLATFORM REMARKS:
  * IOCTL data structures that contain pointers
  * will have different sizes in the driver and applications
  * (as the app. will not use 8-byte pointers).
@@ -107,6 +108,8 @@
  * The driver will convert data from
  * mpt_fw_xfer32 (mpt_ioctl_command32) to mpt_fw_xfer (mpt_ioctl_command)
  * internally.
+ *
+ * If data structures change size, must handle as in IOCGETINFO.
  */
 struct mpt_fw_xfer {
 	unsigned int	 iocnum;	/* IOC unit number */
@@ -154,11 +157,11 @@
 struct mpt_ioctl_pci_info {
 	union {
 		struct {
-			unsigned long  deviceNumber   :  5;
-			unsigned long  functionNumber :  3;
-			unsigned long  busNumber      : 24;
+			unsigned int  deviceNumber   :  5;
+			unsigned int  functionNumber :  3;
+			unsigned int  busNumber      : 24;
 		} bits;
-		unsigned long  asUlong;
+		unsigned int  asUlong;
 	} u;
 };
 
@@ -189,6 +192,27 @@
 	struct mpt_ioctl_pci_info  pciInfo; /* Added Rev 1 */
 };
 
+/* Original structure, must always accept these
+ * IOCTLs. 4 byte pads can occur based on arch with
+ * above structure. Wish to re-align, but cannot.
+ */
+struct mpt_ioctl_iocinfo_rev0 {
+	mpt_ioctl_header hdr;
+	int		 adapterType;	/* SCSI or FCP */
+	int		 port;		/* port number */
+	int		 pciId;		/* PCI Id. */
+	int		 hwRev;		/* hardware revision */
+	int		 subSystemDevice;	/* PCI subsystem Device ID */
+	int		 subSystemVendor;	/* PCI subsystem Vendor ID */
+	int		 numDevices;		/* number of devices */
+	int		 FWVersion;		/* FW Version (integer) */
+	int		 BIOSVersion;		/* BIOS Version (integer) */
+	char		 driverVersion[MPT_IOCTL_VERSION_LENGTH];	/* Driver Version (string) */
+	char		 busChangeEvent;
+	char		 hostId;
+	char		 rsvd[2];
+};
+
 /*
  * Device Information Page
  * Report the number of, and ids of, all targets
@@ -330,7 +354,7 @@
 	unsigned int lun;
 } hp_header_t;
 
-/*  
+/*
  *  Header:
  *  iocnum 	required (input)
  *  host 	ignored	
@@ -353,12 +377,12 @@
 	u32		 bus_phys_width;
 	u32		 base_io_addr;
 	u32		 rsvd;
-	unsigned long	 hard_resets;		/* driver initiated resets */
-	unsigned long	 soft_resets;		/* ioc, external resets */
-	unsigned long	 timeouts;		/* num timeouts */
+	unsigned int	 hard_resets;		/* driver initiated resets */
+	unsigned int	 soft_resets;		/* ioc, external resets */
+	unsigned int	 timeouts;		/* num timeouts */
 } hp_host_info_t;
 
-/*  
+/*
  *  Header:
  *  iocnum 	required (input)
  *  host 	required	
diff -Nru a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c
--- a/drivers/message/fusion/mptlan.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/message/fusion/mptlan.c	Sun Feb 23 22:25:24 2003
@@ -154,7 +154,7 @@
 static int  mpt_lan_reset(struct net_device *dev);
 static int  mpt_lan_close(struct net_device *dev);
 static void mpt_lan_post_receive_buckets(void *dev_id);
-static void mpt_lan_wake_post_buckets_task(struct net_device *dev, 
+static void mpt_lan_wake_post_buckets_task(struct net_device *dev,
 					   int priority);
 static int  mpt_lan_receive_post_turbo(struct net_device *dev, u32 tmsg);
 static int  mpt_lan_receive_post_reply(struct net_device *dev,
@@ -868,7 +868,7 @@
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 static inline void
 mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority)
-/* 
+/*
  * @priority: 0 = put it on the timer queue, 1 = put it on the immediate queue
  */
 {
@@ -878,8 +878,6 @@
 		if (priority) {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
 			schedule_work(&priv->post_buckets_task);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,40)
-			schedule_task(&priv->post_buckets_task);
 #else
 			queue_task(&priv->post_buckets_task, &tq_immediate);
 			mark_bh(IMMEDIATE_BH);
@@ -887,8 +885,6 @@
 		} else {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
 			schedule_delayed_work(&priv->post_buckets_task, 1);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,40)
-			schedule_task(&priv->post_buckets_task);
 #else
 			queue_task(&priv->post_buckets_task, &tq_timer);
 #endif
@@ -1191,7 +1187,7 @@
 			remaining, atomic_read(&priv->buckets_out));
 	
 	if ((remaining < priv->bucketthresh) &&
-	    ((atomic_read(&priv->buckets_out) - remaining) > 
+	    ((atomic_read(&priv->buckets_out) - remaining) >
 	     MPT_LAN_BUCKETS_REMAIN_MISMATCH_THRESH)) {
 		
 		printk (KERN_WARNING MYNAM " Mismatch between driver's "
@@ -1525,7 +1521,7 @@
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-void __init mpt_lan_exit(void)
+static void mpt_lan_exit(void)
 {
 	int i;
 
@@ -1534,10 +1530,11 @@
 	for (i = 0; mpt_landev[i] != NULL; i++) {
 		struct net_device *dev = mpt_landev[i];
 
-		printk (KERN_INFO MYNAM ": %s/%s: Fusion MPT LAN device unregistered\n",
+		printk (KERN_INFO ": %s/%s: Fusion MPT LAN device unregistered\n",
 			       IOC_AND_NETDEV_NAMES_s_s(dev));
 		unregister_fcdev(dev);
-		mpt_landev[i] = (struct net_device *) 0xdeadbeef; /* Debug */
+		//mpt_landev[i] = (struct net_device *) 0xdeadbeef; /* Debug */
+		mpt_landev[i] = NULL;
 	}
 
 	if (LanCtx >= 0) {
@@ -1550,9 +1547,10 @@
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,59)
 MODULE_PARM(tx_max_out_p, "i");
 MODULE_PARM(max_buckets_out, "i"); // Debug stuff. FIXME!
+#endif
 
 module_init(mpt_lan_init);
 module_exit(mpt_lan_exit);
diff -Nru a/drivers/message/fusion/mptlan.h b/drivers/message/fusion/mptlan.h
--- a/drivers/message/fusion/mptlan.h	Sun Feb 23 22:25:26 2003
+++ b/drivers/message/fusion/mptlan.h	Sun Feb 23 22:25:26 2003
@@ -21,11 +21,7 @@
 #include <linux/miscdevice.h>
 #include <linux/spinlock.h>
 #include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
-#include <linux/tqueue.h>
-#else
 #include <linux/workqueue.h>
-#endif
 #include <linux/delay.h>
 // #include <linux/trdevice.h>
 
diff -Nru a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
--- a/drivers/message/fusion/mptscsih.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/message/fusion/mptscsih.c	Sun Feb 23 22:25:23 2003
@@ -78,9 +78,6 @@
 #include <linux/reboot.h>	/* notifier code */
 #include "../../scsi/scsi.h"
 #include "../../scsi/hosts.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,45)
-#include "../../scsi/sd.h"
-#endif
 
 #include "mptbase.h"
 #include "mptscsih.h"
@@ -98,7 +95,6 @@
 /* Set string for command line args from insmod */
 #ifdef MODULE
 char *mptscsih = 0;
-MODULE_PARM(mptscsih, "s");
 #endif
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -165,11 +161,7 @@
 static void	mptscsih_freeChainBuffers(MPT_SCSI_HOST *hd, int req_idx);
 static int	mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init);
 static void	copy_sense_data(Scsi_Cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply_t *pScsiReply);
-#ifndef MPT_SCSI_USE_NEW_EH
-static void	search_taskQ_for_cmd(Scsi_Cmnd *sc, MPT_SCSI_HOST *hd);
-#else
 static int	mptscsih_tm_pending_wait(MPT_SCSI_HOST * hd);
-#endif
 static u32	SCPNT_TO_LOOKUP_IDX(Scsi_Cmnd *sc);
 static MPT_FRAME_HDR *mptscsih_search_pendingQ(MPT_SCSI_HOST *hd, int scpnt_idx);
 static void	post_pendingQ_commands(MPT_SCSI_HOST *hd);
@@ -180,11 +172,7 @@
 static int	mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
 static int	mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
 
-static VirtDevice	*mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *data, int dlen);
-void		mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byte56);
-#ifdef MPT_SAVE_AUTOSENSE
-static void	clear_sense_flag(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq);
-#endif
+static void	mptscsih_target_settings(MPT_SCSI_HOST *hd, VirtDevice *target, Scsi_Device *sdev);
 static void	mptscsih_set_dvflags(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq);
 static void	mptscsih_setDevicePage1Flags (u8 width, u8 factor, u8 offset, int *requestedPtr, int *configurationPtr, u8 flags);
 static void	mptscsih_no_negotiate(MPT_SCSI_HOST *hd, int target_id);
@@ -225,30 +213,8 @@
 static int	ScsiTaskCtx = -1;
 static int	ScsiScanDvCtx = -1; /* Used only for bus scan and dv */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,28)
-static struct proc_dir_entry proc_mpt_scsihost =
-{
-	.low_ino =	PROC_SCSI_MPT,
-	.namelen =	8,
-	.name =		"mptscsih",
-	.mode =		S_IFDIR | S_IRUGO | S_IXUGO,
-	.nlink =	2,
-};
-#endif
-
 #define SNS_LEN(scp)	sizeof((scp)->sense_buffer)
 
-#ifndef MPT_SCSI_USE_NEW_EH
-/*
- *  Stuff to handle single-threading SCSI TaskMgmt
- *  (abort/reset) requests...
- */
-static spinlock_t mytaskQ_lock = SPIN_LOCK_UNLOCKED;
-static int mytaskQ_bh_active = 0;
-static struct mpt_work_struct	mptscsih_ptaskfoo;
-static atomic_t	mpt_taskQdepth;
-#endif
-
 #ifndef MPTSCSIH_DISABLE_DOMAIN_VALIDATION
 /*
  * Domain Validation task structure
@@ -307,10 +273,9 @@
 		break;
 	}
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	if (cmd->sc_data_direction != SCSI_DATA_UNKNOWN)
 		return cmd->sc_data_direction;
-#endif
+
 	switch (cmd->cmnd[0]) {
 	/*  _DATA_OUT commands	*/
 	case WRITE_6:		case WRITE_10:		case WRITE_12:
@@ -722,9 +687,6 @@
 	MPT_SCSI_HOST	*hd;
 	SCSIIORequest_t	*pScsiReq;
 	SCSIIOReply_t	*pScsiReply;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
-	unsigned long	 flags;
-#endif
 	u16		 req_idx;
 
 	hd = (MPT_SCSI_HOST *) ioc->sh->hostdata;
@@ -739,16 +701,11 @@
 	req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
 	sc = hd->ScsiLookup[req_idx];
 	if (sc == NULL) {
-		MPIHeader_t *hdr = (MPIHeader_t *)mf;
-
-		atomic_dec(&queue_depth);
-
-		/* writeSDP1 will use the ScsiDoneCtx
-		 * There is no processing for the reply.
-		 * Just return to the calling function.
+		/* Remark: writeSDP1 will use the ScsiDoneCtx
+		 * If a SCSI I/O cmd, device disabled by OS and
+		 * completion done. Cannot touch sc struct. Just free mem.
 		 */
-		if (hdr->Function == MPI_FUNCTION_SCSI_IO_REQUEST)
-			printk(MYIOC_s_ERR_FMT "NULL ScsiCmd ptr!\n", ioc->name);
+		atomic_dec(&queue_depth);
 
 		mptscsih_freeChainBuffers(hd, req_idx);
 		return 1;
@@ -765,25 +722,7 @@
 
 	if (pScsiReply == NULL) {
 		/* special context reply handling */
-
-		/* If regular Inquiry cmd - save inquiry data
-		 */
-		if (pScsiReq->CDB[0] == INQUIRY && !(pScsiReq->CDB[1] & 0x3)) {
-			int	 dlen;
-
-			dlen = le32_to_cpu(pScsiReq->DataLength);
-			if (dlen >= SCSI_STD_INQUIRY_BYTES) {
-				mptscsih_initTarget(hd,
-						hd->port,
-						sc->device->id,
-						pScsiReq->LUN[1],
-						sc->buffer,
-						dlen);
-			}
-		}
-#ifdef MPT_SAVE_AUTOSENSE
-		clear_sense_flag(hd, pScsiReq);
-#endif
+		;
 	} else {
 		u32	 xfer_cnt;
 		u16	 status;
@@ -792,10 +731,10 @@
 		status = le16_to_cpu(pScsiReply->IOCStatus) & MPI_IOCSTATUS_MASK;
 		scsi_state = pScsiReply->SCSIState;
 
-		dprintk((KERN_NOTICE "  Uh-Oh! (%d:%d:%d) mf=%p, mr=%p, sc=%p\n",
+		dsprintk((KERN_NOTICE "  Uh-Oh! (%d:%d:%d) mf=%p, mr=%p, sc=%p\n",
 				ioc->id, pScsiReq->TargetID, pScsiReq->LUN[1],
 				mf, mr, sc));
-		dprintk((KERN_NOTICE "  IOCStatus=%04xh, SCSIState=%02xh"
+		dsprintk((KERN_NOTICE "  IOCStatus=%04xh, SCSIState=%02xh"
 				", SCSIStatus=%02xh, IOCLogInfo=%08xh\n",
 				status, scsi_state, pScsiReply->SCSIStatus,
 				le32_to_cpu(pScsiReply->IOCLogInfo)));
@@ -835,9 +774,8 @@
 			break;
 
 		case MPI_IOCSTATUS_SCSI_TASK_TERMINATED:	/* 0x0048 */
-#ifndef MPT_SCSI_USE_NEW_EH
-			search_taskQ_for_cmd(sc, hd);
-#endif
+		case MPI_IOCSTATUS_SCSI_IOC_TERMINATED:		/* 0x004B */
+		case MPI_IOCSTATUS_SCSI_EXT_TERMINATED:		/* 0x004C */
 			/* Linux handles an unsolicited DID_RESET better
 			 * than an unsolicited DID_ABORT.
 			 */
@@ -848,18 +786,6 @@
 				mptscsih_no_negotiate(hd, sc->device->id);
 			break;
 
-		case MPI_IOCSTATUS_SCSI_IOC_TERMINATED:		/* 0x004B */
-		case MPI_IOCSTATUS_SCSI_EXT_TERMINATED:		/* 0x004C */
-#ifndef MPT_SCSI_USE_NEW_EH
-			search_taskQ_for_cmd(sc, hd);
-#endif
-			sc->result = DID_RESET << 16;
-
-			/* GEM Workaround. */
-			if (hd->is_spi)
-				mptscsih_no_negotiate(hd, sc->device->id);
-			break;
-
 		case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH:	/* 0x0049 */
 		case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN:		/* 0x0045 */
 			/*
@@ -871,9 +797,6 @@
 			 *  precedence!
 			 */
 			sc->result = (DID_OK << 16) | pScsiReply->SCSIStatus;
-#ifdef MPT_SAVE_AUTOSENSE
-			clear_sense_flag(hd, pScsiReq);
-#endif
 			if (scsi_state == 0) {
 				;
 			} else if (scsi_state & MPI_SCSI_STATE_AUTOSENSE_VALID) {
@@ -897,38 +820,19 @@
 					sc->underflow));
 			dprintk((KERN_NOTICE "  ActBytesXferd=%02xh\n", xfer_cnt));
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
 			sc->resid = sc->request_bufflen - xfer_cnt;
 			dprintk((KERN_NOTICE "  SET sc->resid=%02xh\n", sc->resid));
-#endif
 
 			/* Report Queue Full
 			 */
 			if (sc->result == MPI_SCSI_STATUS_TASK_SET_FULL)
 				mptscsih_report_queue_full(sc, pScsiReply, pScsiReq);
 
-			/* If regular Inquiry cmd and some data was transferred,
-			 * save inquiry data
-			 */
-			if (    pScsiReq->CDB[0] == INQUIRY
-			     && !(pScsiReq->CDB[1] & 0x3)
-			     && xfer_cnt >= SCSI_STD_INQUIRY_BYTES
-			   ) {
-				mptscsih_initTarget(hd,
-						hd->port,
-						sc->device->id,
-						pScsiReq->LUN[1],
-						sc->buffer,
-						xfer_cnt);
-			}
 			break;
 
 		case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR:	/* 0x0040 */
 		case MPI_IOCSTATUS_SUCCESS:			/* 0x0000 */
 			sc->result = (DID_OK << 16) | pScsiReply->SCSIStatus;
-#ifdef MPT_SAVE_AUTOSENSE
-			clear_sense_flag(hd, pScsiReq);
-#endif
 			if (scsi_state == 0) {
 				;
 			} else if (scsi_state & MPI_SCSI_STATE_AUTOSENSE_VALID) {
@@ -941,26 +845,6 @@
 				if (pScsiReply->SCSIStatus == MPI_SCSI_STATUS_TASK_SET_FULL)
 					mptscsih_report_queue_full(sc, pScsiReply, pScsiReq);
 
-#ifndef MPT_SCSI_USE_NEW_EH
-				/* ADDED 20011120 -sralston
-				 * Scsi mid-layer (old_eh) doesn't seem to like it
-				 * when RAID returns SCSIStatus=02 (CHECK CONDITION),
-				 * SenseKey=01 (RECOVERED ERROR), ASC/ASCQ=95/01.
-				 * Seems to be * treating this as a IO error:-(
-				 *
-				 * So just lie about it altogether here.
-				 *
-				 * NOTE: It still gets reported to syslog via
-				 * mpt_ScsiHost_ErrorReport from copy_sense_data
-				 * call far above.
-				 */
-				if (    pScsiReply->SCSIStatus == STS_CHECK_CONDITION
-				     && SD_Sense_Key(sc->sense_buffer) == SK_RECOVERED_ERROR
-				   ) {
-					sc->result = 0;
-				}
-#endif
-
 			}
 			else if (scsi_state &
 			         (MPI_SCSI_STATE_AUTOSENSE_FAILED | MPI_SCSI_STATE_NO_SCSI_STATUS)
@@ -989,22 +873,6 @@
 			 * Reservation Conflict, Busy,
 			 * Command Terminated, CHECK
 			 */
-
-			/* If regular Inquiry cmd - save inquiry data
-			 */
-			xfer_cnt = le32_to_cpu(pScsiReply->TransferCount);
-			if (    sc->result == (DID_OK << 16)
-			     && pScsiReq->CDB[0] == INQUIRY
-			     && !(pScsiReq->CDB[1] & 0x3)
-			     && xfer_cnt >= SCSI_STD_INQUIRY_BYTES
-			   ) {
-				mptscsih_initTarget(hd,
-						hd->port,
-						sc->device->id,
-						pScsiReq->LUN[1],
-						sc->buffer,
-						xfer_cnt);
-			}
 			break;
 
 		case MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR:		/* 0x0047 */
@@ -1052,178 +920,15 @@
 
 	hd->ScsiLookup[req_idx] = NULL;
 
-#ifndef MPT_SCSI_USE_NEW_EH
-	sc->host_scribble = NULL;
-#endif
-
-        MPT_HOST_LOCK(flags);
+	MPT_HOST_LOCK(flags);
 	sc->scsi_done(sc);		/* Issue the command callback */
-        MPT_HOST_UNLOCK(flags);
+	MPT_HOST_UNLOCK(flags);
 
 	/* Free Chain buffers */
 	mptscsih_freeChainBuffers(hd, req_idx);
 	return 1;
 }
 
-#ifndef MPT_SCSI_USE_NEW_EH	/* { */
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *	search_taskQ - Search SCSI task mgmt request queue for specific
- *	request type.
- *	@remove: (Boolean) Should request be removed if found?
- *	@sc: Pointer to Scsi_Cmnd structure
- *	@task_type: Task type to search for
- *
- *	Returns pointer to MPT request frame if found, or %NULL if request
- *	was not found.
- */
-static MPT_FRAME_HDR *
-search_taskQ(int remove, Scsi_Cmnd *sc, MPT_SCSI_HOST *hd, u8 task_type)
-{
-	MPT_FRAME_HDR *mf = NULL;
-	unsigned long flags;
-	int count = 0;
-	int list_sz;
-
-	dprintk((KERN_INFO MYNAM ": search_taskQ(%d,sc=%p,%d) called\n",
-			remove, sc, task_type));
-	spin_lock_irqsave(&hd->ioc->FreeQlock, flags);
-	list_sz = hd->taskQcnt;
-	if (! Q_IS_EMPTY(&hd->taskQ)) {
-		mf = hd->taskQ.head;
-		do {
-			count++;
-			if (mf->u.frame.linkage.argp1 == sc &&
-			    mf->u.frame.linkage.arg1 == task_type) {
-				if (remove) {
-					Q_DEL_ITEM(&mf->u.frame.linkage);
-					hd->taskQcnt--;
-					atomic_dec(&mpt_taskQdepth);
-
-					/* Don't save mf into nextmf because
-					 * exit after command has been deleted.
-					 */
-
-					/* Place the MF back on the FreeQ */
-					Q_ADD_TAIL(&hd->ioc->FreeQ,
-						&mf->u.frame.linkage,
-						MPT_FRAME_HDR);
-#ifdef MFCNT
-					hd->ioc->mfcnt--;
-#endif
-				}
-				break;
-			}
-		} while ((mf = mf->u.frame.linkage.forw) != (MPT_FRAME_HDR*)&hd->taskQ);
-		if (mf == (MPT_FRAME_HDR*)&hd->taskQ) {
-			mf = NULL;
-		}
-	}
-	spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
-
-	if (list_sz) {
-		dprintk((KERN_INFO "  Results=%p (%sFOUND%s)!\n",
-				   mf,
-				   mf ? "" : "NOT_",
-				   (mf && remove) ? "+REMOVED" : "" ));
-		dprintk((KERN_INFO "  (searched thru %d of %d items on taskQ)\n",
-				   count,
-				   list_sz ));
-	}
-
-	return mf;
-}
-
-/*
- *	clean_taskQ - Clean the  SCSI task mgmt request for
- *			this SCSI host instance.
- *	@hd: MPT_SCSI_HOST pointer
- *
- *	Returns: None.
- */
-static void
-clean_taskQ(MPT_SCSI_HOST *hd)
-{
-	MPT_FRAME_HDR *mf = NULL;
-	MPT_FRAME_HDR *nextmf = NULL;
-	MPT_ADAPTER *ioc = hd->ioc;
-	unsigned long flags;
-
-	dprintk((KERN_INFO MYNAM ": clean_taskQ called\n"));
-
-	spin_lock_irqsave(&ioc->FreeQlock, flags);
-	if (! Q_IS_EMPTY(&hd->taskQ)) {
-		mf = hd->taskQ.head;
-		do {
-			Q_DEL_ITEM(&mf->u.frame.linkage);
-			hd->taskQcnt--;
-			atomic_dec(&mpt_taskQdepth);
-
-			nextmf = mf->u.frame.linkage.forw;
-
-			/* Place the MF back on the FreeQ */
-			Q_ADD_TAIL(&ioc->FreeQ, &mf->u.frame.linkage,
-				MPT_FRAME_HDR);
-#ifdef MFCNT
-			hd->ioc->mfcnt--;
-#endif
-		} while ((mf = nextmf) != (MPT_FRAME_HDR*)&hd->taskQ);
-	}
-	spin_unlock_irqrestore(&ioc->FreeQlock, flags);
-
-	return;
-}
-
-/*
- *	search_taskQ_for_cmd - Search the  SCSI task mgmt request queue for
- *			the specified command. If found, delete
- *	@hd: MPT_SCSI_HOST pointer
- *
- *	Returns: None.
- */
-static void
-search_taskQ_for_cmd(Scsi_Cmnd *sc, MPT_SCSI_HOST *hd)
-{
-	MPT_FRAME_HDR *mf = NULL;
-	unsigned long flags;
-	int count = 0;
-
-	dprintk((KERN_INFO MYNAM ": search_taskQ_for_cmd(sc=%p) called\n", sc));
-	spin_lock_irqsave(&hd->ioc->FreeQlock, flags);
-	if (! Q_IS_EMPTY(&hd->taskQ)) {
-		mf = hd->taskQ.head;
-		do {
-			count++;
-			if (mf->u.frame.linkage.argp1 == sc) {
-				Q_DEL_ITEM(&mf->u.frame.linkage);
-				hd->taskQcnt--;
-				atomic_dec(&mpt_taskQdepth);
-				dprintk((KERN_INFO MYNAM
-					": Cmd %p found! Deleting.\n", sc));
-
-				/* Don't save mf into nextmf because
-				 * exit after command has been deleted.
-				 */
-
-				/* Place the MF back on the FreeQ */
-				Q_ADD_TAIL(&hd->ioc->FreeQ,
-					&mf->u.frame.linkage,
-					MPT_FRAME_HDR);
-#ifdef MFCNT
-				hd->ioc->mfcnt--;
-#endif
-				break;
-			}
-		} while ((mf = mf->u.frame.linkage.forw) != (MPT_FRAME_HDR*)&hd->taskQ);
-	}
-	spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
-
-	return;
-}
-
-#endif		/* } MPT_SCSI_USE_NEW_EH */
-
-
 /*
  * Flush all commands on the doneQ.
  * Lock Q when deleting/adding members
@@ -1323,24 +1028,13 @@
 	int		 ii;
 	int		 max = hd->ioc->req_depth;
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
-	unsigned long	 flags;
-#endif
-
 	dprintk((KERN_INFO MYNAM ": flush_ScsiLookup called\n"));
 	for (ii= 0; ii < max; ii++) {
 		if ((SCpnt = hd->ScsiLookup[ii]) != NULL) {
 
 			/* Command found.
-			 */
-
-#ifndef MPT_SCSI_USE_NEW_EH
-			/* Search taskQ, if found, delete.
-			 */
-			search_taskQ_for_cmd(SCpnt, hd);
-#endif
-
-			/* Search pendingQ, if found,
+			 *
+			 * Search pendingQ, if found,
 			 * delete from Q. If found, do not decrement
 			 * queue_depth, command never posted.
 			 */
@@ -1387,6 +1081,57 @@
 	return;
 }
 
+/*
+ *	mptscsih_search_running_cmds - Delete any commands associated
+ *		with the specified target and lun. Function called only
+ *		when a lun is disable by mid-layer.
+ *		Do NOT access the referenced Scsi_Cmnd structure or
+ *		members. Will cause either a paging or NULL ptr error.
+ *	@hd: Pointer to a SCSI HOST structure
+ *	@target: target id
+ *	@lun: lun
+ *
+ *	Returns: None.
+ *
+ *	Called from slave_destroy.
+ */
+static void
+mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, uint target, uint lun)
+{
+	SCSIIORequest_t	*mf = NULL;
+	int		 ii;
+	int		 max = hd->ioc->req_depth;
+
+	dsprintk((KERN_INFO MYNAM ": search_running target %d lun %d max %d numIos %d\n",
+			target, lun, max, atomic_read(&queue_depth)));
+
+	for (ii=0; ii < max; ii++) {
+		if (hd->ScsiLookup[ii] != NULL) {
+
+			mf = (SCSIIORequest_t *)MPT_INDEX_2_MFPTR(hd->ioc, ii);
+
+			dsprintk(( "search_running: found (sc=%p, mf = %p) target %d, lun %d \n",
+					hd->ScsiLookup[ii], mf, mf->TargetID, mf->LUN[1]));
+
+			if ((mf->TargetID != ((u8)target)) || (mf->LUN[1] != ((u8) lun)))
+				continue;
+
+			/* If cmd pended, do not decrement queue_depth, command never posted.
+			 */
+			if (mptscsih_search_pendingQ(hd, ii) == NULL)
+				atomic_dec(&queue_depth);
+
+			/* Cleanup
+			 */
+			hd->ScsiLookup[ii] = NULL;
+			mptscsih_freeChainBuffers(hd, ii);
+			mpt_free_msg_frame(ScsiDoneCtx, hd->ioc->id, (MPT_FRAME_HDR *)mf);
+		}
+	}
+
+	return;
+}
+
 #ifdef DROP_TEST
 /* 	mptscsih_flush_drop_test - Free resources and do callback if
  *		DROP_TEST enabled.
@@ -1639,10 +1384,6 @@
 		ScsiTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTSCSIH_DRIVER);
 		ScsiScanDvCtx = mpt_register(mptscsih_scandv_complete, MPTSCSIH_DRIVER);
 
-#ifndef MPT_SCSI_USE_NEW_EH
-		spin_lock_init(&mytaskQ_lock);
-#endif
-
 		if (mpt_event_register(ScsiDoneCtx, mptscsih_event_process) == 0) {
 			dprintk((KERN_INFO MYNAM ": Registered for IOC event notifications\n"));
 		} else {
@@ -1662,9 +1403,6 @@
 	if (mptscsih)
 		mptscsih_setup(mptscsih);
 #endif
-#ifndef MPT_SCSI_USE_NEW_EH
-	atomic_set(&mpt_taskQdepth, 0);
-#endif
 
 	this = mpt_adapter_find_first();
 	while (this != NULL) {
@@ -1690,9 +1428,6 @@
 				continue;
 			}
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-			tpnt->proc_dir = &proc_mpt_scsihost;
-#endif
 			tpnt->proc_info = mptscsih_proc_info;
 			sh = scsi_register(tpnt, sizeof(MPT_SCSI_HOST));
 			if (sh != NULL) {
@@ -1723,20 +1458,10 @@
 				}
 				sh->max_lun = MPT_LAST_LUN + 1;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7)
 				sh->max_sectors = MPT_SCSI_MAX_SECTORS;
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1) || defined CONFIG_HIGHIO
 				sh->highmem_io = 1;
-#endif
 				sh->this_id = this->pfacts[portnum].PortSCSIID;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44)
-				/* OS entry to allow host drivers to force
-				 * a queue depth on a per device basis.
-				 */
-				sh->select_queue_depths = mptscsih_select_queue_depths;
-#endif
 				/* Required entry.
 				 */
 				sh->unique_id = this->id;
@@ -1769,7 +1494,7 @@
 
 				/* Set the pci device pointer in Scsi_Host structure.
 				 */
-				scsi_set_pci_device(sh, this->pcidev);
+				scsi_set_device(sh, &this->pcidev->dev);
 
 				spin_unlock_irqrestore(&this->FreeQlock, flags);
 
@@ -1852,9 +1577,7 @@
 				/* Clear the TM flags
 				 */
 				hd->tmPending = 0;
-#ifdef MPT_SCSI_USE_NEW_EH
 				hd->tmState = TM_STATE_NONE;
-#endif
 				hd->resetPending = 0;
 				hd->abortSCpnt = NULL;
 				hd->tmPtr = NULL;
@@ -1973,32 +1696,6 @@
 
 	hd = (MPT_SCSI_HOST *) host->hostdata;
 
-#ifndef MPT_SCSI_USE_NEW_EH
-#ifndef MPTSCSIH_DISABLE_DOMAIN_VALIDATION
-	spin_lock_irqsave(&dvtaskQ_lock, flags);
-	dvtaskQ_release = 1;
-	spin_unlock_irqrestore(&dvtaskQ_lock, flags);
-#endif
-
-	count = 10 * HZ;
-	spin_lock_irqsave(&mytaskQ_lock, flags);
-	if (mytaskQ_bh_active) {
-		spin_unlock_irqrestore(&mytaskQ_lock, flags);
-		dprintk((KERN_INFO MYNAM ": Info: Zapping TaskMgmt thread!\n"));
-		clean_taskQ(hd);
-
-		while(mytaskQ_bh_active && --count) {
-			set_current_state(TASK_INTERRUPTIBLE);
-			schedule_timeout(1);
-		}
-	} else {
-		spin_unlock_irqrestore(&mytaskQ_lock, flags);
-	}
-	if (!count)
-		printk(KERN_ERR MYNAM ": ERROR - TaskMgmt thread still active!\n");
-
-#endif
-
 #ifndef MPTSCSIH_DISABLE_DOMAIN_VALIDATION
 	/* Check DV thread active */
 	count = 10 * HZ;
@@ -2266,7 +1963,7 @@
 	dma_addr_t		 cfg_dma_addr = -1;
 	ConfigPageHeader_t	 header;
 
-	dprintk(("exec_user_command: ioc %p cmd %ld target=%ld\n", 
+	dprintk(("exec_user_command: ioc %p cmd %ld target=%ld\n",
 			ioc, uc->cmd, uc->target));
 
 	switch (uc->cmd) {
@@ -2329,7 +2026,7 @@
 
 					printk(" %dMB/sec\n", speed);
 
-				} else 
+				} else
 					printk(" Asynchronous.\n");
 			} else {
 				printk("failed\n" );
@@ -2487,18 +2184,7 @@
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 	static int max_qd = 1;
-#if 0
-static int index_log[128];
-static int index_ent = 0;
-static __inline__ void ADD_INDEX_LOG(int req_ent)
-{
-	int i = index_ent++;
-
-	index_log[i & (128 - 1)] = req_ent;
-}
-#else
 #define ADD_INDEX_LOG(req_ent)	do { } while(0)
-#endif
 
 #ifdef	DROP_TEST
 #define DROP_IOC	1	/* IOC to force failures */
@@ -2567,7 +2253,6 @@
 	u32	 datalen;
 	u32	 scsictl;
 	u32	 scsidir;
-	u32	 qtag;
 	u32	 cmd_len;
 	int	 my_idx;
 	int	 ii;
@@ -2586,44 +2271,6 @@
 	dmfprintk((MYIOC_s_INFO_FMT "qcmd: SCpnt=%p, done()=%p\n",
 			(hd && hd->ioc) ? hd->ioc->name : "ioc?", SCpnt, done));
 
-#ifdef MPT_SAVE_AUTOSENSE
-	/* 20000617 -sralston
-	 *  GRRRRR...  Shouldn't have to do this but...
-	 *  Do explicit check for REQUEST_SENSE and cached SenseData.
-	 *  If yes, return cached SenseData.
-	 */
-	if (SCpnt->cmnd[0] == REQUEST_SENSE) {
-		u8 *dest = NULL;
-		int sz;
-
-		if (pTarget && (pTarget->tflags & MPT_TARGET_FLAGS_VALID_SENSE)) {
-			pTarget->tflags &= ~MPT_TARGET_FLAGS_VALID_SENSE;	//sjr-moved-here
-			if (!SCpnt->use_sg) {
-				dest = SCpnt->request_buffer;
-			} else {
-				struct scatterlist *sg = (struct scatterlist *) SCpnt->request_buffer;
-				if (sg)
-					dest = (u8 *)(ulong)sg_dma_address(sg);
-			}
-
-			if (dest) {
-				sz = MIN (SCSI_STD_SENSE_BYTES, SCpnt->request_bufflen);
-				memcpy(dest, pTarget->sense, sz);
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
-				SCpnt->resid = SCpnt->request_bufflen - sz;
-#endif
-				SCpnt->result = 0;
-				SCpnt->scsi_done(SCpnt);
-
-				//sjr-moved-up//pTarget->tflags &= ~MPT_TARGET_FLAGS_VALID_SENSE;
-
-				return 0;
-			}
-		}
-	}
-#endif
-
 	if (hd->resetPending) {
 		/* Prevent new commands from being issued
 		 * while reloading the FW.
@@ -2673,22 +2320,13 @@
 	/* Default to untagged. Once a target structure has been allocated,
 	 * use the Inquiry data to determine if device supports tagged.
 	 */
-	qtag = MPI_SCSIIO_CONTROL_UNTAGGED;
-	if (pTarget && (pTarget->tflags & MPT_TARGET_FLAGS_Q_YES)
-			&& (SCpnt->device->tagged_supported)) {
-		/*
-		 *  Some drives are too stupid to handle fairness issues
-		 *  with tagged queueing. We throw in the odd ordered
-		 *  tag to stop them starving themselves.
-		 */
-		if ((jiffies - hd->qtag_tick) > (5*HZ)) {
-			qtag = MPI_SCSIIO_CONTROL_ORDEREDQ;
-			hd->qtag_tick = jiffies;
-		}
-		else
-			qtag = MPI_SCSIIO_CONTROL_SIMPLEQ;
+	if (   pTarget
+	    && (pTarget->tflags & MPT_TARGET_FLAGS_Q_YES)
+	    && (SCpnt->device->tagged_supported)) {
+		scsictl = scsidir | MPI_SCSIIO_CONTROL_SIMPLEQ;
+	} else {
+		scsictl = scsidir | MPI_SCSIIO_CONTROL_UNTAGGED;
 	}
-	scsictl = scsidir | qtag;
 
 	/* Use the above information to set up the message frame
 	 */
@@ -3044,10 +2682,6 @@
 	}
 
 	dtmprintk((MYIOC_s_INFO_FMT "TMHandler rc = %d!\n", hd->ioc->name, rc));
-#ifndef MPT_SCSI_USE_NEW_EH
-	dtmprintk((MYIOC_s_INFO_FMT "TMHandler: _bh_handler state (%d) taskQ count (%d)\n",
-		ioc->name, mytaskQ_bh_active, hd->taskQcnt));
-#endif
 
 	return rc;
 }
@@ -3139,7 +2773,6 @@
 	return retval;
 }
 
-#ifdef MPT_SCSI_USE_NEW_EH		/* { */
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
  *	mptscsih_abort - Abort linux Scsi_Cmnd routine, new_eh variant
@@ -3449,444 +3082,6 @@
 	return status;
 }
 
-#else		/* MPT_SCSI old EH stuff... */
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/**
- *	mptscsih_old_abort - Abort linux Scsi_Cmnd routine
- *	@SCpnt: Pointer to Scsi_Cmnd structure, IO to be aborted
- *
- *	(linux Scsi_Host_Template.abort routine)
- *
- *	Returns SCSI_ABORT_{SUCCESS,BUSY,PENDING}.
- */
-int
-mptscsih_old_abort(Scsi_Cmnd *SCpnt)
-{
-	MPT_SCSI_HOST		*hd;
-	MPT_FRAME_HDR		*mf;
-	struct mpt_work_struct	*ptaskfoo;
-	unsigned long		 flags;
-	int			 scpnt_idx;
-
-	printk(KERN_WARNING MYNAM ": OldAbort scheduling ABORT SCSI IO (sc=%p)\n", (void *) SCpnt);
-	printk(KERN_WARNING "  IOs outstanding = %d\n", atomic_read(&queue_depth));
-
-	if ((hd = (MPT_SCSI_HOST *) SCpnt->host->hostdata) == NULL) {
-		printk(KERN_WARNING "  WARNING - OldAbort, NULL hostdata ptr!!\n");
-		SCpnt->result = DID_ERROR << 16;
-		SCpnt->scsi_done(SCpnt);
-		return SCSI_ABORT_NOT_RUNNING;
-	}
-
-	if (hd->timeouts < -1)
-		hd->timeouts++;
-
-	if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) {
-		/* Cmd not found in ScsiLookup.
-		 * If found in doneQ, delete from Q.
-		 * Do OS callback.
-		 */
-		search_doneQ_for_cmd(hd, SCpnt);
-
-		SCpnt->result = DID_RESET << 16;
-		SCpnt->scsi_done(SCpnt);
-		return SCSI_ABORT_SUCCESS;
-	} else {
-		/* If this command is pended, then timeout/hang occurred
-		 * during DV. Force bus reset by posting command to F/W
-		 * and then following up with the reset request.
-		 */
-		if ((mf = mptscsih_search_pendingQ(hd, scpnt_idx)) != NULL) {
-			mptscsih_put_msgframe(ScsiDoneCtx, hd->ioc->id, mf);
-			post_pendingQ_commands(hd);
-		}
-	}
-
-	/*
-	 *  Check to see if there's already an ABORT queued for this guy.
-	 */
-	mf = search_taskQ(0, SCpnt, hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK);
-	if (mf != NULL) {
-		dtmprintk((MYIOC_s_INFO_FMT "OldAbort:Abort Task PENDING cmd (%p) taskQ depth (%d)\n",
-			hd->ioc->name, SCpnt, hd->taskQcnt));
-		return SCSI_ABORT_PENDING;
-	}
-
-	// SJR - CHECKME - Can we avoid this here?
-	// (mpt_HardResetHandler has this check...)
-	/* If IOC is reloading FW, return PENDING.
-	 */
-	spin_lock_irqsave(&hd->ioc->diagLock, flags);
-	if (hd->ioc->diagPending) {
-		spin_unlock_irqrestore(&hd->ioc->diagLock, flags);
-		return SCSI_ABORT_PENDING;
-	}
-	spin_unlock_irqrestore(&hd->ioc->diagLock, flags);
-
-	/* If there are no message frames what should we do?
-	 */
-	if ((mf = mpt_get_msg_frame(ScsiTaskCtx, hd->ioc->id)) == NULL) {
-		printk((KERN_WARNING "  WARNING - OldAbort, no msg frames!!\n"));
-		/* We are out of message frames!
-		 * Call the reset handler to do a FW reload.
-		 */
-		printk((KERN_WARNING " Reloading Firmware!!\n"));
-		if (mpt_HardResetHandler(hd->ioc, NO_SLEEP) < 0) {
-			printk((KERN_WARNING " Firmware Reload FAILED!!\n"));
-		}
-		return SCSI_ABORT_PENDING;
-	}
-
-	/*
-	 *  Add ourselves to (end of) taskQ .
-	 *  Check to see if our _bh is running.  If NOT, schedule it.
-	 */
-	spin_lock_irqsave(&hd->ioc->FreeQlock, flags);
-	Q_ADD_TAIL(&hd->taskQ, &mf->u.frame.linkage, MPT_FRAME_HDR);
-	hd->taskQcnt++;
-	atomic_inc(&mpt_taskQdepth);
-	spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
-
-	spin_lock_irqsave(&mytaskQ_lock, flags);
-
-	/* Save the original SCpnt mf pointer
-	 */
-	SCpnt->host_scribble = (u8 *) MPT_INDEX_2_MFPTR (hd->ioc, scpnt_idx);
-
-	/* For the time being, force bus reset on any abort
-	 * requests for the 1030/1035 FW.
-	 */
-	if (hd->is_spi)
-		mf->u.frame.linkage.arg1 = MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS;
-	else
-		mf->u.frame.linkage.arg1 = MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK;
-
-	mf->u.frame.linkage.argp1 = SCpnt;
-	mf->u.frame.linkage.argp2 = (void *) hd;
-
-	dtmprintk((MYIOC_s_INFO_FMT "OldAbort:_bh_handler state (%d) taskQ count (%d)\n",
-		hd->ioc->name, mytaskQ_bh_active, hd->taskQcnt));
-
-	if (! mytaskQ_bh_active) {
-		mytaskQ_bh_active = 1;
-		spin_unlock_irqrestore(&mytaskQ_lock, flags);
-
-		/*
-		 *  Oh how cute, no alloc/free/mgmt needed if we use
-		 *  (bottom/unused portion of) MPT request frame.
-		 */
-		ptaskfoo = (struct mpt_work_struct *) &mptscsih_ptaskfoo;
-		MPT_INIT_WORK(&mptscsih_ptaskfoo, mptscsih_taskmgmt_bh, (void *) SCpnt);
-
-		SCHEDULE_TASK(ptaskfoo);
-	} else  {
-		spin_unlock_irqrestore(&mytaskQ_lock, flags);
-	}
-
-	return SCSI_ABORT_PENDING;
-}
-
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/**
- *	mptscsih_old_reset - Perform a SCSI BUS_RESET!
- *	@SCpnt: Pointer to Scsi_Cmnd structure, IO which reset is due to
- *	@reset_flags: (not used?)
- *
- *	(linux Scsi_Host_Template.reset routine)
- *
- *	Returns SCSI_RESET_{SUCCESS,PUNT,PENDING}.
- */
-int
-mptscsih_old_reset(Scsi_Cmnd *SCpnt, unsigned int reset_flags)
-{
-	MPT_SCSI_HOST		*hd;
-	MPT_FRAME_HDR		*mf;
-	struct mpt_work_struct	*ptaskfoo;
-	unsigned long		 flags;
-	int			 scpnt_idx;
-
-	printk(KERN_WARNING MYNAM ": OldReset scheduling BUS_RESET (sc=%p)\n", (void *) SCpnt);
-	printk(KERN_WARNING "  IOs outstanding = %d\n", atomic_read(&queue_depth));
-
-	if ((hd = (MPT_SCSI_HOST *) SCpnt->host->hostdata) == NULL) {
-		SCpnt->result = DID_RESET << 16;
-		SCpnt->scsi_done(SCpnt);
-		return SCSI_RESET_SUCCESS;
-	}
-
-	if (hd->timeouts < -1)
-		hd->timeouts++;
-
-	if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) {
-		/* Cmd not found in ScsiLookup.
-		 * If found in doneQ, delete from Q.
-		 * Do OS callback.
-		 */
-		search_doneQ_for_cmd(hd, SCpnt);
-
-		SCpnt->result = DID_RESET << 16;
-		SCpnt->scsi_done(SCpnt);
-		return SCSI_RESET_SUCCESS;
-	} else {
-		/* If this command is pended, then timeout/hang occurred
-		 * during DV. Force bus reset by posting command to F/W
-		 * and then following up with the reset request.
-		 */
-		if ((mf = mptscsih_search_pendingQ(hd, scpnt_idx)) != NULL) {
-			mptscsih_put_msgframe(ScsiDoneCtx, hd->ioc->id, mf);
-			post_pendingQ_commands(hd);
-		}
-	}
-
-	/*
-	 *  Check to see if there's an ABORT_TASK queued for this guy.
-	 *  If so, delete.
-	 */
-	search_taskQ(1, SCpnt, hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK);
-
-	/*
-	 *  Check to see if there's already a BUS_RESET queued for this guy.
-	 */
-	mf = search_taskQ(0, SCpnt, hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS);
-	if (mf != NULL) {
-		dtmprintk((MYIOC_s_INFO_FMT "OldReset:Reset Task PENDING cmd (%p) taskQ depth (%d)\n",
-			hd->ioc->name, SCpnt, hd->taskQcnt));
-		return SCSI_RESET_PENDING;
-	}
-
-	// SJR - CHECKME - Can we avoid this here?
-	// (mpt_HardResetHandler has this check...)
-	/* If IOC is reloading FW, return PENDING.
-	 */
-	spin_lock_irqsave(&hd->ioc->diagLock, flags);
-	if (hd->ioc->diagPending) {
-		spin_unlock_irqrestore(&hd->ioc->diagLock, flags);
-		return SCSI_RESET_PENDING;
-	}
-	spin_unlock_irqrestore(&hd->ioc->diagLock, flags);
-
-	if ((mf = mpt_get_msg_frame(ScsiTaskCtx, hd->ioc->id)) == NULL) {
-		/* We are out of message frames!
-		 * Call the reset handler to do a FW reload.
-		 */
-		printk((KERN_WARNING " Reloading Firmware!!\n"));
-		if (mpt_HardResetHandler(hd->ioc, NO_SLEEP) < 0) {
-			printk((KERN_WARNING " Firmware Reload FAILED!!\n"));
-		}
-		return SCSI_RESET_PENDING;
-	}
-
-	/*
-	 *  Add ourselves to (end of) taskQ.
-	 *  Check to see if our _bh is running.  If NOT, schedule it.
-	 */
-	spin_lock_irqsave(&hd->ioc->FreeQlock, flags);
-	Q_ADD_TAIL(&hd->taskQ, &mf->u.frame.linkage, MPT_FRAME_HDR);
-	hd->taskQcnt++;
-	atomic_inc(&mpt_taskQdepth);
-	spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
-
-
-	dtmprintk((MYIOC_s_INFO_FMT "OldReset: _bh_handler state (%d) taskQ count (%d)\n",
-		hd->ioc->name, mytaskQ_bh_active, hd->taskQcnt));
-
-	spin_lock_irqsave(&mytaskQ_lock, flags);
-	/* Save the original SCpnt mf pointer
-	 */
-	SCpnt->host_scribble = (u8 *) MPT_INDEX_2_MFPTR (hd->ioc, scpnt_idx);
-
-	mf->u.frame.linkage.arg1 = MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS;
-	mf->u.frame.linkage.argp1 = SCpnt;
-	mf->u.frame.linkage.argp2 = (void *) hd;
-
-	if (! mytaskQ_bh_active) {
-		mytaskQ_bh_active = 1;
-		spin_unlock_irqrestore(&mytaskQ_lock, flags);
-		/*
-		 *  Oh how cute, no alloc/free/mgmt needed if we use
-		 *  (bottom/unused portion of) MPT request frame.
-		 */
-		ptaskfoo = (struct mpt_work_struct *) &mptscsih_ptaskfoo;
-		MPT_INIT_WORK(&mptscsih_ptaskfoo, mptscsih_taskmgmt_bh, (void *) SCpnt);
-
-		SCHEDULE_TASK(ptaskfoo);
-	} else  {
-		spin_unlock_irqrestore(&mytaskQ_lock, flags);
-	}
-	return SCSI_RESET_PENDING;
-}
-
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *	mptscsih_taskmgmt_bh - SCSI task mgmt bottom half handler
- *	@sc: (unused)
- *
- *	This routine (thread) is active whenever there are any outstanding
- *	SCSI task management requests for a SCSI host adapter.
- *	IMPORTANT!  This routine is scheduled therefore should never be
- *	running in ISR context.  i.e., it's safe to sleep here.
- */
-void
-mptscsih_taskmgmt_bh(void *sc)
-{
-	MPT_ADAPTER	*ioc;
-	Scsi_Cmnd	*SCpnt;
-	MPT_FRAME_HDR	*mf = NULL;
-	MPT_SCSI_HOST	*hd;
-	u32		 ctx2abort = 0;
-	unsigned long	 flags;
-	int		 scpnt_idx;
-	int		 did;
-	u8		 task_type;
-
-	spin_lock_irqsave(&mytaskQ_lock, flags);
-	mytaskQ_bh_active = 1;
-	spin_unlock_irqrestore(&mytaskQ_lock, flags);
-
-	do {
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(HZ/4);
-		did = 0;
-
-		for (ioc = mpt_adapter_find_first(); ioc != NULL; ioc = mpt_adapter_find_next(ioc)) {
-			if (ioc->sh) {
-				hd = (MPT_SCSI_HOST *) ioc->sh->hostdata;
-				if (hd == NULL) {
-					printk(KERN_ERR MYNAM
-							": ERROR - TaskMgmt NULL SCSI Host!"
-							"(ioc=%p, sh=%p hd=%p)\n",
-							(void *) ioc, (void *) ioc->sh, (void *) hd);
-					continue;
-				}
-
-				spin_lock_irqsave(&ioc->FreeQlock, flags);
-				if (Q_IS_EMPTY(&hd->taskQ)) {
-					spin_unlock_irqrestore(&ioc->FreeQlock, flags);
-					continue;
-				}
-
-				/* If we ever find a non-empty queue,
-				 * keep the handler alive
-				 */
-				did++;
-
-				/* tmPending is SMP lock-protected */
-				if (hd->tmPending || hd->tmPtr) {
-					spin_unlock_irqrestore(&ioc->FreeQlock, flags);
-					continue;
-				}
-				hd->tmPending = 1;
-
-				/* Process this request
-				 */
-                                mf = hd->taskQ.head;
-				Q_DEL_ITEM(&mf->u.frame.linkage);
-				hd->taskQcnt--;
-				atomic_dec(&mpt_taskQdepth);
-				spin_unlock_irqrestore(&ioc->FreeQlock, flags);
-
-				SCpnt = (Scsi_Cmnd*)mf->u.frame.linkage.argp1;
-				if (SCpnt == NULL) {
-					printk(KERN_ERR MYNAM ": ERROR - TaskMgmt has NULL SCpnt! (mf=%p:sc=%p)\n",
-							(void *) mf, (void *) SCpnt);
-					mpt_free_msg_frame(ScsiTaskCtx, hd->ioc->id, mf);
-					spin_lock_irqsave(&ioc->FreeQlock, flags);
-					hd->tmPending = 0;
-					spin_unlock_irqrestore(&ioc->FreeQlock, flags);
-					continue;
-				}
-
-				/* Get the ScsiLookup index pointer
-				 * from the SC pointer.
-				 */
-				if (!SCpnt->host_scribble || ((MPT_SCSI_HOST *)SCpnt->host->hostdata != hd)) {
-					/* The command associated with the
-					 * abort/reset request must have
-					 * completed and this is a stale
-					 * request. We are done.
-					 * Free the current MF and continue.
-					 */
-					mpt_free_msg_frame(ScsiTaskCtx, hd->ioc->id, mf);
-					spin_lock_irqsave(&ioc->FreeQlock, flags);
-					hd->tmPending = 0;
-					spin_unlock_irqrestore(&ioc->FreeQlock, flags);
-					continue;
-				}
-
-				scpnt_idx = MFPTR_2_MPT_INDEX(hd->ioc, SCpnt->host_scribble);
-				if (scpnt_idx != SCPNT_TO_LOOKUP_IDX(SCpnt)) {
-					/* Error! this should never happen!!
-					 */
-					mpt_free_msg_frame(ScsiTaskCtx, hd->ioc->id, mf);
-					spin_lock_irqsave(&ioc->FreeQlock, flags);
-					hd->tmPending = 0;
-					spin_unlock_irqrestore(&ioc->FreeQlock, flags);
-					continue;
-				}
-
-				task_type = mf->u.frame.linkage.arg1;
-				ctx2abort = 0;
-				if (task_type == MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK) {
-					MPT_FRAME_HDR	*SCpntMf;
-
-					/*
-					 * Most important!  Set TaskMsgContext to SCpnt's MsgContext!
-					 * (the IO to be ABORT'd)
-					 *
-					 * NOTE: Since we do not byteswap MsgContext, we do not
-					 *	 swap it here either.  It is an opaque cookie to
-					 *	 the controller, so it does not matter. -DaveM
-					 */
-					SCpntMf = (MPT_FRAME_HDR *) SCpnt->host_scribble;
-					ctx2abort = SCpntMf->u.frame.hwhdr.msgctxu.MsgContext;
-
-					hd->abortSCpnt = SCpnt;
-					printk(KERN_WARNING MYNAM ": Attempting ABORT SCSI IO! (mf=%p:sc=%p)\n",
-							(void *) mf, (void *) SCpnt);
-				}
-
-				/* The TM handler will allocate a new mf,
-				 * so free the current mf.
-				 */
-				mpt_free_msg_frame(ScsiTaskCtx, hd->ioc->id, mf);
-				mf = NULL;
-
-				if (mptscsih_TMHandler(hd, task_type, SCpnt->target, SCpnt->lun, ctx2abort, NO_SLEEP) < 0) {
-
-					/* The TM request failed and the subsequent FW-reload failed!
-					 * Fatal error case.
-					 */
-					printk(KERN_WARNING MYNAM
-						": WARNING[1] - IOC error processing TaskMgmt request (sc=%p)\n", (void *) SCpnt);
-
-					if (hd->ScsiLookup[scpnt_idx] != NULL) {
-						atomic_dec(&queue_depth);
-						SCpnt->result = DID_SOFT_ERROR << 16;
-                                                MPT_HOST_LOCK(flags);
-						SCpnt->scsi_done(SCpnt);
-                                                MPT_HOST_UNLOCK(flags);
-						mpt_free_msg_frame(ScsiTaskCtx, hd->ioc->id, mf);
-					}
-					spin_lock_irqsave(&ioc->FreeQlock, flags);
-					hd->tmPending = 0;
-					spin_unlock_irqrestore(&ioc->FreeQlock, flags);
-					hd->abortSCpnt = NULL;
-				}
-			}
-		}
-		if (atomic_read(&mpt_taskQdepth) > 0)
-			did++;
-
-	} while ( did );
-
-	spin_lock_irqsave(&mytaskQ_lock, flags);
-	mytaskQ_bh_active = 0;
-	spin_unlock_irqrestore(&mytaskQ_lock, flags);
-
-	return;
-}
-#endif		/* } */
-
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
  *	mptscsih_taskmgmt_complete - Registered with Fusion MPT base driver
@@ -3977,19 +3172,6 @@
 		} else {
 			dtmprintk((KERN_INFO "  SCSI TaskMgmt SUCCESS!\n"));
 
-#ifndef MPT_SCSI_USE_NEW_EH
-			if (tmType == MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS) {
-				/* clean taskQ - remove tasks associated with
-				 * completed commands.
-				 */
-				clean_taskQ(hd);
-			} else if (tmType == MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK) {
-				/* If taskQ contains another request
-				 * for this SCpnt, delete this request.
-				 */
-				search_taskQ_for_cmd(hd->abortSCpnt, hd);
-			}
-#endif
 			hd->numTMrequests--;
 			hd->abortSCpnt = NULL;
 			flush_doneQ(hd);
@@ -4005,21 +3187,11 @@
 	mptscsih_flush_drop_test(hd);
 #endif
 
-#ifndef MPT_SCSI_USE_NEW_EH
-	/*
-	 *  Signal to _bh thread that we finished.
-	 *  This IOC can now process another TM command.
-	 */
-	dtmprintk((MYIOC_s_INFO_FMT "taskmgmt_complete: (=%p) done! Num Failed(%d) Task Count (%d)\n",
-			ioc->name, mf, hd->numTMrequests, hd->taskQcnt));
-#endif
 	hd->tmPtr = NULL;
 	spin_lock_irqsave(&ioc->FreeQlock, flags);
 	hd->tmPending = 0;
 	spin_unlock_irqrestore(&ioc->FreeQlock, flags);
-#ifdef MPT_SCSI_USE_NEW_EH
 	hd->tmState = TM_STATE_NONE;
-#endif
 
 	return 1;
 }
@@ -4029,19 +3201,9 @@
  *	This is anyones guess quite frankly.
  */
 int
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
 mptscsih_bios_param(struct scsi_device * sdev, struct block_device *bdev,
 		sector_t capacity, int *ip)
 {
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,28)
-mptscsih_bios_param(Disk * disk, struct block_device *bdev, int *ip)
-{
-	sector_t capacity = disk->capacity;
-#else
-mptscsih_bios_param(Disk * disk, kdev_t dev, int *ip)
-{
-	unsigned capacity = disk->capacity;
-#endif
 	int size;
 
 	size = capacity;
@@ -4057,86 +3219,306 @@
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
+ *	OS entry point to allow host driver to alloc memory
+ *	for each scsi device. Called once per device the bus scan.
+ *	Return non-zero if allocation fails.
+ *	Init memory once per id (not LUN).
+ */
+int
+mptscsih_slave_alloc(Scsi_Device *device)
+{
+	struct Scsi_Host	*host = device->host;
+	MPT_SCSI_HOST		*hd;
+	VirtDevice		*vdev;
+
+	hd = (MPT_SCSI_HOST *)host->hostdata;
+
+
+	if (hd == NULL)
+		return ENODEV;
+
+	if ((vdev = hd->Targets[device->id]) == NULL) {
+		if ((vdev = kmalloc(sizeof(VirtDevice), GFP_ATOMIC)) == NULL) {
+			printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%d) FAILED!\n",
+					hd->ioc->name, (int)sizeof(VirtDevice));
+			return ENOMEM;
+		} else {
+			memset(vdev, 0, sizeof(VirtDevice));
+			rwlock_init(&vdev->VdevLock);
+			Q_INIT(&vdev->WaitQ, void);
+			Q_INIT(&vdev->SentQ, void);
+			Q_INIT(&vdev->DoneQ, void);
+			vdev->tflags = 0;
+			vdev->ioc_id = hd->ioc->id;
+			vdev->target_id = device->id;
+			vdev->bus_id = hd->port;
+
+			hd->Targets[device->id] = vdev;
+		}
+	}
+	vdev->num_luns++;
+
+	return 0;
+}
+
+/*
+ *	OS entry point to allow for host driver to free allocated memory
+ *	Called if no device present or device being unloaded
+ */
+void
+mptscsih_slave_destroy(Scsi_Device *device)
+{
+	struct Scsi_Host	*host = device->host;
+	MPT_SCSI_HOST		*hd;
+	VirtDevice		*vdev;
+
+	hd = (MPT_SCSI_HOST *)host->hostdata;
+	
+	if (hd == NULL)
+		return;
+
+	mptscsih_search_running_cmds(hd, device->id, device->lun);
+
+	/* Free memory and reset all flags for this target
+	 */
+	if ((vdev = hd->Targets[device->id]) != NULL) {
+		vdev->num_luns--;
+
+		if (vdev->luns & (1 << device->lun))
+			vdev->luns &= ~(1 << device->lun);
+
+		/* Free device structure only if number of luns is 0.
+		 */
+		if (vdev->num_luns == 0) {
+			kfree(hd->Targets[device->id]);
+			hd->Targets[device->id] = NULL;
+
+			if (hd->is_spi) {
+				hd->ioc->spi_data.dvStatus[device->id] = MPT_SCSICFG_NEGOTIATE;
+
+				if (hd->negoNvram == 0)
+					hd->ioc->spi_data.dvStatus[device->id] |= MPT_SCSICFG_DV_NOT_DONE;
+
+				/* Don't alter isRaid, not allowed to move
+				 * volumes on a running system.
+				 */
+				if (hd->ioc->spi_data.isRaid & (1 << (device->id)))
+					hd->ioc->spi_data.forceDv |= MPT_SCSICFG_RELOAD_IOC_PG3;
+			}
+		}
+	}
+
+	return;
+}
+
+/*
  *	OS entry point to adjust the queue_depths on a per-device basis.
  *	Called once per device the bus scan. Use it to force the queue_depth
  *	member to 1 if a device does not support Q tags.
+ *	Return non-zero if fails.
  */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52)
 int
 mptscsih_slave_configure(Scsi_Device *device)
 {
 	struct Scsi_Host	*host = device->host;
-	VirtDevice		*pTarget;
+	VirtDevice		*vdev;
 	MPT_SCSI_HOST		*hd;
 
 	hd = (MPT_SCSI_HOST *)host->hostdata;
+
+	dsprintk((KERN_INFO "slave_configure: device @ %p, id=%d, LUN=%d, channel=%d\n",
+		device, device->id, device->lun, device->channel));
+	dsprintk((KERN_INFO "sdtr %d wdtr %d ppr %d inq length=%d\n",
+		device->sdtr, device->wdtr, device->ppr, device->inquiry_len));
+	dsprintk(("tagged %d queue %d simple %d ordered %d\n",
+		device->tagged_supported, device->tagged_queue,
+		device->simple_tags, device->ordered_tags));
+
+	/*	set target parameters, queue depths, set dv flags ?  */
 	if (hd && (hd->Targets != NULL)) {
-		pTarget = hd->Targets[device->id];
-		if (pTarget) {
+		vdev = hd->Targets[device->id];
+
+		if (vdev && !(vdev->tflags & MPT_TARGET_FLAGS_CONFIGURED)) {
+			/* Configure only the first discovered LUN
+			 */
+			vdev->raidVolume = 0;
+			if (hd->is_spi && (hd->ioc->spi_data.isRaid & (1 << (device->id)))) {
+				vdev->raidVolume = 1;
+				ddvtprintk((KERN_INFO "RAID Volume @ id %d\n", target_id));
+			}
+
+			mptscsih_target_settings(hd, vdev, device);
+
+			vdev->tflags |= MPT_TARGET_FLAGS_CONFIGURED;
+		}
+
+		if (vdev) {
+			/* set the queue depth for all devices
+			 */
 			if (!device->tagged_supported ||
-			    !(pTarget->tflags & MPT_TARGET_FLAGS_Q_YES)) {
+			    !(vdev->tflags & MPT_TARGET_FLAGS_Q_YES)) {
 				scsi_adjust_queue_depth(device, 0, 1);
-
-			} else if ((pTarget->tflags & MPT_TARGET_FLAGS_VALID_INQUIRY)
-				   && (pTarget->inq_data[0] & 0x1f) == 0x00
-				   && (pTarget->minSyncFactor <= MPT_ULTRA160 || !hd->is_spi)) {
+			} else if (vdev->type == 0x00
+				   && (vdev->minSyncFactor <= MPT_ULTRA160 || !hd->is_spi)) {
 				scsi_adjust_queue_depth(device, MSG_SIMPLE_TAG,
 							MPT_SCSI_CMD_PER_DEV_HIGH);
 			} else {
 				scsi_adjust_queue_depth(device, MSG_SIMPLE_TAG,
 							MPT_SCSI_CMD_PER_DEV_LOW);
 			}
+
+			vdev->luns |= (1 << device->lun);
+			vdev->tflags |= MPT_TARGET_FLAGS_CONFIGURED;
 		}
 	}
 	return 0;
 }
-#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52) */
-void
-mptscsih_select_queue_depths(struct Scsi_Host *sh, Scsi_Device *sdList)
+/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
+/*
+ *  Update the target negotiation parameters based on the
+ *  the Inquiry data, adapter capabilities, and NVRAM settings.
+ *
+ */
+static void
+mptscsih_target_settings(MPT_SCSI_HOST *hd, VirtDevice *target, Scsi_Device *sdev)
 {
-	struct scsi_device	*device;
-	VirtDevice		*pTarget;
-	MPT_SCSI_HOST		*hd;
-	int			 ii, max;
+	ScsiCfgData *pspi_data = &hd->ioc->spi_data;
+	int  id = (int) target->target_id;
+	int  nvram;
+	u8 width = MPT_NARROW;
+	u8 factor = MPT_ASYNC;
+	u8 offset = 0;
+	u8 nfactor;
+	u8 noQas = 1;
 
-	for (device = sdList; device != NULL; device = device->next) {
+	ddvtprintk((KERN_INFO "set Target: (id %d) \n", id));
 
-		if (device->host != sh)
-			continue;
+	if (!hd->is_spi) {
+		/* FC - only care about QTag support
+	 	 */
+		if (sdev->tagged_supported)
+			target->tflags |= MPT_TARGET_FLAGS_Q_YES;
+		return;
+	}
 
-		hd = (MPT_SCSI_HOST *) sh->hostdata;
-		if (hd == NULL)
-			continue;
+	/* SCSI - Set flags based on Inquiry data
+	 */
+	if (sdev->scsi_level < 2) {
+		width = 0;
+		factor = MPT_ULTRA2;
+		offset = pspi_data->maxSyncOffset;
+	} else {
+		width = sdev->wdtr;
+		if (sdev->sdtr) {
+			if (sdev->ppr) {
+				/* U320 requires IU capability */
+				if ((sdev->inquiry_len > 56) && (sdev->inquiry[56] & 0x01))
+					factor = MPT_ULTRA320;
+				else
+					factor = MPT_ULTRA160;
+			} else
+				factor = MPT_ULTRA2;
 
-		if (hd->Targets != NULL) {
-			if (hd->is_spi)
-				max = MPT_MAX_SCSI_DEVICES;
-			else
-				max = MPT_MAX_FC_DEVICES<256 ? MPT_MAX_FC_DEVICES : 255;
+			/* If RAID, never disable QAS
+			 * else if non RAID, do not disable
+			 *   QAS if bit 1 is set
+			 * bit 1 QAS support, non-raid only
+			 * bit 0 IU support
+			 */
+			if ((target->raidVolume == 1) ||
+			    ((sdev->inquiry_len > 56) && (sdev->inquiry[56] & 0x02)))
+				noQas = 0;
 
-			for (ii=0; ii < max; ii++) {
-				pTarget = hd->Targets[ii];
-				if (pTarget == NULL) {
-					continue;
-				}
-				if (!(pTarget->tflags & MPT_TARGET_FLAGS_Q_YES)) {
-					device->queue_depth = 1;
-				} else if ((pTarget->tflags & MPT_TARGET_FLAGS_VALID_INQUIRY)
-					   && (pTarget->inq_data[0] & 0x1f) == 0x00
-					   && (pTarget->minSyncFactor <= MPT_ULTRA160 || !hd->is_spi)) {
-					device->queue_depth = MPT_SCSI_CMD_PER_DEV_HIGH;
-				} else {
-					device->queue_depth = MPT_SCSI_CMD_PER_DEV_LOW;
-				}
-				dprintk((MYIOC_s_INFO_FMT
-					 "target = %d, sync factor = %#x, queue depth = %d\n",
-					 hd->ioc->name, pTarget->target_id,
-					 pTarget->minSyncFactor, device->queue_depth));
+			offset = pspi_data->maxSyncOffset;
+
+		} else {
+			factor = MPT_ASYNC;
+			offset = 0;
+		}
+	}
+
+	/* Update tflags based on NVRAM settings. (SCSI only)
+	 */
+	if (pspi_data->nvram && (pspi_data->nvram[id] != MPT_HOST_NVRAM_INVALID)) {
+		nvram = pspi_data->nvram[id];
+		nfactor = (nvram & MPT_NVRAM_SYNC_MASK) >> 8;
+
+		if (width)
+			width = nvram & MPT_NVRAM_WIDE_DISABLE ? 0 : 1;
+
+		if (offset > 0) {
+			/* Ensure factor is set to the
+			 * maximum of: adapter, nvram, inquiry
+			 */
+			if (nfactor) {
+				if (nfactor < pspi_data->minSyncFactor )
+					nfactor = pspi_data->minSyncFactor;
+
+				factor = MAX (factor, nfactor);
+				if (factor == MPT_ASYNC)
+					offset = 0;
+			} else {
+				offset = 0;
+				factor = MPT_ASYNC;
 			}
+		} else
+			factor = MPT_ASYNC;
+	}
+
+	/* Make sure data is consistent
+	 */
+	if ((!width) && (factor < MPT_ULTRA2))
+		factor = MPT_ULTRA2;
+
+	/* Save the data to the target structure.
+	 */
+	target->minSyncFactor = factor;
+	target->maxOffset = offset;
+	target->maxWidth = width;
+	if (sdev->tagged_supported)
+		target->tflags |= MPT_TARGET_FLAGS_Q_YES;
+
+	/* Disable unused features.
+	 */
+	target->negoFlags = pspi_data->noQas;
+	if (!width)
+		target->negoFlags |= MPT_TARGET_NO_NEGO_WIDE;
+
+	if (!offset)
+		target->negoFlags |= MPT_TARGET_NO_NEGO_SYNC;
+
+	if (noQas)
+		target->negoFlags |= MPT_TARGET_NO_NEGO_QAS;
+
+	/* GEM, processor WORKAROUND
+	 */
+	target->type = sdev->inquiry[0] & 0x1F;
+	if ((target->type == 0x03) || (target->type > 0x08)){
+		target->negoFlags |= (MPT_TARGET_NO_NEGO_WIDE | MPT_TARGET_NO_NEGO_SYNC);
+		pspi_data->dvStatus[id] |= MPT_SCSICFG_BLK_NEGO;
+	}
+
+	/* Disable QAS if mixed configuration case
+	 */
+	if ((noQas) && (!pspi_data->noQas) && (target->type == 0x00)){
+		VirtDevice	*vdev;
+		int ii;
+
+		ddvtprintk((KERN_INFO "Disabling QAS!\n"));
+		pspi_data->noQas = MPT_TARGET_NO_NEGO_QAS;
+		for (ii = 0; ii < id; ii++) {
+			vdev = hd->Targets[id];
+			if (vdev != NULL)
+				vdev->negoFlags |= MPT_TARGET_NO_NEGO_QAS;
 		}
 	}
+
+	ddvtprintk((KERN_INFO "Final settings id %d: dvstatus 0x%x\n", sdev->id, pspi_data->dvStatus[id]));
+	ddvtprintk(("wide %d, factor 0x%x offset 0x%x neg flags 0x%x flags 0x%x\n",
+			width, factor, offset, target->negoFlags, target->tflags));
+
+	return;
 }
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52) */
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
@@ -4175,34 +3557,6 @@
 		sense_data = ((u8 *)hd->ioc->sense_buf_pool + (req_index * MPT_SENSE_BUFFER_ALLOC));
 		memcpy(sc->sense_buffer, sense_data, SNS_LEN(sc));
 
-		/* save sense data to the target device
-		 */
-		if (target) {
-#ifdef MPT_SAVE_AUTOSENSE
-			int sz;
-
-			sz = MIN(pReq->SenseBufferLength, sense_count);
-			if (sz > SCSI_STD_SENSE_BYTES)
-				sz =  SCSI_STD_SENSE_BYTES;
-			memcpy(target->sense, sense_data, sz);
-			target->tflags |= MPT_TARGET_FLAGS_VALID_SENSE;
-#endif
-
-#ifdef ABORT_FIX
-			if (sz >= SCSI_STD_SENSE_BYTES) {
-				if ((sense_data[02] == ABORTED_COMMAND) &&
-					(sense_data[12] == 0x47) && (sense_data[13] == 0x00)){
-					target->numAborts++;
-					if ((target->raidVolume == 0) && (target->numAborts > 5)) {
-						target->numAborts = 0;
-						target->minSyncFactor++;
-						hd->ioc->spi_data.dvStatus[index] |= MPT_SCSICFG_NEGOTIATE;
-					}
-				}
-			}
-#endif
-		}
-
 		/* Log SMART data (asc = 0x5D, non-IM case only) if required.
 		 */
 		if ((hd->ioc->events) && (hd->ioc->eventTypes & (1 << MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE))) {
@@ -4440,13 +3794,6 @@
 			mpt_free_msg_frame(ScsiTaskCtx, ioc->id, hd->tmPtr);
 		}
 
-#ifndef MPT_SCSI_USE_NEW_EH
-		/* 2e. Delete all commands on taskQ
-		 * Should be superfluous - as this taskQ should
-		 * be empty.
-		 */
-		clean_taskQ(hd);
-#endif
 		dtmprintk((MYIOC_s_WARN_FMT "Pre-Reset handling complete.\n",
 			ioc->name));
 
@@ -4489,9 +3836,7 @@
 		spin_unlock_irqrestore(&ioc->FreeQlock, flags);
 		hd->resetPending = 0;
 		hd->numTMrequests = 0;
-#ifdef MPT_SCSI_USE_NEW_EH
 		hd->tmState = TM_STATE_NONE;
-#endif
 
 		/* 6. If there was an internal command,
 		 * wake this process up.
@@ -4517,8 +3862,10 @@
 
 		/* 8. Set flag to force DV and re-read IOC Page 3
 		 */
-		ioc->spi_data.forceDv = MPT_SCSICFG_NEED_DV | MPT_SCSICFG_RELOAD_IOC_PG3;
-		ddvtprintk(("Set reload IOC Pg3 Flag\n"));
+		if (hd->is_spi) {
+			ioc->spi_data.forceDv = MPT_SCSICFG_NEED_DV | MPT_SCSICFG_RELOAD_IOC_PG3;
+			ddvtprintk(("Set reload IOC Pg3 Flag\n"));
+		}
 
 	}
 
@@ -4642,22 +3989,6 @@
 	return 1;		/* currently means nothing really */
 }
 
-#if 0		/* { */
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *	scsiherr.c - Fusion MPT SCSI Host driver error handling/reporting.
- *
- *	drivers/message/fusion/scsiherr.c
- */
-
-//extern const char	**mpt_ScsiOpcodesPtr;	/* needed by mptscsih.c */
-//extern ASCQ_Table_t	 *mpt_ASCQ_TablePtr;
-//extern int		  mpt_ASCQ_TableSz;
-
-#define MYNAM	"mptscsih"
-
-#endif		/* } */
-
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
  *  Private data...
@@ -4688,44 +4019,6 @@
     = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 
-#if 0
-static const char *PeripheralDeviceTypeString[32] = {
-	"Direct-access",		/* 00h */
-	"Sequential-access",		/* 01h */
-	"Printer",			/* 02h */
-	"Processor",			/* 03h */
-			/*"Write-Once-Read-Multiple",*/	/* 04h */
-	"WORM",				/* 04h */
-	"CD-ROM",			/* 05h */
-	"Scanner",			/* 06h */
-	"Optical memory",		/* 07h */
-	"Media Changer",		/* 08h */
-	"Communications",		/* 09h */
-	"(Graphics arts pre-press)",	/* 0Ah */
-	"(Graphics arts pre-press)",	/* 0Bh */
-	"Array controller",		/* 0Ch */
-	"Enclosure services",		/* 0Dh */
-	"Simplified direct-access",	/* 0Eh */
-	"Reserved-0Fh",			/* 0Fh */
-	"Reserved-10h",			/* 10h */
-	"Reserved-11h",			/* 11h */
-	"Reserved-12h",			/* 12h */
-	"Reserved-13h",			/* 13h */
-	"Reserved-14h",			/* 14h */
-	"Reserved-15h",			/* 15h */
-	"Reserved-16h",			/* 16h */
-	"Reserved-17h",			/* 17h */
-	"Reserved-18h",			/* 18h */
-	"Reserved-19h",			/* 19h */
-	"Reserved-1Ah",			/* 1Ah */
-	"Reserved-1Bh",			/* 1Bh */
-	"Reserved-1Ch",			/* 1Ch */
-	"Reserved-1Dh",			/* 1Dh */
-	"Reserved-1Eh",			/* 1Eh */
-	"Unknown"			/* 1Fh */
-};
-#endif
-
 static char *ScsiStatusString[] = {
 	"GOOD",					/* 00h */
 	NULL,					/* 01h */
@@ -4825,52 +4118,6 @@
 #define SPECIAL_ASCQ(c,q) \
 	(((c) == 0x40 && (q) != 0x00) || ((c) == 0x4D) || ((c) == 0x70))
 
-#if 0
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *  Sense_Key_Specific() - If Sense_Key_Specific_Valid bit is set,
- *			   then print additional information via
- *			   a call to SDMS_SystemAlert().
- */
-static void Sense_Key_Specific(IO_Info_t *ioop, char *msg1)
-{
-	u8	*sd;
-	u8	 BadValue;
-	u8	 SenseKey;
-	int	 Offset;
-	int	 len = strlen(msg1);
-
-	sd = ioop->sensePtr;
-	if (SD_Additional_Sense_Length(sd) < 8)
-		return;
-
-	SenseKey = SD_Sense_Key(sd);
-
-	if (SD_Sense_Key_Specific_Valid(sd)) {
-		if (SenseKey == SK_ILLEGAL_REQUEST) {
-			Offset = SD_Bad_Byte(sd);
-			if (SD_Was_Illegal_Request(sd)) {
-				BadValue = ioop->cdbPtr[Offset];
-				len += sprintf(msg1+len, "\n  Illegal CDB value=%02Xh found at CDB ",
-						BadValue);
-		} else {
-			BadValue = ioop->dataPtr[Offset];
-			len += sprintf(msg1+len, "\n  Illegal DATA value=%02Xh found at DATA ",
-					BadValue);
-		}
-		len += sprintf(msg1+len, "byte=%02Xh", Offset);
-		if (SD_SKS_Bit_Pointer_Valid(sd))
-			len += sprintf(msg1+len, "/bit=%1Xh", SD_SKS_Bit_Pointer(sd));
-		} else if ((SenseKey == SK_RECOVERED_ERROR) ||
-			   (SenseKey == SK_HARDWARE_ERROR) ||
-			   (SenseKey == SK_MEDIUM_ERROR)) {
-			len += sprintf(msg1+len, "\n  Recovery algorithm Actual_Retry_Count=%02Xh",
-			SD_Actual_Retry_Count(sd));
-		}
-	}
-}
-#endif
-
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 static int dump_cdb(char *foo, unsigned char *cdb)
 {
@@ -4894,21 +4141,6 @@
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-#if 0
-static int dump_sd(char *foo, unsigned char *sd)
-{
-	int snsLen = 8 + SD_Additional_Sense_Length(sd);
-	int l = 0;
-	int i;
-
-	for (i=0; i < MIN(snsLen,18); i++)
-		l += sprintf(foo+l, " %02X", sd[i]);
-	l += sprintf(foo+l, "%s", snsLen>18 ? " ..." : "");
-
-	return l;
-}
-#endif
-
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*  Do ASC/ASCQ lookup/grindage to English readable string(s)  */
 static const char * ascq_set_strings_4max(
@@ -5141,269 +4373,6 @@
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *	mptscsih_initTarget - Target, LUN alloc/free functionality.
- *	@hd: Pointer to MPT_SCSI_HOST structure
- *	@bus_id: Bus number (?)
- *	@target_id: SCSI target id
- *	@lun: SCSI LUN id
- *	@data: Pointer to data
- *	@dlen: Number of INQUIRY bytes
- *
- *	NOTE: It's only SAFE to call this routine if data points to
- *	sane & valid STANDARD INQUIRY data!
- *
- *	Allocate and initialize memory for this target.
- *	Save inquiry data.
- *
- *	Returns pointer to VirtDevice structure.
- */
-static VirtDevice *
-mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *data, int dlen)
-{
-	VirtDevice	*vdev;
-	int		 sz;
-
-	dprintk((MYIOC_s_INFO_FMT "initTarget (%d,%d,%d) called, hd=%p\n",
-			hd->ioc->name, bus_id, target_id, lun, hd));
-
-	if ((vdev = hd->Targets[target_id]) == NULL) {
-		if ((vdev = kmalloc(sizeof(VirtDevice), GFP_ATOMIC)) == NULL) {
-			printk(MYIOC_s_ERR_FMT "initTarget kmalloc(%d) FAILED!\n",
-					hd->ioc->name, (int)sizeof(VirtDevice));
-		} else {
-			memset(vdev, 0, sizeof(VirtDevice));
-			rwlock_init(&vdev->VdevLock);
-			Q_INIT(&vdev->WaitQ, void);
-			Q_INIT(&vdev->SentQ, void);
-			Q_INIT(&vdev->DoneQ, void);
-			vdev->tflags = 0;
-			vdev->ioc_id = hd->ioc->id;
-			vdev->target_id = target_id;
-			vdev->bus_id = bus_id;
-
-			hd->Targets[target_id] = vdev;
-			dprintk((KERN_INFO "  *NEW* Target structure (id %d) @ %p\n",
-					target_id, vdev));
-		}
-	}
-
-	if (vdev) {
-		if (hd->ioc->spi_data.isRaid & (1 << target_id)) {
-			vdev->raidVolume = 1;
-			ddvtprintk((KERN_INFO "RAID Volume @ id %d\n", target_id));
-		} else
-			vdev->raidVolume = 0;
-	}
-
-	if (vdev && data) {
-		if ((!(vdev->tflags & MPT_TARGET_FLAGS_VALID_INQUIRY)) ||
-		((dlen > 56) && (!(vdev->tflags & MPT_TARGET_FLAGS_VALID_56)))) {
-
-			/* Copy the inquiry data  - if we haven't yet.
-			*/
-			sz = MIN(dlen, SCSI_STD_INQUIRY_BYTES);
-
-			memcpy (vdev->inq_data, data, sz);
-			vdev->tflags |= MPT_TARGET_FLAGS_VALID_INQUIRY;
-
-			/* Update the target capabilities
-			 */
-			if (dlen > 56) {
-				mptscsih_setTargetNegoParms(hd, vdev, data[56]);
-				vdev->tflags |= MPT_TARGET_FLAGS_VALID_56;
-			} else
-				mptscsih_setTargetNegoParms(hd, vdev, 0);
-
-			/* If LUN 0, tape and have not done DV, set the DV flag.
-			 */
-			if ((lun == 0) && ((data[0] & 0x1F) == 0x01)) {
-				ScsiCfgData *pSpi = &hd->ioc->spi_data;
-				if (pSpi->dvStatus[target_id] & MPT_SCSICFG_DV_NOT_DONE)
-					pSpi->dvStatus[target_id] |= MPT_SCSICFG_NEED_DV;
-			}
-		}
-
-		/* Is LUN supported? If so, upper 3 bits will be 0
-		 * in first byte of inquiry data.
-		 */
-		if ((*data & 0xe0) == 0)
-			vdev->luns |= (1 << lun);
-	}
-
-
-	dprintk((KERN_INFO "  target = %p\n", vdev));
-	return vdev;
-}
-
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *  Update the target negotiation parameters based on the
- *  the Inquiry data, adapter capabilities, and NVRAM settings.
- *
- */
-void mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byte56)
-{
-	ScsiCfgData *pspi_data = &hd->ioc->spi_data;
-	int  id = (int) target->target_id;
-	int  nvram;
-	char canQ = 0;
-	u8 width = MPT_NARROW;
-	u8 factor = MPT_ASYNC;
-	u8 offset = 0;
-	u8 version, nfactor;
-	u8 noQas = 1;
-
-	ddvtprintk((KERN_INFO "set Target: (id %d) byte56 0x%x\n", id, byte56));
-
-	/* Set flags based on Inquiry data
-	 */
-	if (target->tflags & MPT_TARGET_FLAGS_VALID_INQUIRY) {
-		version = target->inq_data[2] & 0x07;
-		if (version < 2) {
-			width = 0;
-			factor = MPT_ULTRA2;
-			offset = pspi_data->maxSyncOffset;
-		} else {
-			if (target->inq_data[7] & 0x20) {
-				width = 1;
-			}
-
-			if (target->inq_data[7] & 0x10) {
-				/* bits 2 & 3 show DT support
-				 */
-				if ((byte56 & 0x04) == 0)
-					factor = MPT_ULTRA2;
-				else if ((byte56 & 0x03) == 0)
-					factor = MPT_ULTRA160;
-				else
-					factor = MPT_ULTRA320;
-
-				/* If RAID, never disable QAS
-				 * else if non RAID, do not disable
-				 *   QAS if bit 1 is set
-				 * bit 1 QAS support, non-raid only
-				 * bit 0 IU support
-				 */
-				if ((target->raidVolume == 1) || ((byte56 & 0x02) != 0))
-					noQas = 0;
-
-				offset = pspi_data->maxSyncOffset;
-			} else {
-				factor = MPT_ASYNC;
-				offset = 0;
-			}
-		}
-
-		if (target->inq_data[7] & 0x02) {
-			canQ = 1;
-		}
-
-		/* Update tflags based on NVRAM settings. (SCSI only)
-		 */
-		if (pspi_data->nvram && (pspi_data->nvram[id] != MPT_HOST_NVRAM_INVALID)) {
-			nvram = pspi_data->nvram[id];
-			nfactor = (nvram & MPT_NVRAM_SYNC_MASK) >> 8;
-
-			if (width)
-				width = nvram & MPT_NVRAM_WIDE_DISABLE ? 0 : 1;
-
-			if (offset > 0) {
-				/* Ensure factor is set to the
-				 * maximum of: adapter, nvram, inquiry
-				 */
-				if (nfactor) {
-					if (nfactor < pspi_data->minSyncFactor )
-						nfactor = pspi_data->minSyncFactor;
-
-					factor = MAX (factor, nfactor);
-					if (factor == MPT_ASYNC)
-						offset = 0;
-				} else {
-					offset = 0;
-					factor = MPT_ASYNC;
-				}
-			} else {
-				factor = MPT_ASYNC;
-			}
-		}
-
-		/* Make sure data is consistent
-		 */
-		if ((!width) && (factor < MPT_ULTRA2)) {
-			factor = MPT_ULTRA2;
-		}
-
-		/* Save the data to the target structure.
-		 */
-		target->minSyncFactor = factor;
-		target->maxOffset = offset;
-		target->maxWidth = width;
-		if (canQ) {
-			target->tflags |= MPT_TARGET_FLAGS_Q_YES;
-		}
-
-		target->tflags |= MPT_TARGET_FLAGS_VALID_NEGO;
-
-		/* Disable unused features.
-		 */
-		target->negoFlags = pspi_data->noQas;
-		if (!width)
-			target->negoFlags |= MPT_TARGET_NO_NEGO_WIDE;
-
-		if (!offset)
-			target->negoFlags |= MPT_TARGET_NO_NEGO_SYNC;
-
-		if (noQas)
-			target->negoFlags |= MPT_TARGET_NO_NEGO_QAS;
-
-		/* GEM, processor WORKAROUND
-		 */
-		if (((target->inq_data[0] & 0x1F) == 0x03) || ((target->inq_data[0] & 0x1F) > 0x08)){
-			target->negoFlags |= (MPT_TARGET_NO_NEGO_WIDE | MPT_TARGET_NO_NEGO_SYNC);
-			pspi_data->dvStatus[id] |= MPT_SCSICFG_BLK_NEGO;
-		}
-
-		/* Disable QAS if mixed configuration case
-		 */
-		if ((noQas) && (!pspi_data->noQas) && ((target->inq_data[0] & 0x1F) == 0x00)){
-			VirtDevice	*vdev;
-			int ii;
-
-			ddvtprintk((KERN_INFO "Disabling QAS!\n"));
-			pspi_data->noQas = MPT_TARGET_NO_NEGO_QAS;
-			for (ii = 0; ii < id; ii++) {
-				vdev = hd->Targets[id];
-				if (vdev != NULL)
-					vdev->negoFlags |= MPT_TARGET_NO_NEGO_QAS;
-			}
-		}
-
-	}
-
-	return;
-}
-
-#ifdef MPT_SAVE_AUTOSENSE
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *  Clear sense valid flag.
- */
-static void clear_sense_flag(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq)
-{
-	VirtDevice	*target;
-	int		 index = (int) pReq->TargetID;
-
-	if ((target = hd->Targets[index])) {
-		target->tflags &= ~MPT_TARGET_FLAGS_VALID_SENSE;
-	}
-
-	return;
-}
-#endif
-
 /* If DV disabled (negoNvram set to USE_NVARM) or if not LUN 0, return.
  * Else set the NEED_DV flag after Read Capacity Issued (disks)
  * or Mode Sense (cdroms).
@@ -5442,14 +4411,16 @@
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
- * If no Target, bus reset on 1st I/O. Set the flag to
- * prevent any future negotiations to this device.
+ * If no Target (old) or Target unconfigured (new) and bus reset on 1st I/O,
+ * set the flag to prevent any future negotiations to this device.
  */
 static void mptscsih_no_negotiate(MPT_SCSI_HOST *hd, int target_id)
 {
-
-	if ((hd->Targets) && (hd->Targets[target_id] == NULL))
-		hd->ioc->spi_data.dvStatus[target_id] |= MPT_SCSICFG_BLK_NEGO;
+	if (hd->Targets) {
+		VirtDevice *vdev = hd->Targets[target_id];
+		if ((vdev == NULL) || !(vdev->tflags & MPT_TARGET_FLAGS_CONFIGURED))
+			hd->ioc->spi_data.dvStatus[target_id] |= MPT_SCSICFG_BLK_NEGO;
+	}
 
 	return;
 }
@@ -5615,7 +4586,8 @@
 		/* If id is not a raid volume, get the updated
 		 * transmission settings from the target structure.
 		 */
-		if (hd->Targets && (pTarget = hd->Targets[id]) && !pTarget->raidVolume) {
+		if (hd->Targets && (pTarget = hd->Targets[id]) && !pTarget->raidVolume
+				&& (pTarget->tflags & MPT_TARGET_FLAGS_CONFIGURED)) {
 			width = pTarget->maxWidth;
 			factor = pTarget->minSyncFactor;
 			offset = pTarget->maxOffset;
@@ -5691,7 +4663,7 @@
 		pData->Reserved = 0;
 		pData->Configuration = cpu_to_le32(configuration);
 
-		dprintk((MYIOC_s_INFO_FMT
+		dsprintk((MYIOC_s_INFO_FMT
 			"write SDP1: id %d pgaddr 0x%x req 0x%x config 0x%x\n",
 				ioc->name, id, (id | (bus<<8)),
 				requested, configuration));
@@ -5726,9 +4698,7 @@
 	 */
 	if (mpt_HardResetHandler(hd->ioc, NO_SLEEP) < 0) {
 		printk((KERN_WARNING " Firmware Reload FAILED!!\n"));
-	}
-#ifdef MPT_SCSI_USE_NEW_EH
-	else {
+	} else {
 		/* Because we have reset the IOC, no TM requests can be
 		 * pending.  So let's make sure the tmPending flag is reset.
 		 */
@@ -5737,7 +4707,6 @@
 			   hd->ioc->name));
 		hd->tmPending = 0;
 	}
-#endif
 
 	return;
 }
@@ -5805,10 +4774,6 @@
 
 	/* If target struct exists, clear sense valid flag.
 	 */
-#ifdef MPT_SAVE_AUTOSENSE
-	clear_sense_flag(hd, pReq);
-#endif
-
 	if (mr == NULL) {
 		completionCode = MPT_SCANDV_GOOD;
 	} else {
@@ -5859,9 +4824,6 @@
 					completionCode = MPT_SCANDV_SOME_ERROR;
 
 			} else if (pReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) {
-#ifdef MPT_SAVE_AUTOSENSE
-				VirtDevice	*target;
-#endif
 				u8		*sense_data;
 				int		 sz;
 
@@ -5876,15 +4838,6 @@
 							SCSI_STD_SENSE_BYTES);
 				memcpy(hd->pLocal->sense, sense_data, sz);
 
-#ifdef MPT_SAVE_AUTOSENSE
-				target = hd->Targets[pReq->TargetID];
-				if (target) {
-					memcpy(target->sense, sense_data, sz);
-					target->tflags
-						|= MPT_TARGET_FLAGS_VALID_SENSE;
-				}
-#endif
-
 				ddvprintk((KERN_NOTICE "  Check Condition, sense ptr %p\n",
 						sense_data));
 			} else if (pReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_FAILED) {
@@ -5949,10 +4902,6 @@
 static void mptscsih_timer_expired(unsigned long data)
 {
 	MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) data;
-#ifndef MPT_SCSI_USE_NEW_EH
-	unsigned long  flags;
-#endif
-
 
 	ddvprintk((MYIOC_s_WARN_FMT "Timer Expired! Cmd %p\n", hd->ioc->name, hd->cmdPtr));
 
@@ -5966,22 +4915,7 @@
 			 * If new eh code, do nothing. Wait for OS cmd timeout
 			 *	for bus reset.
 			 */
-#ifndef MPT_SCSI_USE_NEW_EH
-			spin_lock_irqsave(&hd->ioc->FreeQlock, flags);
-			if (hd->tmPending) {
-				spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
-				return;
-			} else
-				hd->tmPending = 1;
-			spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
-
-			if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
-							0, 0, 0, NO_SLEEP) < 0) {
-				printk(MYIOC_s_WARN_FMT "TM FAILED!\n", hd->ioc->name);
-			}
-#else
 			ddvtprintk((MYIOC_s_NOTE_FMT "DV Cmd Timeout: NoOp\n", hd->ioc->name));
-#endif
 		} else {
 			/* Perform a FW reload */
 			if (mpt_HardResetHandler(hd->ioc, NO_SLEEP) < 0) {
@@ -6440,7 +5374,6 @@
 
 		/* If target Ptr NULL or if this target is NOT a disk, skip.
 		 */
-	//	if (pTarget && ((pTarget->inq_data[0] & 0x1F) == 0)) {
 		if ((pTarget) && (pTarget->tflags & MPT_TARGET_FLAGS_Q_YES)){
 			for (lun=0; lun <= MPT_LAST_LUN; lun++) {
 				/* If LUN present, issue the command
@@ -6768,11 +5701,11 @@
 	iocmd.rsvd = iocmd.rsvd2 = 0;
 
 	pTarget = hd->Targets[id];
-	if (pTarget && (pTarget->tflags & MPT_TARGET_FLAGS_VALID_INQUIRY)) {
+	if (pTarget && (pTarget->tflags & MPT_TARGET_FLAGS_CONFIGURED)) {
 		/* Another GEM workaround. Check peripheral device type,
 		 * if PROCESSOR, quit DV.
 		 */
-		if (((pTarget->inq_data[0] & 0x1F) == 0x03) || ((pTarget->inq_data[0] & 0x1F) > 0x08)) {
+		if ((pTarget->type == 0x03) || (pTarget->type > 0x08)) {
 			pTarget->negoFlags |= (MPT_TARGET_NO_NEGO_WIDE | MPT_TARGET_NO_NEGO_SYNC);
 			return 0;
 		}
@@ -6853,6 +5786,14 @@
 		dv.cmd = MPT_SET_MAX;
 		mptscsih_dv_parms(hd, &dv, (void *)pcfg1Data);
 		cfg.hdr = &header1;
+		/* Double writes to SDP1 can cause problems,
+		 * skip save of the final negotiated settings to
+		 * SCSI device page 1.
+		 */
+		cfg.physAddr = cfg1_dma_addr;
+		cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT;
+		cfg.dir = 1;
+		mpt_config(hd->ioc, &cfg);
 		goto target_done;
 	}
 
@@ -7491,19 +6432,16 @@
 		dv.cmd = MPT_SAVE;
 		mptscsih_dv_parms(hd, &dv, (void *)pcfg1Data);
 
-#if 0	
-	/* Double writes to SDP1 can cause problems,
-	 * skip here since unnecessary
-	 */
-		/* Save the final negotiated settings to
+		/* Double writes to SDP1 can cause problems,
+		 * skip save of the final negotiated settings to
 		 * SCSI device page 1.
-		 */
+		 *
 		cfg.hdr = &header1;
 		cfg.physAddr = cfg1_dma_addr;
 		cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT;
 		cfg.dir = 1;
 		mpt_config(hd->ioc, &cfg);
-#endif
+		 */
 	}
 
 	/* If this is a RAID Passthrough, enable internal IOs
diff -Nru a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
--- a/drivers/message/fusion/mptscsih.h	Sun Feb 23 22:25:27 2003
+++ b/drivers/message/fusion/mptscsih.h	Sun Feb 23 22:25:27 2003
@@ -72,7 +72,7 @@
 /*
  *	Try to keep these at 2^N-1
  */
-#define MPT_FC_CAN_QUEUE	63
+#define MPT_FC_CAN_QUEUE	127
 #if defined MPT_SCSI_USE_NEW_EH
 	#define MPT_SCSI_CAN_QUEUE	127
 #else
@@ -148,59 +148,18 @@
  *	Issue discovered 20001213 by: sshirron
  */
 #define MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS			1
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,0)
-#	if LINUX_VERSION_CODE == KERNEL_VERSION(2,4,0)
-		/*
-		 *	Super HACK!  -by sralston:-(
-		 *	(good grief; heaven help me!)
-		 */
-#		include <linux/capability.h>
-#		if !defined(CAP_LEASE) && !defined(MODULE)
-#			undef MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS
-#		endif
-#	else
-#		ifndef MODULE
-#			undef MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS
-#		endif
-#	endif
-#endif
 
 /*
  *	tq_scheduler disappeared @ lk-2.4.0-test12
  *	(right when <linux/sched.h> newly defined TQ_ACTIVE)
  *	tq_struct reworked in 2.5.41. Include workqueue.h.
  */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
 #	include <linux/sched.h>
 #	include <linux/workqueue.h>
 #define SCHEDULE_TASK(x)		\
 	if (schedule_work(x) == 0) {	\
 		/*MOD_DEC_USE_COUNT*/;	\
 	}
-#else
-#define HAVE_TQ_SCHED	1
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-#	include <linux/sched.h>
-#	ifdef TQ_ACTIVE
-#		undef HAVE_TQ_SCHED
-#	endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,40)
-#		undef HAVE_TQ_SCHED
-#endif
-#endif
-#ifdef HAVE_TQ_SCHED
-#define SCHEDULE_TASK(x)		\
-	/*MOD_INC_USE_COUNT*/;		\
-	(x)->next = NULL;		\
-	queue_task(x, &tq_scheduler)
-#else
-#define SCHEDULE_TASK(x)		\
-	/*MOD_INC_USE_COUNT*/;		\
-	if (schedule_task(x) == 0) {	\
-		/*MOD_DEC_USE_COUNT*/;	\
-	}
-#endif
-#endif
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 
@@ -217,11 +176,9 @@
 #define x_scsi_taskmgmt_bh	mptscsih_taskmgmt_bh
 #define x_scsi_old_abort	mptscsih_old_abort
 #define x_scsi_old_reset	mptscsih_old_reset
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52)
+#define x_scsi_slave_alloc	mptscsih_slave_alloc
 #define x_scsi_slave_configure	mptscsih_slave_configure
-#else
-#define x_scsi_select_queue_depths	mptscsih_select_queue_depths
-#endif
+#define x_scsi_slave_destroy	mptscsih_slave_destroy
 #define x_scsi_proc_info	mptscsih_proc_info
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -232,41 +189,19 @@
 extern	int		 x_scsi_release(struct Scsi_Host *host);
 extern	const char	*x_scsi_info(struct Scsi_Host *);
 extern	int		 x_scsi_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
-#ifdef MPT_SCSI_USE_NEW_EH
 extern	int		 x_scsi_abort(Scsi_Cmnd *);
 extern	int		 x_scsi_bus_reset(Scsi_Cmnd *);
 extern	int		 x_scsi_dev_reset(Scsi_Cmnd *);
 extern	int		 x_scsi_host_reset(Scsi_Cmnd *);
-#else
-extern	int		 x_scsi_old_abort(Scsi_Cmnd *);
-extern	int		 x_scsi_old_reset(Scsi_Cmnd *, unsigned int);
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
 extern int		 x_scsi_bios_param(struct scsi_device * sdev, struct block_device *bdev,
 				sector_t capacity, int *ip);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,28)
-extern	int		 x_scsi_bios_param(Disk *, struct block_device *, int *);
-#else
-extern	int		 x_scsi_bios_param(Disk *, kdev_t, int *);
-#endif
 extern	void		 x_scsi_taskmgmt_bh(void *);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52)
+extern	int		 x_scsi_slave_alloc(Scsi_Device *);
 extern	int		 x_scsi_slave_configure(Scsi_Device *);
-#else
-extern	void		 x_scsi_select_queue_depths(struct Scsi_Host *, Scsi_Device *);
-#endif
-
+extern	void		 x_scsi_slave_destroy(Scsi_Device *);
 extern	int		 x_scsi_proc_info(char *, char **, off_t, int, int, int);
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-#define PROC_SCSI_DECL
-#else
-#define PROC_SCSI_DECL  proc_name: "mptscsih",
-#endif
-
-#ifdef MPT_SCSI_USE_NEW_EH
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52)
+#define PROC_SCSI_DECL  .proc_name = "mptscsih",
 
 #define MPT_SCSIHOST {						\
 	PROC_SCSI_DECL						\
@@ -277,7 +212,9 @@
 	.info				= x_scsi_info,		\
 	.command			= NULL,			\
 	.queuecommand			= x_scsi_queuecommand,	\
+	.slave_alloc			= x_scsi_slave_alloc,	\
 	.slave_configure		= x_scsi_slave_configure,	\
+	.slave_destroy			= x_scsi_slave_destroy,	\
 	.eh_strategy_handler		= NULL,			\
 	.eh_abort_handler		= x_scsi_abort,		\
 	.eh_device_reset_handler	= x_scsi_dev_reset,	\
@@ -292,58 +229,6 @@
 	.unchecked_isa_dma		= 0,			\
 	.use_clustering			= ENABLE_CLUSTERING,	\
 }
-
-#else  /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1) */
-
-#define MPT_SCSIHOST {						\
-	.next				= NULL,			\
-	PROC_SCSI_DECL						\
-	.proc_info			= x_scsi_proc_info,	\
-	.name				= "MPT SCSI Host",	\
-	.detect				= x_scsi_detect,	\
-	.release			= x_scsi_release,	\
-	.info				= x_scsi_info,		\
-	.command			= NULL,			\
-	.queuecommand			= x_scsi_queuecommand,	\
-	.eh_strategy_handler		= NULL,			\
-	.eh_abort_handler		= x_scsi_abort,		\
-	.eh_device_reset_handler	= x_scsi_dev_reset,	\
-	.eh_bus_reset_handler		= x_scsi_bus_reset,	\
-	.eh_host_reset_handler		= NULL,			\
-	.bios_param			= x_scsi_bios_param,	\
-	.can_queue			= MPT_SCSI_CAN_QUEUE,	\
-	.this_id			= -1,			\
-	.sg_tablesize			= MPT_SCSI_SG_DEPTH,	\
-	.cmd_per_lun			= MPT_SCSI_CMD_PER_LUN,	\
-	.unchecked_isa_dma		= 0,			\
-	.use_clustering			= ENABLE_CLUSTERING,	\
-	.use_new_eh_code		= 1			\
-}
-
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1) */
-
-#else /* MPT_SCSI_USE_NEW_EH */
-
-#define MPT_SCSIHOST {						\
-	.next				= NULL,			\
-	PROC_SCSI_DECL						\
-	.name				= "MPT SCSI Host",	\
-	.detect				= x_scsi_detect,	\
-	.release			= x_scsi_release,	\
-	.info				= x_scsi_info,		\
-	.command			= NULL,			\
-	.queuecommand			= x_scsi_queuecommand,	\
-	.abort				= x_scsi_old_abort,	\
-	.reset				= x_scsi_old_reset,	\
-	.bios_param			= x_scsi_bios_param,	\
-	.can_queue			= MPT_SCSI_CAN_QUEUE,	\
-	.this_id			= -1,			\
-	.sg_tablesize			= MPT_SCSI_SG_DEPTH,	\
-	.cmd_per_lun			= MPT_SCSI_CMD_PER_LUN,	\
-	.unchecked_isa_dma		= 0,			\
-	.use_clustering			= ENABLE_CLUSTERING	\
-}
-#endif  /* MPT_SCSI_USE_NEW_EH */
 
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
diff -Nru a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
--- a/drivers/message/i2o/i2o_config.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/message/i2o/i2o_config.c	Sun Feb 23 22:25:26 2003
@@ -964,7 +964,6 @@
 		i2o_remove_handler(&cfg_handler);
 }
  
-EXPORT_NO_SYMBOLS;
 MODULE_AUTHOR("Red Hat Software");
 MODULE_DESCRIPTION("I2O Configuration");
 MODULE_LICENSE("GPL");
diff -Nru a/drivers/net/Kconfig b/drivers/net/Kconfig
--- a/drivers/net/Kconfig	Sun Feb 23 22:25:26 2003
+++ b/drivers/net/Kconfig	Sun Feb 23 22:25:26 2003
@@ -2376,175 +2376,7 @@
 	  end of the link as well. It's good enough, for example, to run IP
 	  over the async ports of a Camtec JNT Pad. If unsure, say N.
 
-
-menu "Wireless LAN (non-hamradio)"
-	depends on NETDEVICES
-
-config NET_RADIO
-	bool "Wireless LAN (non-hamradio)"
-	---help---
-	  Support for wireless LANs and everything having to do with radio,
-	  but not with amateur radio or FM broadcasting.
-
-	  Saying Y here also enables the Wireless Extensions (creates
-	  /proc/net/wireless and enables ifconfig access). The Wireless
-	  Extension is a generic API allowing a driver to expose to the user
-	  space configuration and statistics specific to common Wireless LANs.
-	  The beauty of it is that a single set of tool can support all the
-	  variations of Wireless LANs, regardless of their type (as long as
-	  the driver supports Wireless Extension). Another advantage is that
-	  these parameters may be changed on the fly without restarting the
-	  driver (or Linux). If you wish to use Wireless Extensions with
-	  wireless PCMCIA (PC-) cards, you need to say Y here; you can fetch
-	  the tools from
-	  <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>.
-
-	  Some user-level drivers for scarab devices which don't require
-	  special kernel support are available from
-	  <ftp://shadow.cabi.net/pub/Linux/>.
-
-config STRIP
-	tristate "STRIP (Metricom starmode radio IP)"
-	depends on NET_RADIO && INET
-	---help---
-	  Say Y if you have a Metricom radio and intend to use Starmode Radio
-	  IP. STRIP is a radio protocol developed for the MosquitoNet project
-	  (on the WWW at <http://mosquitonet.stanford.edu/>) to send Internet
-	  traffic using Metricom radios.  Metricom radios are small, battery
-	  powered, 100kbit/sec packet radio transceivers, about the size and
-	  weight of a cellular telephone. (You may also have heard them called
-	  "Metricom modems" but we avoid the term "modem" because it misleads
-	  many people into thinking that you can plug a Metricom modem into a
-	  phone line and use it as a modem.)
-
-	  You can use STRIP on any Linux machine with a serial port, although
-	  it is obviously most useful for people with laptop computers. If you
-	  think you might get a Metricom radio in the future, there is no harm
-	  in saying Y to STRIP now, except that it makes the kernel a bit
-	  bigger.
-
-	  You can also compile this as a module ( = code which can be inserted
-	  in and removed from the running kernel whenever you want), say M
-	  here and read <file:Documentation/modules.txt>.  The module will be
-	  called strip.
-
-config ARLAN
-	tristate "Aironet Arlan 655 & IC2200 DS support"
-	depends on NET_RADIO && ISA
-	---help---
-	  Aironet makes Arlan, a class of wireless LAN adapters. These use the
-	  www.Telxon.com chip, which is also used on several similar cards.
-	  This driver is tested on the 655 and IC2200 series cards. Look at
-	  <http://www.ylenurme.ee/~elmer/655/> for the latest information.
-
-	  The driver is built as two modules, arlan and arlan-proc. The latter
-	  is the /proc interface and is not needed most of time.
-
-	  On some computers the card ends up in non-valid state after some
-	  time. Use a ping-reset script to clear it.
-
-config AIRONET4500
-	tristate "Aironet 4500/4800 series adapters"
-	depends on NET_RADIO && (PCI || ISA || PCMCIA)
-	---help---
-	  www.aironet.com (recently bought by Cisco) makes these 802.11 DS
-	  adapters.  Driver by Elmer Joandi (elmer@ylenurme.ee).
-
-	  Say Y here if you have such an adapter, and then say Y below to
-	  the option that applies to your particular type of card (PCI, ISA,
-	  or PCMCIA).
-
-	  This driver is also available as a module ( = code which can be
-	  inserted in and removed from the running kernel whenever you want).
-	  The module will be called aironet4500_core. If you want to
-	  compile it as a module, say M here and read
-	  <file:Documentation/modules.txt> as well as
-	  <file:Documentation/networking/net-modules.txt>.
-
-	  quick config parameters:
-	  	SSID=tsunami - "The Password"
-	  	adhoc=1  	there are no Access Points around
-	  	master=1 	Adhoc master (the one who creates network
-	  sync)
-	  	slave=1		Adhoc slave (btw, it is still forming own net
-	  			sometimes, and has problems with firmware...
-	  			change IbssJoinNetTimeout from /proc...)
-	  	channel=1..? 	meaningful in adhoc mode
-
-	  If you have problems with screwing up card, both_bap_lock=1 is a
-	  conservative value (performance hit 15%).
-
-	  All other parameters can be set via the proc interface.
-
-config AIRONET4500_NONCS
-	tristate "Aironet 4500/4800 ISA/PCI/PNP/365 support "
-	depends on AIRONET4500
-	help
-	  If you have an ISA, PCI or PCMCIA Aironet 4500/4800 wireless LAN
-	  card, say Y here, and then also to the options below that apply
-	  to you.
-
-	  This driver is also available as a module ( = code which can be
-	  inserted in and removed from the running kernel whenever you want).
-	  The module will be called aironet4500_card.  If you want to
-	  compile it as a module, say M here and read
-	  <file:Documentation/modules.txt>.
-
-config AIRONET4500_PNP
-	bool "Aironet 4500/4800 PNP support "
-	depends on AIRONET4500_NONCS
-	help
-	  If you have an ISA Aironet 4500/4800 card which you want to use in
-	  PnP (Plug and Play) mode, say Y here. This is the recommended mode
-	  for ISA cards. Remember however to enable the PnP jumper on the
-	  board if you say Y here.
-
-config AIRONET4500_PCI
-	bool "Aironet 4500/4800 PCI support "
-	depends on AIRONET4500_NONCS && PCI
-	help
-	  If you have an PCI Aironet 4500/4800 card, say Y here.
-
-config AIRONET4500_ISA
-	bool "Aironet 4500/4800 ISA broken support (EXPERIMENTAL)"
-	depends on AIRONET4500_NONCS && EXPERIMENTAL
-	help
-	  If you have an ISA Aironet 4500/4800 card which you want to run in
-	  non-PnP mode, say Y here. This is not recommended and does not work
-	  correctly at this point. Say N.
-
-config AIRONET4500_I365
-	bool "Aironet 4500/4800 I365 broken support (EXPERIMENTAL)"
-	depends on AIRONET4500_NONCS && EXPERIMENTAL
-	help
-	  If you have a PCMCIA Aironet 4500/4800 card which you want to use
-	  without the standard PCMCIA cardservices provided by the pcmcia-cs
-	  package, say Y here. This is not recommended, so say N.
-
-config AIRONET4500_PROC
-	tristate "Aironet 4500/4800 PROC interface "
-	depends on AIRONET4500 && m
-	---help---
-	  If you say Y here (and to the "/proc file system" below), you will
-	  be able to configure your Aironet card via the
-	  /proc/sys/aironet4500 interface.
-
-	  Additional info: look in <file:drivers/net/aironet4500_rid.c>.
-
-	  This driver is also available as a module ( = code which can be
-	  inserted in and removed from the running kernel whenever you want).
-	  The module will be called aironet4500_proc. If you want to
-	  compile it as a module, say M here and read
-	  <file:Documentation/modules.txt>.
-
-	  NOTE: the proc interface uses a lot of memory, so it is recommended
-	  to compile it as a module and remove the module after
-	  configuration.
-
-# New directory for Wireless LAN devices - cards above will move there
 source "drivers/net/wireless/Kconfig"
-
-endmenu
 
 source "drivers/net/tokenring/Kconfig"
 
diff -Nru a/drivers/net/Makefile b/drivers/net/Makefile
--- a/drivers/net/Makefile	Sun Feb 23 22:25:22 2003
+++ b/drivers/net/Makefile	Sun Feb 23 22:25:22 2003
@@ -59,11 +59,6 @@
 #
 
 obj-$(CONFIG_MII) += mii.o
-obj-$(CONFIG_AIRONET4500) 	+= aironet4500_core.o
-obj-$(CONFIG_AIRONET4500_CS) 	+= aironet4500_core.o
-obj-$(CONFIG_AIRONET4500_NONCS)  += aironet4500_card.o
-obj-$(CONFIG_AIRONET4500_PROC)	+= aironet4500_proc.o
-obj-$(CONFIG_AIRONET4500_CS)	+= aironet4500_proc.o
 
 obj-$(CONFIG_WINBOND_840) += mii.o
 obj-$(CONFIG_SUNDANCE) += sundance.o mii.o
@@ -111,7 +106,6 @@
   obj-$(CONFIG_SLIP) += slhc.o
 endif
 
-obj-$(CONFIG_STRIP) += strip.o
 obj-$(CONFIG_DUMMY) += dummy.o
 obj-$(CONFIG_BONDING) += bonding.o
 obj-$(CONFIG_DE600) += de600.o
@@ -136,7 +130,6 @@
 obj-$(CONFIG_EEXPRESS_PRO) += eepro.o
 obj-$(CONFIG_8139CP) += 8139cp.o mii.o
 obj-$(CONFIG_8139TOO) += 8139too.o mii.o
-obj-$(CONFIG_ARLAN) += arlan.o arlan-proc.o
 obj-$(CONFIG_ZNET) += znet.o
 obj-$(CONFIG_LAN_SAA9730) += saa9730.o
 obj-$(CONFIG_DEPCA) += depca.o
diff -Nru a/drivers/net/ac3200.c b/drivers/net/ac3200.c
--- a/drivers/net/ac3200.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/net/ac3200.c	Sun Feb 23 22:25:25 2003
@@ -344,7 +344,7 @@
 MODULE_PARM(io, "1-" __MODULE_STRING(MAX_AC32_CARDS) "i");
 MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_AC32_CARDS) "i");
 MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_AC32_CARDS) "i");
-MODULE_PARM_DESC(io, "I/O base adress(es)");
+MODULE_PARM_DESC(io, "I/O base address(es)");
 MODULE_PARM_DESC(irq, "IRQ number(s)");
 MODULE_PARM_DESC(mem, "Memory base address(es)");
 MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver");
diff -Nru a/drivers/net/aironet4500.h b/drivers/net/aironet4500.h
--- a/drivers/net/aironet4500.h	Sun Feb 23 22:25:24 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1607 +0,0 @@
-/*
- *	 Aironet 4500 Pcmcia driver
- *
- *		Elmer Joandi, Januar 1999
- *	Copyright:	GPL
- *	
- *
- *	Revision 0.1 ,started  30.12.1998
- *
- *
- */
- 
-
-#ifndef AIRONET4500_H
-#define	AIRONET4500_H
-// redefined to avoid PCMCIA includes
-
- #include <linux/version.h>
-/*#include <linux/module.h>
- #include <linux/kernel.h>
-*/
-
-/*
-#include <linux/types.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/delay.h>
-#include <linux/time.h>
-*/
-#include <linux/802_11.h>
-#include <linux/workqueue.h>
-
-//damn idiot PCMCIA stuff
-#ifndef DEV_NAME_LEN
-	#define DEV_NAME_LEN 32
-#endif
-
-struct pcmcia_junkdev_node_t {
-    char		dev_name[DEV_NAME_LEN];
-    u_short		major, minor;
-    struct dev_node_t	*next;
-};
-
-#ifndef CS_RELEASE
-typedef struct pcmcia_junkdev_node_t dev_node_t;
-#endif
-
-
-
-#include <linux/spinlock.h>
-
-
-#define AWC_ERROR	-1
-#define AWC_SUCCESS	0
-
-struct awc_cis {
-	unsigned char cis[0x301];
-	unsigned char unknown302[0xdf];
-	unsigned short configuration_register;
-	unsigned short pin_replacement_register;
-	unsigned short socket_and_copy_register;
-
-};
-
-
-/* timeout for transmit watchdog timer, AP default is 8 sec */
-#define AWC_TX_TIMEOUT			(HZ * 8) 
-
-
-
-/***************************  REGISTER OFFSETS *********************/
-#define awc_Command_register 		0x00
-#define awc_Param0_register 		0x02
-#define awc_Param1_register 		0x04
-#define awc_Param2_register 		0x06
-#define awc_Status_register 		0x08
-#define awc_Resp0_register 		0x0A
-#define awc_Resp1_register 		0x0C
-#define awc_Resp2_register 		0x0E
-#define awc_EvStat_register 		0x30
-#define awc_EvIntEn_register 		0x32
-#define awc_EvAck_register 		0x34
-#define awc_SWSupport0_register 	0x28
-#define awc_SWSupport1_register 	0x2A
-#define awc_SWSupport2_register 	0x2C
-#define awc_SWSupport3_register 	0x2E
-#define awc_LinkStatus_register 	0x10
-// Memory access  RID FID
-#define awc_Select0_register 		0x18
-#define awc_Offset0_register 		0x1C
-#define awc_Data0_register 		0x36
-#define awc_Select1_register 		0x1A
-#define awc_Offset1_register 		0x1E
-#define awc_Data1_register 		0x38
-//
-#define awc_RxFID_register 		0x20
-#define awc_TxAllocFID_register 	0x22
-#define awc_TxComplFID_register 	0x24
-#define awc_AuxPage_register 		0x3A
-#define awc_AuxOffset_register 		0x3C
-#define awc_AuxData_register 		0x3E
-
-
-struct awc_bap {
-	u16 select;
-	u16 offset;
-	u16 data;
-	volatile int lock;
-	volatile int	status;
-	struct semaphore sem;
-	spinlock_t spinlock;
-	unsigned long flags;
-};
-
-
-
-#define AWC_COMMAND_STATE_WAIT_CMD_BUSY		1
-#define AWC_COMMAND_STATE_WAIT_CMD_ACK		2
-#define AWC_COMMAND_STATE_WAIT_BAP_BUSY		3
-#define AWC_COMMAND_STATE_BAP_NOT_SET		4
-#define AWC_COMMAND_STATE_BAP_SET		5
-
-struct awc_command {
-	volatile int		state;
-	volatile int		lock_state;
-	struct net_device *		dev;
-	struct awc_private *	priv;
-	u16			port;
-	struct awc_bap * 	bap;
-	u16			command;
-	u16			par0;
-	u16			par1;
-	u16			par2;
-	u16			status;
-	u16			resp0;
-	u16			resp1;
-	u16			resp2;
-	u16			rid;
-	u16			offset;
-	u16			len;
-	void *			buff;
-
-};
-
-
-
-
-#define DOWN(a) down_interruptible( a ) ; 
-//	if (in_interrupt()) { down_interruptible( a ) ; } else printk("semaphore DOWN in interrupt tried \n");
-#define UP(a)   up( a ) ;
-//	if (in_interrupt()) {up( a ) ; } else printk("semaphore UP in interrupt tried \n");
-
-/*	if (!in_interrupt())\
-	printk("bap lock under cli but not in int\n");\
-*/
-
-#define AWC_LOCK_COMMAND_ISSUING(a) spin_lock_irqsave(&a->command_issuing_spinlock,a->command_issuing_spinlock_flags);
-#define AWC_UNLOCK_COMMAND_ISSUING(a) spin_unlock_irqrestore(&a->command_issuing_spinlock,a->command_issuing_spinlock_flags);
-
-#define AWC_BAP_LOCK_UNDER_CLI_REAL(cmd) \
- 	if (!cmd.priv) {\
-		printk(KERN_CRIT "awc4500: no priv present in command !");\
-	}\
-	cmd.bap = &(cmd.priv->bap1);\
-	if (both_bap_lock)\
-	spin_lock_irqsave(&cmd.priv->both_bap_spinlock,cmd.priv->both_bap_spinlock_flags);\
-	if (cmd.bap){\
-		spin_lock_irqsave(&(cmd.bap->spinlock),cmd.bap->flags);\
-		cmd.bap->lock++;\
-		if (cmd.bap->lock > 1)\
-			printk("Bap 1 lock high\n");\
-		cmd.lock_state |= AWC_BAP_LOCKED;\
-	}
-
-#define AWC_BAP_LOCK_NOT_CLI_REAL(cmd) {\
-	if (in_interrupt())\
-	printk("bap lock not cli in int\n");\
- 	if (!cmd.priv) {\
-		printk(KERN_CRIT "awc4500: no priv present in command,lockup follows !");\
-	}\
-	cmd.bap = &(cmd.priv->bap0);\
-	if (both_bap_lock)\
-		spin_lock_irqsave(&cmd.priv->both_bap_spinlock,cmd.priv->both_bap_spinlock_flags);\
-	spin_lock_irqsave(&(cmd.bap->spinlock),cmd.bap->flags);\
-	DOWN(&(cmd.priv->bap0.sem));\
-	cmd.bap->lock++;\
-	if (cmd.bap->lock > 1)\
-		printk("Bap 0 lock high\n");\
-	cmd.lock_state |= AWC_BAP_SEMALOCKED;\
-}
-
-#define AWC_BAP_LOCK_NOT_CLI_CLI_REAL(cmd) {\
-	cmd.bap = &(cmd.priv->bap0);\
-	if (both_bap_lock)\
-		spin_lock_irqsave(&cmd.priv->both_bap_spinlock,cmd.priv->both_bap_spinlock_flags);\
-	spin_lock_irqsave(&(cmd.bap->spinlock),cmd.bap->flags);\
-	cmd.bap->lock++;\
-	if (cmd.bap->lock > 1)\
-		printk("Bap 0 lock high\n");\
-	cmd.lock_state |= AWC_BAP_LOCKED;\
-}
-
-#define BAP_LOCK_ANY(cmd)\
-	if (in_interrupt())	AWC_BAP_LOCK_NOT_CLI_CLI_REAL(cmd)\
-	else AWC_BAP_LOCK_NOT_CLI_REAL(cmd)
-	
-#define AWC_BAP_LOCK_NOT_CLI(cmd)	BAP_LOCK_ANY(cmd)
-#define AWC_BAP_LOCK_UNDER_CLI(cmd)	AWC_BAP_LOCK_UNDER_CLI_REAL(cmd)
-/*
-	if (!cmd.priv->bap1.lock ) {BAP_LOCK_ANY(cmd);}\
-	else AWC_BAP_LOCK_NOT_CLI_CLI_REAL(cmd);
-*/	
-#define AWC_BAP_LOCKED 		0x01
-#define AWC_BAP_SEMALOCKED 	0x02
-
-#define AWC_BAP_BUSY	0x8000
-#define AWC_BAP_ERR	0x4000
-#define AWC_BAP_DONE	0x2000
-
-#define AWC_CLI		1
-#define AWC_NOT_CLI 	2
-
-/*#define WAIT61x3	inb(0x61);\
-         		inb(0x61);\
-                    	inb(0x61);
-*/ 
-#define WAIT61x3 	udelay(bap_sleep)                  	
-
-#define AWC_INIT_COMMAND(context, a_com, a_dev,a_cmmand,a_pr0, a_rid, a_offset, a_len, a_buff) {\
-	memset(&a_com,0,sizeof(a_com) );\
-	a_com.dev = a_dev;\
-	a_com.priv = a_dev->priv;\
-	a_com.port = a_dev->base_addr;\
-	a_com.bap = NULL;\
-	a_com.command = a_cmmand;\
-	a_com.par0 = a_pr0;\
-	a_com.rid = a_rid;\
-	a_com.offset = a_offset;\
-	a_com.len = a_len;\
-	a_com.buff = a_buff;\
-	a_com.lock_state = 0;\
-};
-
-/* väga veider asi järgnevast 
- makrost välja jäetud	if (cmd.bap) AWC_IN((cmd.bap)->data);\
-*/
-
-#define AWC_BAP_UNLOCK(com) { \
-	if (com.bap){ \
-		if ( (com.lock_state & AWC_BAP_SEMALOCKED) &&\
-		     (com.lock_state & AWC_BAP_LOCKED) ){\
-		     	printk("Both Sema and simple lock \n");\
-		}\
-		if ( com.lock_state & AWC_BAP_SEMALOCKED ){\
-			 com.bap->lock--; \
-			 com.lock_state &= ~AWC_BAP_SEMALOCKED;\
-			 UP(&(com.bap->sem)); \
-			 spin_unlock_irqrestore(&(cmd.bap->spinlock),cmd.bap->flags);\
-		} else if (com.lock_state & AWC_BAP_LOCKED){\
-			 com.bap->lock--; \
-			 com.lock_state &= ~AWC_BAP_LOCKED;\
-			 spin_unlock_irqrestore(&(cmd.bap->spinlock),cmd.bap->flags);\
-		}\
-	}\
-	if (both_bap_lock)\
-		spin_unlock_irqrestore(&cmd.priv->both_bap_spinlock,cmd.priv->both_bap_spinlock_flags);\
-}
-
-#define AWC_RELEASE_COMMAND(com) {\
-		AWC_BAP_UNLOCK(cmd);\
-	}
-
-
-
-#define awc_manufacturer_code 	0x015F
-#define awc_product_code	0x0005
-
-
-#define awc_write(base,register,u16value) outw(u16value, (base)+(register))
-#define awc_read(base,register)           inw((base)+(register))
-#define AWC_OUT(base,val)		outw(val, base)
-#define AWC_IN(base)			inw(base)
-
-
-#define awc_read_response(cmd)	{	\
-	cmd->status=awc_read(cmd->port,awc_Status_register);\
-	cmd->resp0=awc_read(cmd->port,awc_Resp0_register);\
-	cmd->resp1=awc_read(cmd->port,awc_Resp1_register);\
-	cmd->resp2=awc_read(cmd->port,awc_Resp2_register);\
-};
-
-#define awc_command_busy(base)		(awc_read(base,awc_Command_register) & 0x8000)
-#define awc_command_read(base)		awc_read(base,awc_Command_register)
-#define awc_command_write(base,cmd)	awc_write(base,awc_Command_register,cmd) 
-#define awc_event_status_Awake(base)	(awc_read(base,awc_EvStat_register) & 0x0100)
-#define awc_event_status_Link(base)	(awc_read(base,awc_EvStat_register) & 0x0080)
-#define awc_event_status_Cmd(base)	(awc_read(base,awc_EvStat_register) & 0x0010)
-#define awc_event_status_Alloc(base)	(awc_read(base,awc_EvStat_register) & 0x0008)
-#define awc_event_status_TxExc(base)	(awc_read(base,awc_EvStat_register) & 0x0004)
-#define awc_event_status_Tx(base)	(awc_read(base,awc_EvStat_register) & 0x0002)
-#define awc_event_status_TxResp(base)	(awc_read(base,awc_EvStat_register) & 0x0006)
-#define awc_event_status_Rx(base)	(awc_read(base,awc_EvStat_register) & 0x0001)
-#define awc_event_status(base)		(awc_read(base,awc_EvStat_register))
-
-#define awc_Link_Status(base)		awc_read(base,awc_LinkStatus_register)
-
-#define awc_Rx_Fid(base)		awc_read(base,awc_RxFID_register)
-#define awc_Tx_Allocated_Fid(base)	awc_read(base,awc_TxAllocFID_register)
-#define awc_Tx_Compl_Fid(base)		awc_read(base,awc_TxComplFID_register)
-
-#define awc_event_ack_ClrStckCmdBsy(base) awc_write(base,awc_EvAck_register, 0x4000)
-#define awc_event_ack_WakeUp(base)	awc_write(base,awc_EvAck_register, 0x2000)
-#define awc_event_ack_Awaken(base)	awc_write(base,awc_EvAck_register, 0x0100)
-#define awc_event_ack_Link(base)	awc_write(base,awc_EvAck_register, 0x0080)
-#define awc_event_ack_Cmd(base)		awc_write(base,awc_EvAck_register, 0x0010)
-#define awc_event_ack_Alloc(base)	awc_write(base,awc_EvAck_register, 0x0008)
-#define awc_event_ack_TxExc(base)	awc_write(base,awc_EvAck_register, 0x0004)
-#define awc_event_ack_Tx(base)		awc_write(base,awc_EvAck_register, 0x0002)
-#define awc_event_ack_Rx(base)		awc_write(base,awc_EvAck_register, 0x0001)
-
-#define awc_event_ack(base,ints)	awc_write(base,awc_EvAck_register,ints)
-
-#define awc_ints_enabled(base)		(awc_read(base,awc_EvIntEn_register))
-#define awc_ints_enable(base,ints)	awc_write(base,awc_EvIntEn_register,ints)
-
-
-
-/************************  	RX TX 	BUFF	************************/
-
-
-struct aironet4500_radio_rx_header {
-	u32	RxTime;
-	u16	Status;
-	u16	PayloadLength;
-	u8	Reserved0;
-	u8	RSSI;
-	u8	Rate;
-	u8	Frequency;
-	u8	Rx_association_count;
-	u8 	Reserved1[3];
-	u8	PLCP_header[4];
-
-};
-
-
-struct aironet4500_radio_tx_header {
-	u32	SWSupport;
-	u16	Status;
-	#define aironet4500_tx_status_max_retries	0x0002
-	#define aironet4500_tx_status_lifetime_exceeded	0x0004
-	#define aironet4500_tx_status_AID_failure	0x0008
-	#define aironet4500_tx_status_MAC_disabled	0x0010
-	#define aironet4500_tx_status_association_lost	0x0020
-	u16	PayloadLength;
-	u16	TX_Control;
-	#define aironet4500_tx_control_tx_ok_event_enable 	0x0002
-	#define aironet4500_tx_control_tx_fail_event_enable 	0x0004
-	#define aironet4500_tx_control_header_type_802_11 	0x0008
-	#define aironet4500_tx_control_payload_type_llc 	0x0010
-	#define aironet4500_tx_control_no_release 		0x0020
-	#define aironet4500_tx_control_reuse_fid \
-		(aironet4500_tx_control_tx_ok_event_enable |\
-		 aironet4500_tx_control_tx_fail_event_enable |\
-		  aironet4500_tx_control_no_release)
-	#define aironet4500_tx_control_no_retries 		0x0040
-	#define aironet4500_tx_control_clear_AID 		0x0080
-	#define aironet4500_tx_control_strict_order 		0x0100
-	#define aironet4500_tx_control_use_rts 			0x0200
-	u16	AID;
-	u8	Tx_Long_Retry;
-	u8	Tx_Short_Retry;
-	u8	tx_association_count;
-	u8	tx_bit_rate;
-	#define	aironet4500_tx_bit_rate_automatic 0
-	#define aironet4500_tx_bit_rate_500kbps	1
-	#define aironet4500_tx_bit_rate_1Mbps	2
-	#define aironet4500_tx_bit_rate_2Mbps	4
-	u8	Max_Long_Retry;
-	u8	Max_Short_Retry;
-	u8	Reserved0[2];
-};
-
-
-struct aironet4500_rx_fid {
-
-	u16						rid;
-	struct aironet4500_radio_rx_header 		radio_rx;
-	struct ieee_802_11_header 	   		ieee_802_11;
-	u16 						gap_length;
-	struct ieee_802_3_header	   		ieee_802_3;
-	u8					*	payload;
-};
-
-
-struct aironet4500_tx_fid {
-
-	u16						fid;
-	u16						fid_size;
-	struct aironet4500_radio_tx_header 		radio_tx;
-	struct ieee_802_11_header 	   		ieee_802_11;
-	u16 						gap_length;
-	#define aironet4500_gap_len_without_802_3	6
-	#define aironet4500_gap_len_with_802_3		0
-	struct ieee_802_3_header	   		ieee_802_3;
-	u8					*	payload;	
-};
-
-struct awc_fid {
-
-	u32	type;
-	#define p80211_llc_snap		0x0100
-	#define p80211_8021H		0x0200
-	#define p80211_8022		0x0400
-	#define p80211_8023		0x0800
-	#define p80211_snap_8021H	0x1000
-	#define p80211copy_path_skb	0x2000
-
-	u8	priority;
-	u8	busy;
-	
-	#define awc_tx_fid_complete_read 0x01
-	u16	state;
-	union {
-		struct aironet4500_tx_fid tx;
-		struct aironet4500_rx_fid rx;	
-	} u;
-	
-	struct ieee_802_11_snap_header snap;
-	struct ieee_802_11_802_1H_header bridge;
-	u16			bridge_size;
-	struct ieee_802_11_802_2_header p8022;
-
-	u16			pkt_len;
-	u8	* mac;
-	struct sk_buff *	skb;
-	long long		transmit_start_time;
-	struct awc_fid	*	next;
-	struct awc_fid	*	prev;
-	
-};
-
-
-
-struct awc_fid_queue {
-
-
-	struct awc_fid * head;
-	struct awc_fid * tail;
-	int	size;
-	spinlock_t spinlock;
-};
-
-
-static  __inline__ void
-awc_fid_queue_init(struct awc_fid_queue * queue){
-
-	unsigned long flags;
-	memset(queue,0, sizeof(struct awc_fid_queue));	
-	spin_lock_init(&queue->spinlock);
-	spin_lock_irqsave(&queue->spinlock,flags);
-	queue->head = NULL;
-	queue->tail = NULL;
-	queue->size = 0;
-	spin_unlock_irqrestore(&queue->spinlock,flags);	
-};
-
-static inline void
-awc_fid_queue_push_tail(	struct awc_fid_queue * 	queue,
-				struct awc_fid *	fid){
-
-	unsigned long flags;
-
-	spin_lock_irqsave(&queue->spinlock,flags);	
-	
-	fid->prev = queue->tail;
-	fid->next = NULL;
-	
-	if (queue->tail){
-		queue->tail->next = fid;
-	} 	
-	queue->tail  = fid;
-	
-	if (!queue->head)
-		queue->head = fid;
-	queue->size++;
-
-	spin_unlock_irqrestore(&queue->spinlock,flags);
-		
-};
-
-
-static inline void
-awc_fid_queue_push_head(	struct awc_fid_queue * 	queue,
-				struct awc_fid *	fid){
-
-	unsigned long flags;
-
-	spin_lock_irqsave(&queue->spinlock,flags);	
-	
-	fid->prev = NULL;
-	fid->next = queue->head;
-	
-	if (queue->head){
-		queue->head->prev = fid;
-	} 	
-	queue->head  = fid;
-	
-	if (!queue->tail)
-		queue->tail = fid;
-	queue->size++;
-	
-	spin_unlock_irqrestore(&queue->spinlock,flags);
-};
-
-
-
-static inline void
-awc_fid_queue_rm(		struct awc_fid_queue * 	queue,
-				struct awc_fid *	fid){
-
-
-	if (fid->prev) {
-		fid->prev->next = fid->next;
-	};
-
-	if (fid->next) {
-		fid->next->prev = fid->prev;
-	};
-	
-	if (fid == queue->tail) {
-		queue->tail = fid->prev;
-	};
-	if (fid == queue->head) {
-		queue->head = fid->next;
-	};
-	fid->next = NULL;
-	fid->prev = NULL;
-	queue->size--;
-	if (queue->size ==0 ){
-		queue->tail = NULL;
-		queue->head = NULL;
-	}		
-};
-
-static inline void
-awc_fid_queue_remove(		struct awc_fid_queue * 	queue,
-				struct awc_fid *	fid){
-	unsigned long flags;
-	spin_lock_irqsave(&queue->spinlock,flags);	
-	
-	awc_fid_queue_rm(queue,fid);
-	
-	spin_unlock_irqrestore(&queue->spinlock,flags);
-	
-};
-
-
-
-static inline struct awc_fid * 
-awc_fid_queue_pop_head(		struct awc_fid_queue * 	queue){
-
-	unsigned long flags;
-	struct awc_fid * fid;
-	
-	spin_lock_irqsave(&queue->spinlock,flags);	
-
-	fid = queue->head;
-	if (fid)
-		awc_fid_queue_rm(queue,fid);
-		
-	spin_unlock_irqrestore(&queue->spinlock,flags);
-	
-	return fid;
-};
-
-
-
-
-static inline struct awc_fid * 
-awc_fid_queue_pop_tail(		struct awc_fid_queue * 	queue){
-
-	unsigned long flags;
-	struct awc_fid * fid;
-	
-	spin_lock_irqsave(&queue->spinlock,flags);	
-
-	fid = queue->tail;
-	if (fid)
-			awc_fid_queue_rm(queue,fid);
-	
-	spin_unlock_irqrestore(&queue->spinlock,flags);
-	
-	return fid;
-};
-
-
-
-#define AWC_TX_HEAD_SIZE		0x44
-#define AWC_TX_ALLOC_SMALL_SIZE 	200
-#define AWC_RX_BUFFS			50
-
-
-/*****************************     	RID & CONFIG 	***********************/
-
-struct awc_config{
-    unsigned short    Len;                                /* sizeof(PC4500_CONFIG) */
-    unsigned short    OperatingMode;                      /* operating mode        */
-
-    #define           MODE_STA_IBSS                0
-    #define           MODE_STA_ESS                 1
-    #define           MODE_AP                      2
-    #define           MODE_AP_RPTR                 3
-    #define           MODE_ETHERNET_HOST           (0<<8)    /* rx payloads converted */
-    #define           MODE_LLC_HOST                (1<<8)    /* rx payloads left as is */
-    #define           MODE_AIRONET_EXTEND          (1<<9)    /* enable Aironet extenstions */
-    #define           MODE_AP_INTERFACE            (1<<10) /* enable ap interface extensions */
-    unsigned short    ReceiveMode;                        /* receive mode */
-    #define           RXMODE_BC_MC_ADDR            0
-    #define           RXMODE_BC_ADDR               1         /* ignore multicasts */
-    #define           RXMODE_ADDR                  2         /* ignore multicast and broadcast */
-    #define           RXMODE_RFMON                 3         /* wireless monitor mode */
-    #define           RXMODE_RFMON_ANYBSS 4
-    #define           RXMODE_LANMON                5         /* lan style monitor -- data packets only */
-    #define           RXMODE_DISABLE_802_3_HEADER  0x100    /* disables 802.3 header on rx */
-
-    unsigned short    FragmentThreshold;
-    unsigned short    RtsThreshold;
-    unsigned char     StationMacAddress[6];
-    unsigned char     Rates[8];
-    unsigned short    ShortRetryLimit;
-    unsigned short    LongRetryLimit;
-    unsigned short    TxLifetime;                         /* in kusec */
-    unsigned short    RxLifetime;                         /* in kusec */
-    unsigned short    Stationary;
-    unsigned short    Ordering;
-    unsigned short    DeviceType;                         /* for overriding device type */
-    unsigned short    _reserved1[5];                         /*---------- Scanning/Associating ----------*/
-    unsigned short    ScanMode;
-    #define           SCANMODE_ACTIVE              0
-    #define           SCANMODE_PASSIVE             1
-    #define           SCANMODE_AIROSCAN            2
-    unsigned short    ProbeDelay;                         /* in kusec */
-    unsigned short    ProbeEnergyTimeout;                 /* in kusec */
-    unsigned short    ProbeResponseTimeout;
-    unsigned short    BeaconListenTimeout;
-    unsigned short    JoinNetTimeout;
-    unsigned short    AuthenticationTimeout;
-    unsigned short    AuthenticationType;
-    #define           AUTH_OPEN                    1
-    #define           AUTH_SHAREDKEY               2
-    #define           AUTH_EXCLUDENONWEP           4
-    unsigned short    AssociationTimeout;
-    unsigned short    SpecifiedApTimeout;
-    unsigned short    OfflineScanInterval;
-    unsigned short    OfflineScanDuration;
-    unsigned short    LinkLossDelay;
-    unsigned short    MaxBeaconLostTime;
-    unsigned short    RefreshInterval;
-   #define           DISABLE_REFRESH           0xFFFF
-   unsigned short    _reserved1a[1];                      /*---------- Power save operation ----------*/
-   unsigned short    PowerSaveMode;
-   #define           POWERSAVE_CAM             0
-   #define           POWERSAVE_PSP             1
-   #define           POWERSAVE_PSP_CAM         2
-   unsigned short    SleepForDtims;
-   unsigned short    ListenInterval;
-   unsigned short    FastListenInterval;
-   unsigned short    ListenDecay;
-   unsigned short    FastListenDelay;
-   unsigned short    _reserved2[2];                       /*---------- Ap/Ibss config items ----------*/
-   unsigned short    BeaconPeriod;
-   unsigned short    AtimDuration;
-   unsigned short    HopPeriod;
-   unsigned short    ChannelSet;
-   unsigned short    Channel;
-   unsigned short    DtimPeriod;
-   unsigned short    _reserved3[2];                       /*---------- Radio configuration ----------*/
-   unsigned short    RadioType;
-   #define           RADIOTYPE_DEFAULT         0
-   #define           RADIOTYPE_802_11          1
-   #define           RADIOTYPE_LEGACY          2
-   unsigned char     u8RxDiversity;
-   unsigned char     u8TxDiversity;
-   unsigned short    TxPower;
-   #define           TXPOWER_DEFAULT           0
-   unsigned short    RssiThreshold;
-   #define           RSSI_DEFAULT              0
-   unsigned short    RadioSpecific[4];                 /*---------- Aironet Extensions ----------*/
-   unsigned char     NodeName[16];
-   unsigned short    ArlThreshold;
-   unsigned short    ArlDecay;
-   unsigned short    ArlDelay;
-   unsigned short    _reserved4[1];                       /*---------- Aironet Extensions ----------*/
-   unsigned short    MagicAction;
-   #define           MAGIC_ACTION_STSCHG       1
-   #define           MACIC_ACTION_RESUME       2
-   #define           MAGIC_IGNORE_MCAST        (1<<8)
-   #define           MAGIC_IGNORE_BCAST        (1<<9)
-   #define           MAGIC_SWITCH_TO_PSP       (0<<10)
-   #define           MAGIC_STAY_IN_CAM         (1<<10)
-};
-
-
-
-struct awc_SSID {
-	u16 	lenght;
-	u8	SSID[32];
-};
-
-struct awc_SSIDs {
-	u16 	ridLen;
-	struct awc_SSID SSID[3];
-
-};
-
-struct awc_fixed_APs{
-	u16	ridLen;
-	u8	AP[4][6];
-};
-
-struct awc_driver_name{
-	u16	ridLen;
-	u8	name[16];
-};
-
-struct awc_encapsulation{
-	u16 	etherType;
-	u16	Action;
-};
-
-struct awc_enc_trans{
-	u16				ridLen;
-	struct awc_encapsulation 	rules[8];
-};
-
-struct awc_wep_key {
-	u16	ridLen;
-	u16	KeyIndex;
-	u8	Address[6];
-	u16	KeyLen;
-	u8	Key[16];
-};
-
-struct awc_modulation {
-	u16	ridLen;
-	u16	Modulation;
-};
-
-struct awc_cap{
-	u16		ridLen;
-	u8		OUI[3];
-	u8		ProductNum[3];
-	u8		ManufacturerName[32];
-	u8		ProductName[16];
-	u8		ProductVersion[8];
-	u8		FactoryAddress[6];
-	u8		AironetAddress[6];
-	u16		RadioType;
-	u16		RegDomain;
-	u8		Callid[6];
-	u8		SupportedRates[8];
-	u8		RxDiversity;
-	u8		TxDiversity;
-	u16		TxPowerLevels[8];
-	u16		HardwareVersion;
-	u16		HardwareCapabilities;
-	u16		TemperatureRange;
-	u16		SoftwareVersion;
-	u16		SoftwareSubVersion;
-	u16		InterfaceVersion;
-	u16		SoftwareCapabilities;
-	u8		BootBlockVersionMajor;
-	u8              BootBlockVersionMinor;
-	        
-};
-
-
-struct awc_status{
-	u16	ridLen;
-	u8	MacAddress[6];
-	u16	OperationalMode;
-	u16	ErrorCode;
-	u16	CurrentSignalQuality;
-	u16	SSIDlength;
-	u8	SSID[32];
-	u8	ApName[16];
-	u8	CurrentBssid[32];
-	u8	PreviousBSSIDs[3][6];
-	u16	BeaconPeriod;
-	u16	DtimPeriod;
-	u16	AtimDuration;
-	u16	HopPeriod;
-	u16	ChannelSet;
-	u16	Channel;
-
-	u16	HopsToBackbone;
-	u16	ApTotalLoad;
-	u16	OurGeneratedLoad;
-	u16	AccumulatedArl;
-	
-};
-
-
-struct awc_AP{
-	u16	ridLen;
-	u16	TIM_Addr;
-	u16	Airo_Addr;
-};
-
-struct awc_Statistics_32 {
-
-	u32	RidLen;
-	u32	RxOverrunErr;
-	u32	RxPlcpCrcErr;
-	u32	RxPlcpFormat;
-	u32	RxPlcpLength;
-	u32	RxMacCrcErr;
-	u32	RxMacCrcOk;
-	u32	RxWepErr;
-	u32	RxWepOk;
-	u32	RetryLong;
-	u32	RetryShort;
-	u32	MaxRetries;
-	u32	NoAck;
-
-	u32	NoCts;
-	u32	RxAck;
-	u32	RxCts;
-	u32	TxAck;
-	u32	TxRts;
-	u32	TxCts;
-	u32	TxMc;
-	u32	TxBc;
-	u32	TxUcFrags;
-	u32	TxUcPackets;
-	u32	TxBeacon;
-	u32	RxBeacon;
-	u32	TxSinColl;
-	u32	TxMulColl;
-	u32	DefersNo;
-	u32	DefersProt;
-	u32	DefersEngy;
-	u32	DupFram;
-	u32	RxFragDisc;
-	u32	TxAged;
-	u32	RxAged;
-	u32	LostSync_Max;
-	u32	LostSync_Mis;
-	u32	LostSync_Arl;
-	u32	LostSync_Dea;
-	u32	LostSync_Disa;
-	u32	LostSync_Tsf;
-	u32	HostTxMc;
-	u32	HostTxBc;
-	u32	HostTxUc;
-	u32	HostTxFail;
-	u32	HostRxMc;
-	u32	HostRxBc;
-	u32	HostRxUc;
-	u32	HostRxDiscar;
-	u32	HmacTxMc;
-	u32	HmacTxBc;
-	u32	HmacTxUc;
-	u32	HmacTxFail;
-	u32	HmacRxMc;
-	u32	HmacRxBc;
-	u32	HmacRxUc;
-	u32	HmacRxDisca;
-	u32	HmacRxAcce;
-	u32	SsidMismatch;
-	u32	ApMismatch;
-	u32	RatesMismatc;
-	u32	AuthReject;
-	u32	AuthTimeout;
-	u32	AssocReject;
-	u32	AssocTimeout;
-	u32	NewReason;
-	u32	AuthFail_1;
-	u32	AuthFail_2;
-	u32	AuthFail_3;
-	u32	AuthFail_4;
-	u32	AuthFail_5;
-	u32	AuthFail_6;
-	u32	AuthFail_7;
-	u32	AuthFail_8;
-	u32	AuthFail_9;
-	u32	AuthFail_10;
-	u32	AuthFail_11;
-	u32	AuthFail_12;
-	u32	AuthFail_13;
-	u32	AuthFail_14;
-	u32	AuthFail_15;
-	u32	AuthFail_16;
-	u32	AuthFail_17;
-	u32	AuthFail_18;
-	u32	AuthFail_19;
-	u32	RxMan;
-	u32	TxMan;
-	u32	RxRefresh;
-	u32	TxRefresh;
-	u32	RxPoll;
-	u32	TxPoll;
-	u32	HostRetries;
-	u32	LostSync_HostReq;
-	u32	HostTxBytes;
-	u32	HostRxBytes;
-	u32	ElapsedUsec;
-	u32	ElapsedSec;
-	u32	LostSyncBett;
-};
-
-struct awc_Statistics_16 {
-
-	u16	RidLen;
-	u16	RxOverrunErr;
-	u16	RxPlcpCrcErr;
-	u16	RxPlcpFormat;
-	u16	RxPlcpLength;
-	u16	RxMacCrcErr;
-	u16	RxMacCrcOk;
-	u16	RxWepErr;
-	u16	RxWepOk;
-	u16	RetryLong;
-	u16	RetryShort;
-	u16	MaxRetries;
-	u16	NoAck;
-	u16	NoCts;
-	u16	RxAck;
-	u16	RxCts;
-	u16	TxAck;
-	u16	TxRts;
-	u16	TxCts;
-	u16	TxMc;
-	u16	TxBc;
-	u16	TxUcFrags;
-	u16	TxUcPackets;
-	u16	TxBeacon;
-	u16	RxBeacon;
-	u16	TxSinColl;
-	u16	TxMulColl;
-	u16	DefersNo;
-	u16	DefersProt;
-	u16	DefersEngy;
-	u16	DupFram;
-	u16	RxFragDisc;
-	u16	TxAged;
-	u16	RxAged;
-	u16	LostSync_Max;
-	u16	LostSync_Mis;
-	u16	LostSync_Arl;
-	u16	LostSync_Dea;
-	u16	LostSync_Disa;
-	u16	LostSync_Tsf;
-	u16	HostTxMc;
-	u16	HostTxBc;
-	u16	HostTxUc;
-	u16	HostTxFail;
-	u16	HostRxMc;
-	u16	HostRxBc;
-	u16	HostRxUc;
-	u16	HostRxDiscar;
-	u16	HmacTxMc;
-	u16	HmacTxBc;
-	u16	HmacTxUc;
-	u16	HmacTxFail;
-	u16	HmacRxMc;
-	u16	HmacRxBc;
-	u16	HmacRxUc;
-	u16	HmacRxDisca;
-	u16	HmacRxAcce;
-	u16	SsidMismatch;
-	u16	ApMismatch;
-	u16	RatesMismatc;
-	u16	AuthReject;
-	u16	AuthTimeout;
-	u16	AssocReject;
-	u16	AssocTimeout;
-	u16	NewReason;
-	u16	AuthFail_1;
-	u16	AuthFail_2;
-	u16	AuthFail_3;
-	u16	AuthFail_4;
-	u16	AuthFail_5;
-	u16	AuthFail_6;
-	u16	AuthFail_7;
-	u16	AuthFail_8;
-	u16	AuthFail_9;
-	u16	AuthFail_10;
-	u16	AuthFail_11;
-	u16	AuthFail_12;
-	u16	AuthFail_13;
-	u16	AuthFail_14;
-	u16	AuthFail_15;
-	u16	AuthFail_16;
-	u16	AuthFail_17;
-	u16	AuthFail_18;
-	u16	AuthFail_19;
-	u16	RxMan;
-	u16	TxMan;
-	u16	RxRefresh;
-	u16	TxRefresh;
-	u16	RxPoll;
-	u16	TxPoll;
-	u16	HostRetries;
-	u16	LostSync_HostReq;
-	u16	HostTxBytes;
-	u16	HostRxBytes;
-	u16	ElapsedUsec;
-	u16	ElapsedSec;
-	u16	LostSyncBett;
-};
-
-
-#define AWC_TXCTL_TXOK 		(1<<1)	/* report if tx is ok */
-#define AWC_TXCTL_TXEX 		(1<<2)	/* report if tx fails */
-#define AWC_TXCTL_802_3		(0<<3)	/* 802.3 packet */
-#define AWC_TXCTL_802_11    	(1<<3)	/* 802.11 mac packet */
-#define AWC_TXCTL_ETHERNET  	(0<<4)	/* payload has ethertype */
-#define AWC_TXCTL_LLC  		(1<<4)	/* payload is llc */
-#define AWC_TXCTL_RELEASE   	(0<<5)	/* release after completion */
-#define AWC_TXCTL_NORELEASE 	(1<<5)	/* on completion returns to host */
-
-
-/************************* LINK STATUS STUFF *******************/
-
-#define	awc_link_status_loss_of_sync_missed_beacons	0x8000
-#define	awc_link_status_loss_of_sync_max_retries 	0x8001
-#define	awc_link_status_loss_of_sync_ARL_exceed  	0x8002
-#define	awc_link_status_loss_of_sync_host_request 	0x8003
-#define	awc_link_status_loss_of_sync_TSF_sync		0x8004
-#define	awc_link_status_deauthentication		0x8100
-#define	awc_link_status_disassociation			0x8200
-#define	awc_link_status_association_failed		0x8400
-#define	awc_link_status_authentication_failed		0x0300
-#define	awc_link_status_associated			0x0400
-
-struct awc_strings {
-	int	par;
-	unsigned int	mask;
-	const char * string;
-
-};
-
-#define awc_link_status_strings {\
-{awc_link_status_loss_of_sync_missed_beacons,	0xFFFF,"Loss of sync -- missed beacons"},\
-{awc_link_status_loss_of_sync_max_retries,	0xFFFF,"Loss of sync -- max retries"},\
-{awc_link_status_loss_of_sync_ARL_exceed,	0xFFFF,"Loss of sync -- average retry level (ARL) exceeded"},\
-{awc_link_status_loss_of_sync_host_request,	0xFFFF,"Loss of sync -- host request"},\
-{awc_link_status_loss_of_sync_TSF_sync,		0xFFFF,"Loss of sync -- TSF synchronization"},\
-{awc_link_status_deauthentication,		0xFF00,"Deauthentication "},\
-{awc_link_status_disassociation,		0xFF00,"Disassocation "},\
-{awc_link_status_association_failed ,		0xFF00,"Association failed "},\
-{awc_link_status_authentication_failed,		0xFF00,"Authentication failure"},\
-{awc_link_status_associated,			0xFFFF,"Associated "},\
-{0,0,NULL}\
-} 
-
-
-/****************************** COMMANDS and DEFAULTS and STATUSES ***********/
-
-/****************************** COMMANDS */
-
-
-// Command definitions
-
-
-
-
-#define awc4500wout(base, com, p0,p1,p2) {\
-	awc_write(base,awc_Param0_register, p0);\
-	awc_write(base,awc_Param1_register, p1);\
-	awc_write(base,awc_Param2_register, p2);\
-	WAIT61x3;\
-	awc_write(base,awc_Command_register, com);\
-	WAIT61x3;\
-}
-#define awc_wout(cmd, com, p0,p1,p2) {\
-	awc_write(base,awc_Param0_register, p0);\
-	awc_write(base,awc_Param1_register, p1);\
-	awc_write(base,awc_Param2_register, p2);\
-	WAIT61x3;\
-	awc_write(base,awc_Command_register, com);\
-	WAIT61x3;\
-}
-
-
-#define awc_command_NOP(cmd)			awc_wout( cmd,0x0000,0,0,0) // 	NOP
-#define awc_command_Enable_All(cmd)		awc_wout( cmd,0x0001,0,0,0) // 	Enable
-#define awc_command_Enable_MAC(cmd)		awc_wout( cmd,0x0101,0,0,0) // 	Enable Mac
-#define awc_command_Enable_Rx(cmd)		awc_wout( cmd,0x0201,0,0,0) // 	Enable Rx
-#define awc_command_Disable_MAC(cmd)		awc_wout( cmd,0x0002,0,0,0) // 	Disable
-#define awc_command_Sync_Loss(cmd)		awc_wout( cmd,0x0003,0,0,0) // 	Force a Loss of Sync
-#define awc_command_Soft_Reset(cmd)		awc_wout( cmd,0x0004,0,0,0) // 	Firmware Restart (soft reset)
-#define awc_command_Host_Sleep(cmd)		awc_wout( cmd,0x0005,0,0,0) // 	Host Sleep (must be issued as 0x0085)
-#define awc_command_Magic_Packet(cmd)		awc_wout( cmd,0x0006,0,0,0) // 	Magic Packet
-#define awc_command_Read_Configuration(cmd)	awc_wout( cmd,0x0008,0,0,0) // 	Read the Configuration from nonvolatile  storage
-#define awc_command_Allocate_TX_Buff(cmd,size)	awc_wout( cmd,0x000A,size,0,0) // 	Allocate Transmit Buffer
-#define awc_command_TX(cmd,FID)			awc_wout( cmd,0x000B,FID ,0,0) // 	Transmit
-#define awc_command_Deallocate(cmd,FID)		awc_wout( cmd,0x000C,FID ,0,0) // 	Deallocate
-#define awc_command_NOP2(cmd)			awc_wout( cmd,0x0010,0,0,0) // 	NOP (same as 0x0000)
-#define awc_command_Read_RID(cmd,RID)		awc_wout( cmd,0x0021,RID ,0,0) // 	Read RID
-#define awc_command_Write_RID(cmd,RID)		awc_wout( cmd,0x0121,RID ,0,0) // 	Write RID
-#define awc_command_Allocate_Buff(cmd,size)	awc_wout( cmd,0x0028,size,0,0) // 	Allocate Buffer
-#define awc_command_PSP_Nodes(cmd)		awc_wout( cmd,0x0030,0,0,0) // 	PSP nodes (AP only)
-#define awc_command_Set_Phy_register(cmd,phy_register,clear_bits, set_bits)\
-							awc_wout( cmd,0x003E,phy_register,clear_bits, set_bits) // 	Set PHY register
-#define awc_command_TX_Test(cmd,command, frequency, pattern)		awc_wout( cmd,0x003F,command, frequency, pattern) // 	Transmitter Test
-#define awc_command_RX_Test(cmd)		awc_wout( cmd,0x013F,0,0,0) // 	RX Test
-#define awc_command_Sleep(cmd)			awc_wout( cmd,0x0085,0,0,0) // 	Go to Sleep (No Ack bit is mandatory)
-#define awc_command_Save_Configuration(cmd)	awc_wout( cmd,0x0108,0,0,0) // 	Save the configuration to nonvolatile
-
-
-#define AWC_COMMAND_NOOP_BULL 		0x000
-#define AWC_COMMAND_ENABLE		0x001
-#define AWC_COMMAND_ENABLE_MAC		0x101
-#define AWC_COMMAND_ENABLE_RX		0x201
-#define AWC_COMMAND_DISABLE		0x002
-#define AWC_COMMAND_LOSE_SYNC		0x003
-#define AWC_COMMAND_SOFT_RESET		0x004
-#define AWC_COMMAND_HOST_SLEEP		0x085
-#define AWC_COMMAND_MAGIC_PACKET	0x006
-#define AWC_COMMAND_READ_CONF		0x008
-#define AWC_COMMAND_SAVE_CONF		0x108
-#define AWC_COMMAND_TX_ALLOC		0x00A
-#define AWC_COMMAND_TX			0x00B
-#define AWC_COMMAND_DEALLOC		0x00C
-#define AWC_COMMAND_NOOP		0x010
-#define AWC_COMMAND_READ_RID		0x021
-#define AWC_COMMAND_WRITE_RID		0x121
-#define AWC_COMMAND_ALLOC		0x028
-#define AWC_COMMAND_PSP_NODES		0x030
-#define AWC_COMMAND_SET_PHY		0x03E
-#define AWC_COMMAND_TX_TEST		0x03F
-#define AWC_COMMAND_SLEEP		0x085
-
-
-#define awc_command_name_strings {\
-	{0x0000, 0x00FF,"awc_command_NOP " },\
-	{0x0001, 0x00FF,"awc_command_Enable_All " },\
-	{0x0101, 0x01FF,"awc_command_Enable_MAC " },\
-	{0x0201, 0x01FF,"awc_command_Enable_Rx " },\
-	{0x0002, 0x00FF,"awc_command_Disable_MAC " },\
-	{0x0003, 0x00FF,"awc_command_Sync_Loss " },\
-	{0x0004, 0x00FF,"awc_command_Soft_Reset " },\
-	{0x0005, 0x00FF,"awc_command_Host_Sleep " },\
-	{0x0006, 0x00FF,"awc_command_Magic_Packet " },\
-	{0x0008, 0x00FF,"awc_command_Read_Configuration " },\
-	{0x000A, 0x00FF,"awc_command_Allocate_TX_Buff " },\
-	{0x000B, 0x00FF,"awc_command_TX " },\
-	{0x000C, 0x00FF,"awc_command_Deallocate " },\
-	{0x0010, 0x00FF,"awc_command_NOP2 " },\
-	{0x0021, 0x00FF,"awc_command_Read_RID " },\
-	{0x0121, 0x01FF,"awc_command_Write_RID " },\
-	{0x0028, 0x00FF,"awc_command_Allocate_Buff " },\
-	{0x0030, 0x00FF,"awc_command_PSP_Nodes " },\
-	{0x003E, 0x00FF,"awc_command_Set_Phy_register " },\
-	{0x003F, 0x00FF,"awc_command_TX_Test " },\
-	{0x013F, 0x01FF,"awc_command_RX_Test " },\
-	{0x0085, 0x00FF,"awc_command_Sleep " },\
-	{0x0108, 0x01FF,"awc_command_Save_Configuration " },\
-	{0x0000, 0x00FF, NULL}\
-};
-
-
-/***************************** STATUSES */
-
-#define awc_reply_success 0x0000
-
-#define awc_reply_error_strings {\
-   { 0x0000, 0x00FF,"    Success"},\
-   { 0x0001, 0x00FF,"    Illegal command."},\
-   { 0x0002, 0x00FF,"    Illegal format."},\
-   { 0x0003, 0x00FF,"    Invalid FID."},\
-   { 0x0004, 0x00FF,"    Invalid RID."},\
-   { 0x0005, 0x00FF,"    Too Large"},\
-   { 0x0006, 0x00FF,"    MAC is not disabled."},\
-   { 0x0007, 0x00FF,"    Alloc is still busy processing previous alloc"},\
-   { 0x0008, 0x00FF,"    Invalid Mode Field"},\
-   { 0x0009, 0x00FF,"    Tx is not allowed in monitor mode"},\
-   { 0x000A, 0x00FF,"    Loop test or memory test error"},\
-   { 0x000B, 0x00FF,"    Cannot read this RID."},\
-   { 0x000C, 0x00FF,"    Cannot write to this RID."},\
-   { 0x000D, 0x00FF,"    Tag not found."},\
-   { 0x0080, 0x00FF,"    Config mode is invalid."},\
-   { 0x0081, 0x00FF,"    Config hop interval is invalid."},\
-   { 0x0082, 0x00FF,"    Config beacon interval is invalid."},\
-   { 0x0083, 0x00FF,"    Config receive mode is invalid."},\
-   { 0x0084, 0x00FF,"    Config MAC address is invalid."},\
-   { 0x0085, 0x00FF,"    Config rates are invalid."},\
-   { 0x0086, 0x00FF,"    Config ordering field is invalid."},\
-   { 0x0087, 0x00FF,"    Config scan mode is invalid."},\
-   { 0x0088, 0x00FF,"    Config authentication type is invalid."},\
-   { 0x0089, 0x00FF,"    Config power save mode is invalid."},\
-   { 0x008A, 0x00FF,"    Config radio type is invalid."},\
-   { 0x008B, 0x00FF,"    Config diversity is invalid."},\
-   { 0x008C, 0x00FF,"    Config SSID list is invalid."},\
-   { 0x008D, 0x00FF,"    Config specified AP list is invalid."},\
-   { 0x0000, 0x00FF, NULL}\
-};
-
-#define awc_reply_command_failed( status) ((status & 0x7F00) == 0x7F)
-
-
-/*************************   PHY and TEST commands   ****************/
-
-
-// this might be wrong and reading is not implemented(was not in spec properly)
-#define awc_Set_PLCP_Word(PLCP_Word)\
-	awc_command_Set_Phy_register(base,0x8000,0 ,PLCP_Word)
-#define awc_Set_TX_Test_Freq(Tx_Test_Freq)\
-	awc_command_Set_Phy_register(base,0x8002,0 ,Tx_Test_Freq)
-#define awc_Set_Tx_Power(Tx_Power)\
-	awc_command_Set_Phy_register(base,0x8004,0 ,Tx_Power)
-#define awc_Set_RSSI_Treshold(RSSI_Treshold)\
-	awc_command_Set_Phy_register(base,0x8006,0 ,RSSI_Treshold)
-#define awc_Get_PLCP_Word(PLCP_Word)\
-	awc_command_Set_Phy_register(base,0x8000,0 ,0)
-#define awc_Get_TX_Test_Freq(Tx_Test_Freq)\
-	awc_command_Set_Phy_register(base,0x8002,0 ,0)
-#define awc_Get_Tx_Power(Tx_Power)\
-	awc_command_Set_Phy_register(base,0x8004,0 ,0)
-#define awc_Get_RSSI_Treshold(RSSI_Treshold)\
-	awc_command_Set_Phy_register(base,0x8006,0 ,0)
-
-
-#define awc_tx_test_code_end 	0x0000   //  Ends the transmitter test
-#define awc_tx_test_code_loop	0x0001   //  Loop back to the beginning of the commands
-#define awc_tx_test_code_start	0x0002   //  Start transmitting
-#define awc_tx_test_code_stop	0x0003   //  Stop transmitting
-#define awc_tx_test_code_delayu 0x0004   //  Delay for N usec where N is the next word
-#define awc_tx_test_code_delayk 0x0005   //  Delay for N Kusec where N is the next word
-#define awc_tx_test_code_next	0x0006   //  Go to the next frequency in the frequency RID
-#define awc_tx_test_code_rx	0x0007   //  Start receive mode
-
-#define awc_tx_test_code_strings {\
-{  awc_tx_test_code_end , 	0x000f ,"    Ends the transmitter test"},\
-{  awc_tx_test_code_loop , 	0x000f ,"     Loop back to the beginning of the commands"},\
-{  awc_tx_test_code_start , 	0x000f ,"    Start transmitting"},\
-{  awc_tx_test_code_stop ,	0x000f ,"    Stop transmitting"},\
-{  awc_tx_test_code_delayu , 	0x000f ,"    Delay for N usec where N is the next word"},\
-{  awc_tx_test_code_delayk , 	0x000f ,"    Delay for N Kusec where N is the next word"},\
-{  awc_tx_test_code_next , 	0x000f ,"    Go to the next frequency in the frequency RID"},\
-{  awc_tx_test_code_rx 	,	0x000f ,"    Start receive mode"},\
-{ 			0   , 0x000f ,NULL}\
-};
-
-
-
-#define AWC_COMMSTAT_HARD_RESET		0x0000001
-#define AWC_COMMSTAT_WAKE		0x0000002
-#define AWC_COMMSTAT_SOFT_RESET		0x0000004
-#define AWC_COMMSTAT_CONFIGURE		0x0000008
-#define AWC_COMMSTAT_READ_CONF		0x0000010
-#define AWC_COMMSTAT_SAVE_CONF		0x0000020
-#define AWC_COMMSTAT_DEALLOC		0x0000040
-#define AWC_COMMSTAT_ALLOC_TX		0x0000080
-#define AWC_COMMSTAT_ALLOC_TEST		0x0000100
-#define AWC_COMMSTAT_ENABLE_MAC		0x0000200
-#define AWC_COMMSTAT_ENABLE_RX		0x0000400
-#define AWC_COMMSTAT_DISABLE_MAC	0x0000800
-#define AWC_COMMSTAT_RX_ACK		0x0001000
-#define AWC_COMMSTAT_TX_ACK		0x0002000
-#define AWC_COMMSTAT_AWAKEN_ACK		0x0004000
-#define AWC_COMMSTAT_TX_FAIL_ACK	0x0008000
-#define AWC_COMMSTAT_LINK_ACK		0x0010000
-#define AWC_COMMSTAT_CLR_CMD		0x0020000
-#define AWC_COMMSTAT_ALLOC_ACK		0x0040000
-#define AWC_COMMSTAT_HOST_SLEEP		0x0080000
-#define AWC_COMMSTAT_RX			0x0100000
-#define AWC_COMMSTAT_TX			0x0200000
-#define AWC_COMMSTAT_SLEEP		0x0400000
-#define AWC_COMMSTAT_PSP_NODES		0x0800000
-#define AWC_COMMSTAT_SET_TX_POWER 	0x1000000
-
-
-/*****************************     R  I  D	***************/
-
-#define AWC_NOF_RIDS	18
-extern int awc_rid_setup(struct net_device * dev);
-
-struct aironet4500_rid_selector{
-	const u16 selector;
-	const unsigned 	MAC_Disable_at_write:1;
-	const unsigned	read_only:1;
-	const unsigned  may_change:1;
-	const char *	name;
-};
-
-
-
-
-
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_General_Config;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_SSID_list;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_AP_list	;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_Driver_name;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_Encapsulation;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_Active_Config;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_Capabilities;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_AP_Info	;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_Radio_Info;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_Status	;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_Modulation	;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_WEP_volatile	;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_WEP_nonvolatile	;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats_delta;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats_clear;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats_delta;
-extern const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats_clear;
-
-#define awc_def_gen_RID(offset,name, bits,mask,value,value_name)\
- {&aironet4500_RID_Select_General_Config,offset, bits,1,1,0,0, mask, value, name, value_name}
-#define awc_def_SSID_RID(offset,name, bits,mask,value,value_name)\
-  {&aironet4500_RID_Select_SSID_list,offset, bits,1,1,0,0, mask, value, name, value_name}
-#define awc_def_AP_List_RID(offset,name, bits,mask,value,value_name)\
- {&aironet4500_RID_Select_AP_list,offset, bits,1,1,0,0, mask, value, name, value_name}
-#define awc_def_Dname_RID(offset,name, bits,mask,value,value_name)\
- {&aironet4500_RID_Select_Driver_name,offset, bits,1,1,0,0, mask, value, name, value_name}
-#define awc_def_act_RID(offset,name, bits,mask,value,value_name)\
- {&aironet4500_RID_Select_Active_Config,offset, bits,1,1,0,0, mask, value, name, value_name}
-#define awc_def_Cap_RID(offset,name, bits,mask,value,value_name)\
- {&aironet4500_RID_Select_Capabilities,offset, bits,1,1,0,0, mask, value, name, value_name}
-#define awc_def_AP_RID(offset,name, bits,mask,value,value_name)\
- {&aironet4500_RID_Select_AP_Info,offset, bits,1,1,0,0, mask, value, name, value_name}
-#define awc_def_Radio_RID(offset,name, bits,mask,value,value_name)\
- {&aironet4500_RID_Select_Radio_Info,offset, bits,1,1,0,0, mask, value, name, value_name}
-#define awc_def_Stat_RID(offset,name, bits,mask,value,value_name)\
- {&aironet4500_RID_Select_Status,offset, bits,1,1,0,0, mask, value, name, value_name}
-#define awc_def_Enc_RID(offset,name, bits,mask,value,value_name)\
- {&aironet4500_RID_Select_Encapsulation,offset, bits,1,1,0,0, mask, value, name, value_name}
-
-#define awc_def_WEPv_RID(offset,name, bits,mask,value,value_name)\
- {&aironet4500_RID_Select_WEP_volatile,offset, bits,1,1,0,0, mask, value, name, value_name}
-#define awc_def_WEPnv_RID(offset,name, bits,mask,value,value_name)\
- {&aironet4500_RID_Select_WEP_nonvolatile,offset, bits,1,1,0,0, mask, value, name, value_name}
-#define awc_def_Modulation_RID(offset,name, bits,mask,value,value_name)\
- {&aironet4500_RID_Select_Modulation,offset, bits,1,1,0,0, mask, value, name, value_name}
-
-#define awc_def_Stats_RID(o16,offset,name, value_name)\
- {&aironet4500_RID_Select_32_stats,offset, 32,1,1,0,0, 0xffffffff, 0, name, value_name}
-#define awc_def_Stats_delta_RID(o16,offset,name, value_name)\
- {&aironet4500_RID_Select_32_stats_delta,offset, 32,1,1,0,0, 0xffffffff, 0, name, value_name}
-#define awc_def_Stats_clear_RID(o16,offset,name, value_name)\
- {&aironet4500_RID_Select_32_stats_delta,offset,32,1,1,0,0, 0xffffffff,  0, name,value_name}
-
-#define awc_def_Stats16_RID(offset,o32,name, value_name)\
- {&aironet4500_RID_Select_16_stats,offset, 16,1,1,0,0, 0xffffffff, 0, name, value_name}
-#define awc_def_Stats16_delta_RID(offset,o32,name, value_name)\
- {&aironet4500_RID_Select_16_stats_delta,offset, 16,1,1,0,0, 0xffffffff,  0, name,value_name}
-#define awc_def_Stats16_clear_RID(offset,o32,name, value_name)\
- {&aironet4500_RID_Select_16_stats_delta,offset, 16,1,1,0,0, 0xffffffff,  0, name,value_name}
-
-
-#define aironet4500_RID_Select_strings {\
-{ 0xFF10, 0xffff, "General Configuration"},\
-{ 0xFF11, 0xffff, "Valid SSID list" },\
-{ 0xFF12, 0xffff, "Valid AP list"},\
-{ 0xFF13, 0xffff, "Driver name"},\
-{ 0xFF14, 0xffff, "Ethernet Protocol"},\
-{ 0xFF15, 0xffff, "WEP volatile"},\
-{ 0xFF16, 0xffff, "WEP nonvolatile"},\
-{ 0xFF17, 0xffff, "Modulation"},\
-{ 0xFF20, 0xffff, "Actual Configuration"},\
-{ 0xFF00, 0xffff, "Capabilities"},\
-{ 0xFF01, 0xffff, "AP Info"},\
-{ 0xFF02, 0xffff, "Radio Info"},\
-{ 0xFF50, 0xffff, "Status"},\
-{ 0xFF60, 0xffff, "Cumulative 16-bit Statistics"},\
-{ 0xFF61, 0xffff, "Delta 16-bit Statistics"},\
-{ 0xFF62, 0xffff, "Delta 16-bit Statistics and Clear"},\
-{ 0xFF68, 0xffff, "Cumulative 32-bit Statistics"},\
-{ 0xFF69, 0xffff, "Delta 32-bit Statistics "},\
-{ 0xFF6A, 0xffff, "Delta 32-bit Statistics and Clear"},\
-{ 0x0000, 0xffff, NULL}\
-}
-
-
-
-
-
-struct aironet4500_RID {
-	const struct aironet4500_rid_selector	*  selector;
-	const u32 	offset;
-	const u8 	bits;
-	const u8 	array;
-	const u32 	units;
-	const unsigned read_only:1;
-	const unsigned null_terminated:1;
-	const u32 	mask;
-	const u32 	value;
-	const char * name;
-	const char * value_name;
-		
-};
-
-struct aironet4500_RID_names{
-	struct aironet4500_RID rid;
-	char *name;
-};
-
-struct aironet4500_RID_names_values{
-	struct aironet4500_RID rid;
-	char *name;
-	u32	mask;	
-};
-
-struct awc_rid_dir{
-	const struct aironet4500_rid_selector *	selector;
-	const int size;
-	const struct aironet4500_RID * rids;
-	struct net_device * dev ;
-	void * 	buff;
-	int	bufflen; // just checking
-};
-
-extern int awc_nof_rids;
-extern struct awc_rid_dir  awc_rids[];
-
-
-
-
-
-struct awc_private {
-	dev_node_t node; // somewhere back in times PCMCIA needed that
-	
-	int dummy_test; // left for cleanup
-	// card rid inmemory copy
-	struct awc_config 		config; // card RID mirrors
-	struct awc_config 		general_config; // 
-	struct awc_SSIDs  		SSIDs;
-	struct awc_fixed_APs 		fixed_APs;
-	struct awc_driver_name		driver_name;
-	struct awc_enc_trans		enc_trans;
-	struct awc_cap			capabilities;
-	struct awc_status		status;
-	struct awc_AP			AP;
-	struct awc_Statistics_32 	statistics;
-	struct awc_Statistics_32 	statistics_delta;
-	struct awc_Statistics_32 	statistics_delta_clear;
-	struct awc_Statistics_16 	statistics16;
-	struct awc_Statistics_16 	statistics16_delta;
-	struct awc_Statistics_16 	statistics16_delta_clear;
-	struct awc_wep_key		wep_volatile;
-	struct awc_wep_key		wep_nonvolatile;
-	struct awc_modulation		modulation;
-
-	// here are just references to rids
-	struct awc_rid_dir		rid_dir[AWC_NOF_RIDS];
-	int	rids_read;
-	
-	
-	struct awc_bap		bap0;
-	struct awc_bap		bap1;
-	int			sleeping_bap;
-	
-	struct awc_fid_queue    tx_small_ready;
-	struct awc_fid_queue    tx_large_ready;
-	struct awc_fid_queue    tx_post_process;
-	struct awc_fid_queue    tx_in_transmit;
-	spinlock_t		queues_lock;
-
-	struct awc_fid_queue    rx_ready;
-	struct awc_fid_queue    rx_post_process;
-
-
-	
-	struct semaphore	tx_buff_semaphore;
-	volatile int		tx_buffs_in_use;
-	volatile int 		tx_small_buffs_in_use;
-	volatile int		tx_buffs_total;
-	volatile int		tx_small_buffs_total;
-	int			large_buff_mem;
-	int			small_buff_no;
-	
-	volatile int		mac_enabled;
-	u16			link_status;
-	u8			link_status_changed;
-	
-	volatile int		ejected;
-	volatile int		work_running;
-	volatile int		work_active;
-	volatile long		tx_chain_active;
-	volatile u16		enabled_interrupts;
-	volatile u16		waiting_interrupts;
-	volatile int		interrupt_count;
-	
-	// Command serialize stuff
-//changed to spinlock        struct semaphore 	command_semaphore;
-	spinlock_t		both_bap_spinlock; // on SMP, card should theorethically live without that
-	unsigned long		both_bap_spinlock_flags;
-	spinlock_t		bap_setup_spinlock; // on SMP, card should theoretically live without that
-	unsigned long		bap_setup_spinlock_flags;
-	spinlock_t		command_issuing_spinlock;
-	unsigned long		command_issuing_spinlock_flags;
-	spinlock_t		interrupt_spinlock;
-
-        volatile int		unlock_command_postponed;
-        struct awc_command	cmd;
-        long long		async_command_start;
-        volatile int		command_semaphore_on;
-        struct work_struct			work;
-	volatile int		process_tx_results;
-
-	u8			p2p[6];
-	u8			bssid[6];
-	int			p2p_uc;
-	int			p2p_found;
-	int			p802_11_send;
-	int			simple_bridge;
-	int			force_rts_on_shorter;
-	int			force_tx_rate;
-	int			ip_tos_reliability_rts;
-	int			ip_tos_troughput_no_retries;
-	int 			full_stats;
-	int 			debug;
-	
-	struct net_device_stats stats;
-	
-	struct ctl_table * proc_table;
-
-	void	* 		bus;
-	int 			card_type;
-};
-
-extern int 		awc_init(struct net_device * dev);
-extern void 		awc_reset(struct net_device *dev);
-extern int 		awc_config(struct net_device *dev);
-extern int 		awc_open(struct net_device *dev);
-extern void 		awc_tx_timeout(struct net_device *dev);
-extern int 		awc_start_xmit(struct sk_buff *, struct net_device *);
-extern void 		awc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-extern struct net_device_stats *	awc_get_stats(struct net_device *dev);
-extern void		awc_set_multicast_list(struct net_device *dev);
-extern int awc_change_mtu(struct net_device *dev, int new_mtu);  
-extern int 		awc_close(struct net_device *dev);
-extern int		awc_private_init(struct net_device * dev);
-extern int awc_register_proc(int (*awc_proc_set_device) (int),int (*awc_proc_unset_device)(int));
-extern int awc_unregister_proc(void);
-extern int (* awc_proc_set_fun) (int) ;
-extern int (* awc_proc_unset_fun) (int) ;
-extern int	awc_interrupt_process(struct net_device * dev);
-extern int	awc_readrid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf );
-extern int 	awc_writerid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf);
-extern int 	awc_readrid_dir(struct net_device * dev, struct awc_rid_dir * rid );
-extern int 	awc_writerid_dir(struct net_device * dev, struct awc_rid_dir * rid);
-extern int 	awc_tx_alloc(struct net_device * dev) ;
-extern int	awc_tx_dealloc(struct net_device * dev);
-extern struct awc_fid *awc_tx_fid_lookup(struct net_device * dev, u16 fid);
-extern int 	awc_issue_soft_reset(struct net_device * dev);
-extern int	awc_issue_noop(struct net_device * dev);
-extern int 	awc_dump_registers(struct net_device * dev);
-extern unsigned short  awc_issue_command_and_block(struct awc_command * cmd);
-extern int	awc_enable_MAC(struct net_device * dev);
-extern int	awc_disable_MAC(struct net_device * dev);
-extern int	awc_read_all_rids(struct net_device * dev);
-extern int	awc_write_all_rids(struct net_device * dev);
-extern int	awc_receive_packet(struct net_device * dev);
-extern int	awc_transmit_packet(struct net_device * dev, struct awc_fid * tx_buff) ;
-extern int	awc_tx_complete_check(struct net_device * dev);
-extern int	awc_interrupt_process(struct net_device * dev);
-extern void 	awc_work(struct net_device *dev);
-extern int 	awc_802_11_find_copy_path(struct net_device * dev, struct awc_fid * rx_buff);
-extern void 	awc_802_11_router_rx(struct net_device * dev,struct awc_fid * rx_buff);
-extern int 	awc_802_11_tx_find_path_and_post(struct net_device * dev, struct sk_buff * skb);
-extern void 	awc_802_11_after_tx_packet_to_card_write(struct net_device * dev, struct awc_fid * tx_buff);
-extern void 	awc_802_11_after_failed_tx_packet_to_card_write(struct net_device * dev,struct awc_fid * tx_buff);
-extern void 	awc_802_11_after_tx_complete(struct net_device * dev, struct awc_fid * tx_buff);
-extern void 	awc_802_11_failed_rx_copy(struct net_device * dev,struct awc_fid * rx_buff);
-extern int 	awc_tx_alloc(struct net_device * dev) ;
-extern int 	awc_tx_dealloc_fid(struct net_device * dev,struct awc_fid * fid);
-extern int	awc_tx_dealloc(struct net_device * dev);
-extern struct awc_fid *
-	awc_tx_fid_lookup_and_remove(struct net_device * dev, u16 fid_handle);
-extern int 	awc_queues_init(struct net_device * dev);
-extern int 	awc_queues_destroy(struct net_device * dev);
-extern int 	awc_rids_setup(struct net_device * dev);
-
-
-
-extern int		awc_debug;
-extern int bap_sleep ;
-extern int bap_sleep_after_setup ;
-extern int sleep_before_command  ;
-extern int bap_sleep_before_write;
-extern int sleep_in_command    ;
-extern int both_bap_lock;
-extern int bap_setup_spinlock;
-extern int tx_queue_len ;
-extern int tx_rate;
-extern int awc_full_stats;
-
-#define MAX_AWCS	4
-extern struct net_device * aironet4500_devices[MAX_AWCS];
-
-#define AWC_DEBUG 1
-
-#ifdef AWC_DEBUG
-	#define DEBUG(a,args...) if (awc_debug & a) printk( args)
-	#define AWC_ENTRY_EXIT_DEBUG(a)  if (awc_debug & 8) printk( a)
-#else
-	#define DEBUG(a, args...)
-	#define AWC_ENTRY_EXIT_DEBUG(a)
-#endif
-
-#endif /* AIRONET4500_H */
diff -Nru a/drivers/net/aironet4500_card.c b/drivers/net/aironet4500_card.c
--- a/drivers/net/aironet4500_card.c	Sun Feb 23 22:25:25 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1019 +0,0 @@
-/*
- *	 Aironet 4500 PCI-ISA-i365 driver
- *
- *		Elmer Joandi, Januar 1999
- *	Copyright GPL
- *	
- *
- *	Revision 0.1 ,started  30.12.1998
- *
- *	Revision 0.2, Feb 27, 2000
- *		Jeff Garzik - softnet, cleanups
- *
- */
-#ifdef MODULE
-static const char *awc_version =
-"aironet4500_cards.c v0.2  Feb 27, 2000  Elmer Joandi, elmer@ylenurme.ee.\n";
-#endif
-
-#include <linux/delay.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/config.h>
-#include <linux/if_arp.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/skbuff.h>
-#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/in.h>
-#include <linux/version.h>
-
-#include <asm/io.h>
-#include <asm/system.h>
-#include <asm/bitops.h>
-
-#include "aironet4500.h"
-
-#define PCI_VENDOR_ID_AIRONET 	0x14b9
-#define PCI_DEVICE_AIRONET_4800_1 0x1
-#define PCI_DEVICE_AIRONET_4800 0x4500
-#define PCI_DEVICE_AIRONET_4500 0x4800
-#define AIRONET4X00_IO_SIZE 	0x40
-#define AIRONET4X00_CIS_SIZE	0x300
-#define AIRONET4X00_MEM_SIZE	0x300
-
-#define AIRONET4500_PCI 	1
-#define AIRONET4500_PNP		2
-#define AIRONET4500_ISA		3
-#define AIRONET4500_365		4
-
-
-#ifdef CONFIG_AIRONET4500_PCI
-
-#include <linux/pci.h>
-
-static struct pci_device_id aironet4500_card_pci_tbl[] __devinitdata = {
-	{ PCI_VENDOR_ID_AIRONET, PCI_DEVICE_AIRONET_4800_1, PCI_ANY_ID, PCI_ANY_ID, },
-	{ PCI_VENDOR_ID_AIRONET, PCI_DEVICE_AIRONET_4800, PCI_ANY_ID, PCI_ANY_ID, },
-	{ PCI_VENDOR_ID_AIRONET, PCI_DEVICE_AIRONET_4500, PCI_ANY_ID, PCI_ANY_ID, },
-	{ }			/* Terminating entry */
-};
-MODULE_DEVICE_TABLE(pci, aironet4500_card_pci_tbl);
-MODULE_LICENSE("GPL");
-
-
-static int awc_pci_init(struct net_device * dev, struct pci_dev *pdev,
- 			int ioaddr, int cis_addr, int mem_addr,u8 pci_irq_line) ;
-
-
-int awc4500_pci_probe(struct net_device *dev)
-{
-	int cards_found = 0;
-	u8 pci_irq_line = 0;
-//	int p;
-	struct pci_dev *pdev = NULL;
-		
-	if (!pci_present()) 
-		return -1;
-
-	while ((pdev = pci_find_class (PCI_CLASS_NETWORK_OTHER << 8, pdev))) {
-		u16 pci_command, new_command;
-		u32 pci_memaddr;
-		u32 pci_ioaddr;
-		u32 pci_cisaddr;
-
-		if (pdev->vendor != PCI_VENDOR_ID_AIRONET)
-			continue;
-		if ((pdev->device != PCI_DEVICE_AIRONET_4800_1) &&
-		    (pdev->device != PCI_DEVICE_AIRONET_4800) &&
-		    (pdev->device != PCI_DEVICE_AIRONET_4500))
-			continue;
-
-		if (pci_enable_device(pdev))
-			continue;
-
-	        pci_irq_line = pdev->irq;
-		pci_memaddr = pci_resource_start (pdev, 0);
-                pci_cisaddr = pci_resource_start (pdev, 1);
-		pci_ioaddr = pci_resource_start (pdev, 2);
-
-//		printk("\n pci capabilities %x and ptr %x \n",pci_caps,pci_caps_ptr);
-		/* Remove I/O space marker in bit 0. */
-
-//		if (check_region(pci_ioaddr, AIRONET4X00_IO_SIZE) ||
-//			check_region(pci_cisaddr, AIRONET4X00_CIS_SIZE) ||
-//			check_region(pci_memaddr, AIRONET4X00_MEM_SIZE)) {
-//				printk(KERN_ERR "aironet4X00 mem addrs not available for maping \n");
-//				continue;
-//		}
-		if (!request_region(pci_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr"))
-			continue;
-//		request_region(pci_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
-//		request_region(pci_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem");
-
-		mdelay(10);
-
-		pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
-		new_command = pci_command | PCI_COMMAND_SERR;
-		if (pci_command != new_command)
-			pci_write_config_word(pdev, PCI_COMMAND, new_command);
-
-
-/*		if (device == PCI_DEVICE_AIRONET_4800)
-			pci_write_config_dword(pdev, 0x40, 0x00000000);
-
-		udelay(1000);
-*/
-		if (pdev->device == PCI_DEVICE_AIRONET_4800)
-			pci_write_config_dword(pdev, 0x40, 0x40000000);
-
-		if (awc_pci_init(dev, pdev, pci_ioaddr,pci_cisaddr,pci_memaddr,pci_irq_line)){
-			printk(KERN_ERR "awc4800 pci init failed \n");
-			break;
-		}
-		dev = 0;
-		cards_found++;
-	}
-
-	return cards_found ? 0 : -ENODEV;
-}
-
-
-static int awc_pci_init(struct net_device * dev, struct pci_dev *pdev,
- 			int ioaddr, int cis_addr, int mem_addr, u8 pci_irq_line) {
-
-	int i, allocd_dev = 0;
-
-	if (!dev) {
-		dev = init_etherdev(NULL, 0);	
-		if (!dev)
-			return -ENOMEM;
-		allocd_dev = 1;
-	}
-	dev->priv = kmalloc(sizeof(struct awc_private),GFP_KERNEL );
-        if (!dev->priv) {
-                if (allocd_dev) {
-                        unregister_netdev(dev);
-                        kfree(dev);
-                }
-                return -ENOMEM;
-        }       
-	memset(dev->priv,0,sizeof(struct awc_private));
-	if (!dev->priv) {
-		printk(KERN_CRIT "aironet4x00: could not allocate device private, some unstability may follow\n");
-		if (allocd_dev) {
-			unregister_netdev(dev);
-			kfree(dev);
-		}
-		return -ENOMEM;
-	};
-
-//	ether_setup(dev);
-
-//	dev->tx_queue_len = tx_queue_len;
-
-	dev->hard_start_xmit = 		&awc_start_xmit;
-//	dev->set_config = 		&awc_config_misiganes,aga mitte awc_config;
-	dev->get_stats = 		&awc_get_stats;
-//	dev->set_multicast_list = 	&awc_set_multicast_list;
-	dev->change_mtu		=	awc_change_mtu;
-	dev->init = &awc_init;
-	dev->open = &awc_open;
-	dev->stop = &awc_close;
-    	dev->base_addr = ioaddr;
-    	dev->irq = pci_irq_line;
-	dev->tx_timeout = &awc_tx_timeout;
-	dev->watchdog_timeo = AWC_TX_TIMEOUT;
-	
-
-	i = request_irq(dev->irq,awc_interrupt, SA_SHIRQ | SA_INTERRUPT, dev->name, dev);
-	if (i) {
-		kfree(dev->priv);
-		dev->priv = NULL;
-		if (allocd_dev) {
-			unregister_netdev(dev);
-			kfree(dev);
-		}
-		return i;
-	}
-
-	awc_private_init( dev);
-	awc_init(dev);
-
-	i=0;
-	while (aironet4500_devices[i] && i < MAX_AWCS-1) i++;
-	if (!aironet4500_devices[i]){
-		aironet4500_devices[i]=dev;
-		((struct awc_private *)
-		aironet4500_devices[i]->priv)->card_type = AIRONET4500_PCI;
-
-		if (awc_proc_set_fun)
-			awc_proc_set_fun(i);
-	}
-
-//	if (register_netdev(dev) != 0) {
-//		printk(KERN_NOTICE "awc_cs: register_netdev() failed\n");
-//		goto failed;
-//	}
-
-	return 0; 
-//  failed:
-//  	return -1;
-
-}
-
-#ifdef MODULE
-static void awc_pci_release(void) {
-
-//	long flags;
-	int i=0;
-
-	DEBUG(0, "awc_detach \n");
-
-	i=0;
-	while ( i < MAX_AWCS) {
-		if (!aironet4500_devices[i])
-                        {i++; continue;};
-		if (((struct awc_private *)aironet4500_devices[i]->priv)->card_type != AIRONET4500_PCI)
-		                  {i++;      continue;}
-
-		if (awc_proc_unset_fun)
-			awc_proc_unset_fun(i);
-		release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE);
-//		release_region(pci_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
-//		release_region(pci_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem");
-
-		unregister_netdev(aironet4500_devices[i]);
-		free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
-		kfree(aironet4500_devices[i]->priv);
-		kfree(aironet4500_devices[i]);
-
-		aironet4500_devices[i]=0;
-
-
-		i++;
-	}
-	
-
-} 
-
-
-#endif //MODULE
-
-
-#endif /* CONFIG_AIRONET4500_PCI */
-
-#ifdef CONFIG_AIRONET4500_PNP
-
-#include <linux/isapnp.h>
-#define AIRONET4X00_IO_SIZE 	0x40
-
-#define isapnp_logdev pnp_dev
-#define isapnp_dev    pnp_card
-#define isapnp_find_device pnp_find_card
-#define isapnp_find_logdev pnp_find_dev
-#define PNP_BUS card
-#define PNP_BUS_NUMBER number
-#define PNP_DEV_NUMBER number
-
-
-int awc4500_pnp_hw_reset(struct net_device *dev){
-
-	struct isapnp_logdev *logdev;
-
-	DEBUG(0, "awc_pnp_reset \n");
-
-	if (!dev->priv ) {
-		printk("awc4500 no dev->priv in hw_reset\n");
-		return -1;
-	};
-
-	logdev = ((struct isapnp_logdev *) ((struct awc_private *)dev->priv)->bus);
-
-	if (!logdev ) {
-		printk("awc4500 no pnp logdev in hw_reset\n");
-		return -1;
-	};
-
-	pnp_disable_dev(logdev);
-
-	udelay(100);
-
-	if (pnp_activate_dev(logdev, NULL) < 0) {
-		printk("%s cfg begin failed in hw_reset for csn %x devnum %x \n",
-				dev->name, logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER);
-		return -EAGAIN;
-	}
-
-	return 0;
-}
-
-int awc4500_pnp_probe(struct net_device *dev)
-{
-	int isa_index = 0;
-	int isa_irq_line = 0;
-	int isa_ioaddr = 0;
-	int card = 0;
-	int i=0;
-	struct isapnp_dev * pnp_dev ;
-	struct isapnp_logdev *logdev;
-
-	while (1) {
-
-		pnp_dev = isapnp_find_device(
-						ISAPNP_VENDOR('A','W','L'), 
-						ISAPNP_DEVICE(1),
-						0);
-	
-		if (!pnp_dev) break;  
-		
-		isa_index++;
-
-		logdev = isapnp_find_logdev(pnp_dev, ISAPNP_VENDOR('A','W','L'),
-					    ISAPNP_FUNCTION(1),
-					    0);
-		if (!logdev){
-			printk("No logical device found on Aironet board \n");
-			return -ENODEV;
-		}
-		if (pnp_device_attach(logdev) < 0) {
-			printk("pnp_device_attach failed for csn %x devnum %x \n",
-					logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER);
-			return -EAGAIN;
-		}
-		if (pnp_activate_dev(logdev, NULL) < 0) {
-			printk("pnp_activate_dev failed for csn %x devnum %x \n",
-					logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER);
-			pnp_device_detach(logdev);
-			return -EIO;
-		}
-
-		isa_irq_line = pnp_irq(logdev, 0);
-		isa_ioaddr = pnp_port_start(logdev, 0);
-		request_region(isa_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr");
-
-		if (!dev) {
-			dev = init_etherdev(NULL, 0);	
-			if (!dev) {
-				release_region(isa_ioaddr, AIRONET4X00_IO_SIZE);
-				pnp_device_detach(logdev);
-				return -ENOMEM;
-			}
-		}
-		dev->priv = kmalloc(sizeof(struct awc_private),GFP_KERNEL );
-		memset(dev->priv,0,sizeof(struct awc_private));
-		if (!dev->priv) {
-			printk(KERN_CRIT "aironet4x00: could not allocate device private, some unstability may follow\n");
-			return -1;
-		};
-		((struct awc_private *)dev->priv)->bus =  logdev;
-
-	//	ether_setup(dev);
-	
-	//	dev->tx_queue_len = tx_queue_len;
-	
-		dev->hard_start_xmit = 		&awc_start_xmit;
-	//	dev->set_config = 		&awc_config_misiganes,aga mitte awc_config;
-		dev->get_stats = 		&awc_get_stats;
-	//	dev->set_multicast_list = 	&awc_set_multicast_list;	
-		dev->change_mtu		=	awc_change_mtu;	
-		dev->init = &awc_init;
-		dev->open = &awc_open;
-		dev->stop = &awc_close;
-	    	dev->base_addr = isa_ioaddr;
-	    	dev->irq = isa_irq_line;
-		dev->tx_timeout = &awc_tx_timeout;
-		dev->watchdog_timeo = AWC_TX_TIMEOUT;
-		
-		netif_start_queue (dev);
-		
-		request_irq(dev->irq,awc_interrupt , SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev);
-
-		awc_private_init( dev);
-
-		((struct awc_private *)dev->priv)->bus =  logdev;
-
-		cli();
-		if ( awc_init(dev) ){
-			printk("card not found at irq %x io %lx\n",dev->irq, dev->base_addr);
-			if (card==0){
-				sti();
-				return -1;
-			}
-			sti();
-			break;
-		}
-		udelay(10);
-		sti();
-		i=0;
-		while (aironet4500_devices[i] && i < MAX_AWCS-1) i++;
-		if (!aironet4500_devices[i] && i < MAX_AWCS-1 ){
-			aironet4500_devices[i]=dev;
-
-		((struct awc_private *)
-		aironet4500_devices[i]->priv)->card_type = AIRONET4500_PNP;
-
-			if (awc_proc_set_fun)
-				awc_proc_set_fun(i);	
-		} else { 
-			printk(KERN_CRIT "Out of resources (MAX_AWCS) \n");
-			return -1;
-		}
-
-		card++;	
-	}
-
-	if (card == 0) return -ENODEV;
-	return 0;
-}
-
-#ifdef MODULE
-static void awc_pnp_release(void) {
-
-//	long flags;
-	int i=0;
-	struct isapnp_logdev *logdev;
-
-	DEBUG(0, "awc_detach \n");
-
-	i=0;
-	while ( i < MAX_AWCS) {
-		if (!aironet4500_devices[i])
-		                  {i++;      continue;}
-		if (((struct awc_private *)aironet4500_devices[i]->priv)->card_type != AIRONET4500_PNP)
-		                  {i++;      continue;}
-
-		logdev = ((struct isapnp_logdev *) ((struct awc_private *)aironet4500_devices[i]->priv)->bus);
-
-		if (!logdev ) 
-			printk("awc4500 no pnp logdev in pnp_release\n");
-
-		if (awc_proc_unset_fun)
-			awc_proc_unset_fun(i);
-		pnp_device_detach(logdev);
-
-		release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE);
-//		release_region(isa_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
-//		release_region(isa_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem");
-
-		unregister_netdev(aironet4500_devices[i]);
-		free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
-		kfree(aironet4500_devices[i]->priv);
-		kfree(aironet4500_devices[i]);
-
-		aironet4500_devices[i]=0;
-
-
-		i++;
-	}
-	
-
-} 
-
-static struct isapnp_device_id id_table[] = {
-	{	ISAPNP_ANY_ID, ISAPNP_ANY_ID,
-		ISAPNP_VENDOR('A','W','L'), ISAPNP_DEVICE(1), 0 },
-	{0}
-};
-
-MODULE_DEVICE_TABLE(isapnp, id_table);
-
-#endif //MODULE
-#endif /* CONFIG_AIRONET4500_PNP */
-
-#ifdef  CONFIG_AIRONET4500_ISA 
-
-static int irq[] = {0,0,0,0,0};
-static int io[] = {0,0,0,0,0};
-
-/* 
-	EXPORT_SYMBOL(irq);
-	EXPORT_SYMBOL(io);
-*/
-MODULE_PARM(irq,"i");
-MODULE_PARM_DESC(irq,"Aironet 4x00 ISA non-PNP irqs,required");
-MODULE_PARM(io,"i");
-MODULE_PARM_DESC(io,"Aironet 4x00 ISA non-PNP ioports,required");
-
-
-
-int awc4500_isa_probe(struct net_device *dev)
-{
-//	int cards_found = 0;
-//	static int isa_index;	/* Static, for multiple probe calls. */
-	int isa_irq_line = 0;
-	int isa_ioaddr = 0;
-//	int p;
-	int card = 0;
-	int i=0;
-
-	if (! io[0] || ! irq[0]){
-	
-//		printk("       Both irq and io params must be supplied  for ISA mode !!!\n");
-		return -ENODEV;
-	}
-
-	printk(KERN_WARNING "     Aironet ISA Card in non-PNP(ISA) mode sometimes feels bad on interrupt \n");
-	printk(KERN_WARNING "     Use aironet4500_pnp if any problems(i.e. card malfunctioning). \n");
-	printk(KERN_WARNING "     Note that this isa probe is not friendly... must give exact parameters \n");
-
-	while (irq[card] != 0){
-	
-		isa_ioaddr = io[card];
-		isa_irq_line = irq[card];
-
-		request_region(isa_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr");
-
-		if (!dev) {
-			dev = init_etherdev(NULL, 0);	
-			if (!dev) {
-				release_region(isa_ioaddr, AIRONET4X00_IO_SIZE);
-				return (card == 0) ? -ENOMEM : 0;
-			}
-		}
-		dev->priv = kmalloc(sizeof(struct awc_private),GFP_KERNEL );
-		memset(dev->priv,0,sizeof(struct awc_private));
-		if (!dev->priv) {
-			printk(KERN_CRIT "aironet4x00: could not allocate device private, some unstability may follow\n");
-			return -1;
-		};
-
-	//	ether_setup(dev);
-	
-	//	dev->tx_queue_len = tx_queue_len;
-	
-		dev->hard_start_xmit = 		&awc_start_xmit;
-	//	dev->set_config = 		&awc_config_misiganes,aga mitte awc_config;
-		dev->get_stats = 		&awc_get_stats;
-	//	dev->set_multicast_list = 	&awc_set_multicast_list;	
-		dev->change_mtu		=	awc_change_mtu;	
-		dev->init = &awc_init;
-		dev->open = &awc_open;
-		dev->stop = &awc_close;
-	    	dev->base_addr = isa_ioaddr;
-	    	dev->irq = isa_irq_line;
-		dev->tx_timeout = &awc_tx_timeout;
-		dev->watchdog_timeo = AWC_TX_TIMEOUT;
-		
-		request_irq(dev->irq,awc_interrupt ,SA_INTERRUPT ,"Aironet 4X00",dev);
-
-		awc_private_init( dev);
-		if ( awc_init(dev) ){
-			printk("card not found at irq %x mem %x\n",irq[card],io[card]);
-			if (card==0)
-				return -1;
-			break;
-		}
-
-		i=0;
-		while (aironet4500_devices[i] && i < MAX_AWCS-1) i++;
-		if (!aironet4500_devices[i]){
-			aironet4500_devices[i]=dev;
-		((struct awc_private *)
-		aironet4500_devices[i]->priv)->card_type = AIRONET4500_ISA;
-
-			if (awc_proc_set_fun)
-				awc_proc_set_fun(i);	
-		}
-
-		card++;	
-	}
-	if (card == 0 ) {
-		return -ENODEV;
-	};
-	return 0;
-}
-
-#ifdef MODULE
-static void awc_isa_release(void) {
-
-//	long flags;
-	int i=0;
-
-	DEBUG(0, "awc_detach \n");
-
-	i=0;
-	while ( i < MAX_AWCS) {
-	
-		if (!aironet4500_devices[i])
-		                  {i++;      continue;}
-		if (((struct awc_private *)aironet4500_devices[i]->priv)->card_type != AIRONET4500_ISA)
-		                  {i++;      continue;}
-
-		if (awc_proc_unset_fun)
-			awc_proc_unset_fun(i);
-		release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE);
-//		release_region(isa_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
-//		release_region(isa_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem");
-
-		unregister_netdev(aironet4500_devices[i]);
-		free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
-		kfree(aironet4500_devices[i]->priv);
-		kfree(aironet4500_devices[i]);
-
-		aironet4500_devices[i]=0;
-
-
-		i++;
-	}
-	
-
-} 
-           
-#endif //MODULE   
-
-#endif /* CONFIG_AIRONET4500_ISA */
-
-#ifdef  CONFIG_AIRONET4500_I365 
-
-#define port_range 0x40
-
-int awc_i365_offset_ports[] = {0x3e0,0x3e0,0x3e2,0x3e2};
-int awc_i365_data_ports [] = {0x3e1,0x3e1,0x3e3,0x3e3};
-int awc_i365_irq[]	= {5,5,11,12};
-int awc_i365_io[]	= {0x140,0x100,0x400,0x440};
-int awc_i365_sockets	= 0;
-
-struct i365_socket {
-	int offset_port ;
-	int data_port;
-	int socket;
-	int irq; 
-	int io;
-	int manufacturer;
-	int product;
-};
-	
-inline u8 i365_in (struct i365_socket * s, int offset) { 
-	outb(offset  + (s->socket % 2)* 0x40, s->offset_port);
-	return inb(s->data_port); 
-};
-
-inline void i365_out (struct i365_socket * s, int offset,int data){
-	outb(offset + (s->socket % 2)* 0x40 ,s->offset_port);
-	outb((data & 0xff),s->data_port)	;
-	
-};
-
-void awc_i365_card_release(struct i365_socket * s){
-	
-	i365_out(s, 0x5, 0); 		// clearing ints
-	i365_out(s, 0x6, 0x20); 	// mem 16 bits
-	i365_out(s, 0x7, 0); 		// clear IO
-	i365_out(s, 0x3, 0);		// gen ctrl reset + mem mode
-	i365_out(s, 0x2, 0);		// reset power
-	i365_out(s, 0x2, i365_in(s, 0x2) & 0x7f ); // cardenable off
-	i365_out(s, 0x2, 0);		// remove power
-	
-
-};
-int awc_i365_probe_once(struct i365_socket * s ){
-
-
-	int caps=i365_in(s, 0);
-	int ret;
-	unsigned long jiff;
-//	short rev	= 0x3000;
-	unsigned char cis [0x3e3];
-	unsigned char * mem = phys_to_virt(0xd000);
-	int i;
-	int port ;
-	
-	DEBUG(1," i365 control ID %x \n", caps);
-
-	if (caps & 0xC){
-		return 1;
-	};
-	
-	ret = i365_in(s, 0x1);
-
-	if ((ret & 0xC0) != 0xC0){
-		printk("card in socket %d port %x not in known state, %x \n",
-			s->socket, s->offset_port, ret );
-		return -1;
-	};
-
-	
-	awc_i365_card_release(s);
-
-
-	mdelay(100);
-	
-	i365_out(s, 0x2, 0x10 ); 	// power enable
-	mdelay(200);
-	
-	i365_out(s, 0x2, 0x10 | 0x01 | 0x04 | 0x80);	//power enable
-	
-	mdelay(250);
-	
-	if (!s->irq)
-		s->irq = 11;
-	
-	i365_out(s, 0x3, 0x40 | 0x20 | s->irq);
-	
-	jiff = jiffies;
-	
-	while (jiffies-jiff < HZ ) 
-		if (i365_in(s,0x1) & 0x20)
-			break;
-			
-	if (! (i365_in(s,0x1) & 0x20) ){
-		printk("irq enable timeout on socket %x \n", s->socket);
-		return -1;
-	};
-	
-	i365_out(s,0x10,0xd0);
-	i365_out(s,0x11,0x0);
-	i365_out(s,0x12,0xd0);
-	i365_out(s,0x13,0x0);
-	i365_out(s,0x14,0x30 );
-	i365_out(s,0x15,0x3f | 0x40);		// enab mem reg bit
-	i365_out(s,0x06,0x01);			// enab mem 
-	
-	mdelay(10);
-	
-	cis[0] = 0x45;
-	
-//	memcpy_toio( 0xd3e0, &(cis[0]),0x1);
-
-//	mem[0x3e0] = 0x0;
-//	mem[0] = 0x45;
-
-	mem[0x3e0] = 0x45;
-
-	mdelay(10);
-	
-	memcpy_fromio(cis,0xD000, 0x3e0);
-	
-	for (i = 0; i <= 0x3e2; i++)
-		printk("%02x", mem[i]);
-	for (i = 0; i <= 0x3e2; i++)
-		printk("%c", mem[i]);
-
-	i=0;	
-	while (i < 0x3e0){
-		if (cis[i] == 0xff)
-			break;
-		if (cis[i] != 0x20 ){
-			i = i + 2 + cis[i+1];
-			continue;
-		}else {
-			s->manufacturer = cis[i+2] | (cis[i+3]<<8);
-			s->product	= cis[i+4] | (cis[i+5]<<8);
-			break;
-		};
-		i++;
-	};
-	
-	DEBUG(1,"socket %x manufacturer %x product %x \n",
-		s->socket, s->manufacturer,s->product);
-
-	i365_out(s,0x07, 0x1 | 0x2); 		// enable io 16bit
-	mdelay(1);
-	port = s->io;
-	i365_out(s,0x08, port & 0xff);
-	i365_out(s,0x09, (port & 0xff00)/ 0x100);
-	i365_out(s,0x0A, (port+port_range) & 0xff);
-	i365_out(s,0x0B, ((port+port_range) & 0xff00) /0x100);	
-
-	i365_out(s,0x06, 0x40); 		// enable io window
-
-	mdelay(1);
-
-	i365_out(s,0x3e0,0x45);
-	
-	outw(0x10, s->io);
-
-	jiff = jiffies;
-	while (!(inw(s->io + 0x30) & 0x10)){
-	
-		if (jiffies - jiff > HZ ){
-		
-			printk("timed out waitin for command ack \n");
-			break;
-		}
-	};
-
-	
-	outw(0x10, s->io + 0x34);
-	mdelay(10);
-	
-	return 0;
-
-};
-
-
-static int awc_i365_init(struct i365_socket * s) {
-
-	struct net_device * dev;
-	int i;
-
-
-	dev = init_etherdev(0, sizeof(struct awc_private) );
-
-//	dev->tx_queue_len = tx_queue_len;
-	ether_setup(dev);
-
-	dev->hard_start_xmit = 		&awc_start_xmit;
-//	dev->set_config = 		&awc_config_misiganes,aga mitte awc_config;
-	dev->get_stats = 		&awc_get_stats;
-	dev->set_multicast_list = 	&awc_set_multicast_list;
-
-	dev->init = &awc_init;
-	dev->open = &awc_open;
-	dev->stop = &awc_close;
-    	dev->irq = s->irq;
-    	dev->base_addr = s->io;
-	dev->tx_timeout = &awc_tx_timeout;
-	dev->watchdog_timeo = AWC_TX_TIMEOUT;
-
-
-	awc_private_init( dev);
-
-	i=0;
-	while (aironet4500_devices[i] && i < MAX_AWCS-1) i++;
-	if (!aironet4500_devices[i]){
-		aironet4500_devices[i]=dev;
-
-		((struct awc_private *)
-		aironet4500_devices[i]->priv)->card_type = AIRONET4500_365;
-
-		if (awc_proc_set_fun)
-			awc_proc_set_fun(i);
-	}
-
-	if (register_netdev(dev) != 0) {
-		printk(KERN_NOTICE "awc_cs: register_netdev() failed\n");
-		goto failed;
-	}
-
-	return 0;
- 
-  failed:
-  	return -1;
-}
-
-
-static void awc_i365_release(void) {
-
-//	long flags;
-	int i=0;
-
-	DEBUG(0, "awc_detach \n");
-
-	i=0;
-	while ( i < MAX_AWCS) {
-	
-		if (!aironet4500_devices[i])
-		         {i++; continue;}
-
-		if (((struct awc_private *)aironet4500_devices[i]->priv)->card_type != AIRONET4500_365)
-		                  {i++;      continue;}
-
-		if (awc_proc_unset_fun)
-			awc_proc_unset_fun(i);
-
-		unregister_netdev(aironet4500_devices[i]);
-
-		//kfree(aironet4500_devices[i]->priv);
-		kfree(aironet4500_devices[i]);
-
-		aironet4500_devices[i]=0;
-
-
-		i++;
-	}
-	
-
-} 
-
-
-
-
-
-        
-        
-int awc_i365_probe(void) {
-
-	int i = 1;
-	int k = 0;
-	int ret = 0;
-	int found=0;
-	
-	struct i365_socket s;
-	/* Always emit the version, before any failure. */
-
-	if (!awc_i365_sockets) {
-		printk("	awc i82635 4x00: use bitfiel opts awc_i365_sockets=0x3 <- (1|2) to probe sockets 0 and 1\n");
-		return -1;
-	};
-
-	while (k < 4){
-		if (i & awc_i365_sockets){
-
-			s.offset_port 	= awc_i365_offset_ports[k];
-			s.data_port	= awc_i365_data_ports[k];
-			s.socket	= k;
-			s.manufacturer	= 0;
-			s.product	= 0;
-			s.irq		= awc_i365_irq[k];
-			s.io		= awc_i365_io[k];
-			
-			ret = awc_i365_probe_once(&s);
-			if (!ret){
-				if (awc_i365_init(&s))
-					goto failed;
-				else found++;
-			} else if (ret == -1)
-				goto failed;
-		};
-		k++;
-		i *=2;
-	};
-
-	if (!found){
-		printk("no aironet 4x00 cards found\n");
-		return -1;
-	}
-	return 0;
-
-failed: 
-	awc_i365_release();
-	return -1;
-	
-
-}
-
-#endif /* CONFIG_AIRONET4500_I365 */
-
-#ifdef MODULE        
-int init_module(void)
-{
-	int found = 0;
-
-	printk("%s\n ", awc_version);
-		
-#ifdef CONFIG_AIRONET4500_PCI
-	if (awc4500_pci_probe(NULL) == -ENODEV){
-//		printk("PCI 4X00 aironet cards not found\n");
-	} else {
-		found++;
-//		printk("PCI 4X00 found some cards \n");
-	}
-#endif
-#ifdef CONFIG_AIRONET4500_PNP
-	if (awc4500_pnp_probe(NULL) == -ENODEV){
-//		printk("PNP 4X00 aironet cards not found\n");
-	} else {
-		found++;
-//		printk("PNP 4X00 found some cards \n");
-	}
-#endif
-#ifdef CONFIG_AIRONET4500_365
-	if ( awc_i365_probe() == -1) {
-//		printk("PCMCIA 4X00 aironet cards not found for i365(without card services) initialization\n");
-	} else {
-		 found++ ;
-//		 printk("PCMCIA 4X00 found some cards, take care, this code is not supposed to work yet \n");
-	}
-#endif
-#ifdef CONFIG_AIRONET4500_ISA
-	if (awc4500_isa_probe(NULL) == -ENODEV){
-//		printk("ISA 4X00 aironet ISA-bus non-PNP-mode cards not found\n");
-	} else {
-		found++;
-//		printk("ISA 4X00 found some cards \n");
-	}
-#endif
-	if (!found) {
-		printk(KERN_ERR "No Aironet 4X00 cards were found. Note that for ISA \n cards you should use either automatic PNP mode or \n ISA mode with both io and irq param \n Aironet is also afraid of: being second PNP controller(by slot), having anything(brandname bios weirdnesses) in range 0x100-0x180 and maybe around  0xd0000\n If you PNP type card does not get found, try non-PNP switch before complainig. \n");
-		return -1;
-	}
-	return 0;
-	
-
-}
-
-void cleanup_module(void)
-{
-	DEBUG(0, "awc_cs: unloading %c ",'\n');
-#ifdef CONFIG_AIRONET4500_PCI	
-	awc_pci_release();
-#endif
-#ifdef CONFIG_AIRONET4500_PNP
-	awc_pnp_release();
-#endif
-#ifdef CONFIG_AIRONET4500_365
-	awc_i365_release();
-#endif
-#ifdef CONFIG_AIRONET4500_ISA
-	awc_isa_release();
-#endif
-
-}
-#endif
diff -Nru a/drivers/net/aironet4500_core.c b/drivers/net/aironet4500_core.c
--- a/drivers/net/aironet4500_core.c	Sun Feb 23 22:25:21 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,3234 +0,0 @@
-/*
- *	 Aironet 4500/4800 driver core
- *
- *		Elmer Joandi, Januar 1999
- *		Copyright: 	GPL
- *	
- *
- *	Revision 0.1 ,started  30.12.1998
- *
- *
- */
- /* CHANGELOG:
- 	march 99, stable version 2.0
- 	august 99, stable version 2.2
- 	november 99, integration with 2.3
-	17.12.99: finally, got SMP near-correct. 
-		timing issues remain- on SMP box its 15% slower on tcp	
-	10.03.00 looks like softnet take us back to normal on SMP
- */
-
-#include <linux/delay.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/workqueue.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/if_arp.h>
-#include <linux/ioport.h>
-#include <linux/ip.h>
-#include <linux/time.h>
-
-#include <asm/io.h>
-#include <asm/bitops.h>
-#include <asm/system.h>
-#include <asm/byteorder.h>
-#include <asm/irq.h>
-
-#include "aironet4500.h"
-
-
-int bap_sleep = 10 ;
-int bap_sleep_after_setup = 1;
-int sleep_before_command  = 1;
-int bap_sleep_before_write= 1;
-int sleep_in_command	  = 1;
-int both_bap_lock;		/* activated at awc_init in this */
-int bap_setup_spinlock;		/* file if numcpu >1 */
-
-EXPORT_SYMBOL(bap_sleep);
-EXPORT_SYMBOL(bap_sleep_after_setup);
-EXPORT_SYMBOL(sleep_before_command);
-EXPORT_SYMBOL(bap_sleep_before_write);
-EXPORT_SYMBOL(sleep_in_command);
-EXPORT_SYMBOL(both_bap_lock);
-EXPORT_SYMBOL(bap_setup_spinlock);
-
-struct awc_strings awc_status_error_codes[]=awc_reply_error_strings;
-struct awc_strings awc_command_names[]=awc_command_name_strings;
-struct awc_strings awc_link_status_names[]=awc_link_status_strings;
-struct awc_strings awc_rid_names[]=aironet4500_RID_Select_strings;
-struct awc_strings awc_link_failure_reason_names[]=IEEE_802_11_LINK_STATUS_FAILURE_REASON_STRINGS;
-
-const char *  awc_print_string( struct awc_strings* strings, int code){
-	
-	struct awc_strings * str = strings;
-	int i = 0;
-	while (str[i].string != NULL){
-		if (str[i].par == (code & str[i].mask )){
-			return str[i].string;
-		};
-		i++;
-	};
-	return "UNKNOWN";
-};
-
-int awc_dump_registers(struct net_device * dev){
-
-#ifdef AWC_DEBUG
-	int i;
-#endif
-	int status= inw(dev->base_addr +4*2);	
-	int r1= inw(dev->base_addr +5*2);	
-	int r2= inw(dev->base_addr +6*2);	
-	int r3= inw(dev->base_addr +7*2);	
-
-	printk(KERN_ERR "Command %s , result: %s, at memblk %x(RID %s) , offset %x \n",
-		awc_print_string(awc_command_names,status), 
-		awc_print_string(awc_status_error_codes,r1),
-		r2, awc_print_string(awc_rid_names,r2),
-		r3);
-
-#ifdef AWC_DEBUG
-	printk(KERN_ERR "%s aironet register dump ",dev->name );
-  
-	                        
-	for (i=0; i < 32; i++){
-		printk("%4x ", inw(dev->base_addr + i*2 ) );
-		if ( (i+1)%8 == 0){
-			printk("\n");
-			printk(KERN_ERR "%02x",(i+1)*2);
-		}
-	};
-	printk(KERN_ERR " \n");
-#endif
-	return 0;                       
-};
-          
-/******************************		COMMAND 	******************/
-
-
-inline 
-int	awc_command_busy_clear_wait(struct net_device * dev){
-//	long long jiff = jiffies;
-        u16  active_interrupts;
-        int  cnt= 0;
-        
-  	AWC_ENTRY_EXIT_DEBUG(" entry awc_command_busy_clear_wait ");
-  		     
-	while (awc_command_busy(dev->base_addr)){
-		if (cnt > 1000 ){
-			printk(KERN_ERR "awc command busy too long, clearing\n");
-			awc_dump_registers(dev);
-			awc_event_ack_ClrStckCmdBsy(dev->base_addr);
-			break;
-		};
-		if (((struct awc_private*) dev->priv)->ejected)
-			return -1;
-		cnt++;
-		udelay(10);
-	}
-	
-	cnt = 0;
-	while (awc_command_busy(dev->base_addr)){
-		//if (jiffies - jiff > (HZ/3)){
-		if (cnt > 30000 ){
-			printk(KERN_CRIT "awc command busy WAY too long, clearing\n");
-			awc_dump_registers(dev);
-			awc_event_ack_ClrStckCmdBsy(dev->base_addr);
- 			active_interrupts = awc_event_status(dev->base_addr);
-			awc_event_ack(dev->base_addr, active_interrupts);
-			                                
-			AWC_ENTRY_EXIT_DEBUG("BAD exit\n ");
-			return -1 ;
-			
-		};
-		if (((struct awc_private*) dev->priv)->ejected)
-			return -1;
-		cnt++;
-		udelay(10);
-	}
-
-	
-	AWC_ENTRY_EXIT_DEBUG(" exit\n ");
-	     
-	return 0;
-	  
-
-};
-
-
-
-inline unsigned short 
-awc_issue_command_and_block(struct awc_command * cmd){
-
-	int ticks;               
-     long long jiff;
-     u16	enabled_interrupts;
-     int cnt = 0;
-//     unsigned long flags;
-     
-     jiff = jiffies; 
-          
-
-  AWC_ENTRY_EXIT_DEBUG(" entry awc_issue_command_and_block ");
-               
-     AWC_LOCK_COMMAND_ISSUING(cmd->priv);
-
-     if (awc_command_busy_clear_wait(cmd->dev)) 		goto final;
-
-     if (cmd->priv->sleeping_bap) udelay(sleep_before_command);               	
-
-     awc4500wout(cmd->port,cmd->command,cmd->par0,cmd->par1,cmd->par2);
-//     awc_dump_registers(cmd->dev);
-
-
-     if (cmd->priv->sleeping_bap) udelay(sleep_in_command);
-     
-     enabled_interrupts = awc_ints_enabled(cmd->dev->base_addr);
-     awc_ints_enable(cmd->dev->base_addr, enabled_interrupts & ~0x10);
-      if(cmd->priv->enabled_interrupts & 0x10)
-      	cmd->priv->enabled_interrupts &= ~0x10;
-
-	
-     while ( awc_command_read(cmd->port) == cmd->command) {
-       	  udelay(1);
-          awc_command_write(cmd->port, cmd->command);
-          //if ((jiffies - jiff) > 2){
-	  if (cnt > 2000 ){
-          	printk(" long wait with commmand reg busy in blocking command \n");
-          	awc_dump_registers(cmd->dev);
-         	goto final;
-          };
-          if (cmd->priv->ejected)
-		goto final;
-	  cnt++;
-  	  udelay(10);
-
-     };
-     AWC_ENTRY_EXIT_DEBUG(" issued " ); 
-
-     ticks = 0;
-     while ( awc_event_status_Cmd(cmd->port) == 0) {
-	  ticks++;
-          if (ticks > 100000){
-		printk(" long wait with commmand reg busy \n");
-          	awc_dump_registers(cmd->dev);
-          		goto final;
-          };
-	  if (ticks > 500){
-	       DEBUG(1, " long wait after issue 10mks * %d ", ticks ); 
-         	//printk(" long wait with command reg busy about ticks\n");
-	  	// sti();
-          }
-          if (cmd->priv->ejected)
-		goto final;
-	  udelay(10);
-     }            
-     if (cmd->priv->sleeping_bap) udelay(sleep_in_command);     
-
-     awc_read_response(cmd);
-     AWC_ENTRY_EXIT_DEBUG(" resp read \n"); 
-
-     if (awc_command_busy(cmd->port)) 
-     	awc_event_ack_ClrStckCmdBsy(cmd->port);
-
-     awc_event_ack_Cmd(cmd->port);
-    if (cmd->priv->sleeping_bap) udelay(sleep_in_command);     
- 
-     if (cmd->status & 0xff00){
-     	printk(KERN_ERR " bad response to command %s, parameter %x \n",awc_print_string(awc_command_names, cmd->command),cmd->par0);
-     	awc_dump_registers(cmd->dev);
-  	goto final;   	 
-     }	
-
-     AWC_UNLOCK_COMMAND_ISSUING(cmd->priv);
-     AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
-    udelay(1);
-     return 0;
-final: 
-     AWC_UNLOCK_COMMAND_ISSUING(cmd->priv);
-     AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-     return -1; ;
-};
-
-
-inline 
-unsigned short 
-awc_issue_command(struct awc_command * cmd){
-
-
-//     long long jiff = jiffies;          
-//     unsigned short enabled_ints;               
-     int cnt = 0;
-//	int i=0; 
- 
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_issue_command");
-     
-     if (!cmd){
-     	printk(KERN_CRIT "cmd == NULL in awc_issue_command\n");
-     	return -1;
-     
-     }
-     if (!cmd->dev){
-     	printk(KERN_CRIT "cmd->dev == NULL in awc_issue_command\n");
-     	return -1;
-     
-     }
-
-     AWC_LOCK_COMMAND_ISSUING(cmd->priv);	
-
-     if(awc_command_busy_clear_wait(cmd->dev))		goto final;               	
-
-      if(!cmd->priv->enabled_interrupts & 0x10){
-      	cmd->priv->enabled_interrupts |= 0x10;
-     	awc_ints_enable(cmd->port, cmd->priv->enabled_interrupts );
-      }
-
-     cmd->priv->async_command_start = jiffies;
-     cmd->priv->command_semaphore_on++;
-
-
-     awc4500wout(cmd->port,cmd->command,cmd->par0,cmd->par1,cmd->par2);
-     
-     while ( awc_command_read(cmd->port) == cmd->command) {
-       
-          awc_command_write(cmd->port, cmd->command);
-          //if ((jiffies - jiff) > 2){
-          if (cnt > 2000) {  
-		printk(" long wait with commmand reg busy in async command \n");
-          	awc_dump_registers(cmd->dev);
-         	goto final;
-          };
-          if (cmd->priv->ejected)
-		goto final;
-	   cnt++;
-	  udelay(10);
-     };
-     
-     cmd->priv->cmd = *cmd;
-     
-     
-     AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
-     return 0;
- final:
-     AWC_UNLOCK_COMMAND_ISSUING(cmd->priv);
-     AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	   return -1; ;
-
-};
-
-inline 
-unsigned short 
-awc_issue_command_no_ack(struct net_device * dev,
-			u16 com, u16 par1, u16 par2, u16 par3){
-
-     struct awc_private * priv = (struct awc_private *)dev->priv;
-     int cnt = 0;
-     long long jiff;
-     jiff = jiffies;          
-
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_issue_command_no_ack ");
-     
-               
-     AWC_LOCK_COMMAND_ISSUING(priv);	
-
-     if (awc_command_busy_clear_wait(dev)) {
-		printk("aironet4x00 no_ack command (reset) with stuck card \n");
-     }
-
-     awc4500wout(dev->base_addr,com, par1, par2,par3);
-
-     udelay(10);     
-     while ( awc_event_status_Cmd(dev->base_addr) == 0) {
-          if (awc_command_read(dev->base_addr) == com) {                
-               awc_command_write(dev->base_addr, com);
-          }
-          //if ((jiffies - jiff) > 2){
-          if (cnt > 2000) {  
-		printk(" long wait with commmand reg busy in noack command %d par %d %d %d\n",com,par1,par2,par3);
-          	awc_dump_registers(dev);
-          		goto final;
-          };
-          if (priv->ejected)
-		goto final;
-	  udelay(10);
-	  cnt++;
-     }            
-     
-     if (awc_command_busy(dev->base_addr)) 
-     	awc_event_ack_ClrStckCmdBsy(dev->base_addr);
-
-     AWC_UNLOCK_COMMAND_ISSUING(priv);
-     AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
- return 0;
-final: 
-     AWC_UNLOCK_COMMAND_ISSUING(priv);
-     AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	   return -1; ;
-};
-
-
-/******************************** 	BAP	*************************/
-
-// inline // too long for inline
-int awc_bap_setup(struct awc_command * cmd) {
-
-	int status;
-	long long jiff;
-	unsigned long flags;	
-	int cleared = 0;
-	int cycles = 0;
-	
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_bap_setup ");
-     	
-     if ( cmd->priv->sleeping_bap)
-	udelay(bap_sleep);
-	
-	if (cmd->priv->ejected)
-		return -1;
-          
-     if (!cmd->bap || !(cmd->lock_state & (AWC_BAP_SEMALOCKED |AWC_BAP_LOCKED)))
-     	DEBUG(1,"no bap or bap not locked cmd %d !!", cmd->command);
-
-	if (bap_setup_spinlock)
-		spin_lock_irqsave(&cmd->priv->bap_setup_spinlock,cmd->priv->bap_setup_spinlock_flags);	  
-	  status = AWC_IN(cmd->bap->offset);
-	  
-	  if (status & ~0x2000 ){
-	  	WAIT61x3;
-	  	status = AWC_IN(cmd->bap->offset);
-	  }
-
-	  if (status & ~0x2000 ){
-                WAIT61x3;
-	        AWC_IN(cmd->dev->base_addr + 0x26);
-                AWC_OUT(cmd->dev->base_addr + 0x26, 0);    
-	  	WAIT61x3;
-	  	udelay(60);
-	  	#ifdef AWC_DEBUG
-	  		printk("b");
-	  	#endif
-	  	status = AWC_IN(cmd->bap->offset);
-	  }
-
-	  
-	  if (status & 0xC000){
-	  	printk(KERN_ERR "bap entered with err or busy bit set %x \n",status);
-		if (cmd->bap->lock != 1) 
-			printk(KERN_ERR "bap lock bad same time %x\n",cmd->bap->lock);
-	  	awc_dump_registers(cmd->dev);
-	  	//	AWC_OUT(cmd->bap->offset, 0x800);
-	  }
-
-	  save_flags(flags);
-	  cli();
-	    
-          AWC_OUT(cmd->bap->select, cmd->rid);
-	  WAIT61x3;
-          AWC_OUT(cmd->bap->offset, cmd->offset);
- 
-          restore_flags(flags);
-
-	  WAIT61x3;          
-          
-          jiff = jiffies;
-
-          while (1) {
-              cycles++;
-              status = AWC_IN(cmd->bap->offset);
-              if ( cmd->priv->sleeping_bap)
-              		udelay(bap_sleep);
-              if (cmd->priv->ejected)
-			goto ejected_unlock;
-	      udelay(1);
-	      if (cycles > 10000) {
-			printk(KERN_CRIT "deadlock in bap\n");
-			goto return_AWC_ERROR;
-	      };
-              status = AWC_IN(cmd->bap->offset);
-              if (status & AWC_BAP_BUSY) {
-                 if (cycles % 100 == 99 ) {
-                      save_flags(flags);
-                      cli();
-                      if (!cleared){
-                      	AWC_IN(cmd->dev->base_addr + 0x26);
-                      	AWC_OUT(cmd->dev->base_addr + 0x26, 0);
-                      	WAIT61x3;
-                      	cleared = 1;
-                      }  
-                      AWC_OUT(cmd->bap->select, cmd->rid);
-                      WAIT61x3;
-                      AWC_OUT(cmd->bap->offset, cmd->offset);
-                      restore_flags(flags);
-                	#ifdef AWC_DEBUG
-	  			printk("B");
-	  		#endif      
-                      
-                      if ( cmd->priv->sleeping_bap)
-         		udelay(bap_sleep);
-         	      else udelay(30);
-                      //restart_timeout();
-                  }
-                  if (jiffies - jiff > 1 ) {
-                  	AWC_ENTRY_EXIT_DEBUG(" BAD BUSY  exit \n");
-                  	awc_dump_registers(cmd->dev);
-                  	goto return_AWC_ERROR;
-                  }
-                  continue;
-              }
-             if (status & AWC_BAP_DONE) {
-                  WAIT61x3; WAIT61x3; WAIT61x3;
-                  
-                //  if ((status & 0xfff) != cmd->offset)
-                //  	printk(KERN_ERR "awcPBD %x ",status);
-                   AWC_ENTRY_EXIT_DEBUG(" exit \n");
-                  if (cmd->priv->sleeping_bap)
-                  	udelay(bap_sleep_after_setup); 
-                   
-                  // success
-                  goto return_AWC_SUCCESS;
-              }
-
-              if (status & AWC_BAP_ERR) {
-             	  AWC_ENTRY_EXIT_DEBUG(" BAD  exit \n");
-                  // invalid rid or offset
-                  printk(KERN_ERR "bap setup error bit set for rid %x offset %x \n",cmd->rid,cmd->offset);
-                  awc_dump_registers(cmd->dev);
-                  goto return_AWC_ERROR;
-              }
-              if ( cmd->priv->sleeping_bap)
-         		udelay(bap_sleep);
-              else udelay(1);
-              // -- awc missed it, try again
-         
-              save_flags(flags);
-              cli();
-              AWC_OUT(cmd->bap->select, cmd->rid);
-              WAIT61x3;
-              AWC_OUT(cmd->bap->offset, cmd->offset);
-              WAIT61x3;
-              restore_flags(flags);
-		
-	      if (jiffies - jiff > HZ)
-	      if (! (status &(AWC_BAP_ERR |AWC_BAP_DONE |AWC_BAP_BUSY))){
-		printk("aironet4500: bap setup lock without any status bits set");
-		awc_dump_registers(cmd->dev);
-                goto return_AWC_ERROR;
-
-	      };
-         
-          }
-
-     AWC_ENTRY_EXIT_DEBUG(" WE MUST NOT BE HERE exit \n");
-
-ejected_unlock:
-     if (bap_setup_spinlock)
-	spin_unlock_irqrestore(&cmd->priv->bap_setup_spinlock,cmd->priv->bap_setup_spinlock_flags);	  
-     AWC_ENTRY_EXIT_DEBUG(" ejected_unlock_exit \n");	
-     return -1;
-
-return_AWC_ERROR:
-     if (bap_setup_spinlock)
-	spin_unlock_irqrestore(&cmd->priv->bap_setup_spinlock,cmd->priv->bap_setup_spinlock_flags);	  
-     AWC_ENTRY_EXIT_DEBUG(" AWC_ERROR_exit \n");
-     return AWC_ERROR;          
-
-return_AWC_SUCCESS:
-     if (bap_setup_spinlock)
-	spin_unlock_irqrestore(&cmd->priv->bap_setup_spinlock,cmd->priv->bap_setup_spinlock_flags);	  
-     AWC_ENTRY_EXIT_DEBUG(" exit \n");
-     return AWC_SUCCESS;          
-}
-
-
-	// requires call to awc_bap_setup() first
-inline 
-int
-awc_bap_read(struct awc_command * cmd) {
-	register u16 len;
-	register u16 * buff = (u16 *) cmd->buff;
-	register u16 port= cmd->bap->data;
-
-
-        AWC_ENTRY_EXIT_DEBUG(" entry awc_bap_read ");
-     	if (!cmd->bap && !(cmd->lock_state & (AWC_BAP_SEMALOCKED |AWC_BAP_LOCKED)))
-     		DEBUG(0,"no bap or bap not locked %d !!", cmd->command);
-        cmd->len = (cmd->len + 1) & (~1);               // round up to even value
-        len = cmd->len / 2;
-	if (cmd->priv->ejected)
-			return -1;
-
-
-	if (cmd->priv->sleeping_bap)
-		udelay(bap_sleep_before_write);
-		
-        if (!cmd->priv->sleeping_bap)
-        	while ( len-- > 0) 
-			*buff++ = AWC_IN(port);
-	else 
-		while ( len-- > 0){
-	                *buff++ = AWC_IN(port);
-	        }
-	AWC_ENTRY_EXIT_DEBUG(" exit  \n");
-  	if (cmd->priv->ejected)
-			return -1;
-        	
-        return AWC_SUCCESS;
-}
-
-      // requires call to awc_bap_setup() first
-inline 
-int
-awc_bap_write(struct awc_command * cmd){
-          register u16 len;
-          register u16 * buff = (u16 *) cmd->buff;
-          register u16 port= cmd->bap->data;
-          
-           
-      AWC_ENTRY_EXIT_DEBUG(" entry awc_bap_write ");
-      if (!cmd->bap && !(cmd->lock_state & (AWC_BAP_SEMALOCKED |AWC_BAP_LOCKED)))
-     		DEBUG(0,"no bap or bap not locked %d !!", cmd->command);
-     
-          cmd->len = (cmd->len + 1) & (~1);               // round up to even value
-          len = cmd->len / 2;
-
-	  if (cmd->priv->ejected)
-			return -1;
-
-	  if (cmd->priv->sleeping_bap)
-		udelay(bap_sleep_before_write);
-
-
-          if (!cmd->priv->sleeping_bap)
-          	while (len-- > 0) 
-              		AWC_OUT(port, *buff++);
-          else
-          	while ( len-- > 0){
-          		AWC_OUT(port, *buff++);
-          	}
-	  if (cmd->priv->ejected)
-			return -1;
-
-
-      AWC_ENTRY_EXIT_DEBUG(" exit  \n");
-              	
-          return AWC_SUCCESS;
-}
-
-
-
-
-/***************************** 	RID READ/WRITE	********************/
-
-const struct aironet4500_rid_selector  aironet4500_RID_Select_General_Config	=(const struct aironet4500_rid_selector){ 0xFF10, 1,0,0, "General Configuration" }; //        See notes General Configuration        Many configuration items.
-const struct aironet4500_rid_selector  aironet4500_RID_Select_SSID_list		=(const struct aironet4500_rid_selector){ 0xFF11, 1,0,0, "Valid SSID list" }; //          See notes Valid SSID list              List of SSIDs which the station may associate to.
-const struct aironet4500_rid_selector  aironet4500_RID_Select_AP_list		=(const struct aironet4500_rid_selector){ 0xFF12, 1,0,0, "Valid AP list" }; //          See notes Valid AP list                List of APs which the station may associate to.
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Driver_name	=(const struct aironet4500_rid_selector){ 0xFF13, 1,0,0, "Driver name" }; //          See notes Driver name                  The name and version of the driver (for debugging)
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Encapsulation	=(const struct aironet4500_rid_selector){ 0xFF14, 1,0,0, "Ethernet Protocol" }; //          See notes Ethernet Protocol            Rules for encapsulating ethernet payloads onto 802.11.
-const struct aironet4500_rid_selector  aironet4500_RID_Select_WEP_volatile	=(const struct aironet4500_rid_selector){ 0xFF15, 1,0,0, "WEP key volatile" }; //          
-const struct aironet4500_rid_selector  aironet4500_RID_Select_WEP_nonvolatile	=(const struct aironet4500_rid_selector){ 0xFF16, 1,0,0, "WEP key non-volatile" }; //
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Modulation	=(const struct aironet4500_rid_selector){ 0xFF17, 1,0,0, "Modulation" }; //
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Active_Config	=(const struct aironet4500_rid_selector){ 0xFF20, 0,1,1, "Actual Configuration" }; //          Read only      Actual Configuration    This has the same format as the General Configuration.
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Capabilities	=(const struct aironet4500_rid_selector){ 0xFF00, 0,1,0, "Capabilities" }; //          Read Only      Capabilities            PC4500 Information
-const struct aironet4500_rid_selector  aironet4500_RID_Select_AP_Info		=(const struct aironet4500_rid_selector){ 0xFF01, 0,1,1, "AP Info" }; //          Read Only      AP Info                 Access Point Information
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Radio_Info	=(const struct aironet4500_rid_selector){ 0xFF02, 0,1,1, "Radio Info" }; //          Read Only      Radio Info              Radio Information -- note radio specific
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Status		=(const struct aironet4500_rid_selector){ 0xFF50, 0,1,1, "Status" }; //          Read Only      Status                  PC4500 Current Status Information
-const struct aironet4500_rid_selector  aironet4500_RID_Select_16_stats		=(const struct aironet4500_rid_selector){ 0xFF60, 0,1,1, "Cumulative 16-bit Statistics" }; //          Read Only      16-bit Statistics       Cumulative 16-bit Statistics
-const struct aironet4500_rid_selector  aironet4500_RID_Select_16_stats_delta	=(const struct aironet4500_rid_selector){ 0xFF61, 0,1,1, "Delta 16-bit Statistics" }; //          Read Only      16-bit Statistics       Delta 16-bit Statistics (since last clear)
-const struct aironet4500_rid_selector  aironet4500_RID_Select_16_stats_clear	=(const struct aironet4500_rid_selector){ 0xFF62, 0,1,1, "Delta 16-bit Statistics and Clear" }; //          Read Only /    16-bit Statistics       Delta 16-bit Statistics and Clear
-const struct aironet4500_rid_selector  aironet4500_RID_Select_32_stats      	=(const struct aironet4500_rid_selector){ 0xFF68, 0,1,1, "Cumulative 32-bit Statistics" }; //          Read Only      32-bit Statistics       Cumulative 32-bit Statistics
-const struct aironet4500_rid_selector  aironet4500_RID_Select_32_stats_delta	=(const struct aironet4500_rid_selector){ 0xFF69, 0,1,1, "Delta 32-bit Statistics"  }; //          Read Only      32-bit Statistics       Delta 32-bit Statistics (since last clear)
-const struct aironet4500_rid_selector  aironet4500_RID_Select_32_stats_clear	=(const struct aironet4500_rid_selector){ 0xFF6A, 0,1,1, "Delta 32-bit Statistics and Clear" }; //          Read Only /    32-bit Statistics       Delta 32-bit Statistics and Clear
-
-EXPORT_SYMBOL(aironet4500_RID_Select_General_Config); 
-EXPORT_SYMBOL(aironet4500_RID_Select_SSID_list); 
-EXPORT_SYMBOL(aironet4500_RID_Select_AP_list); 
-EXPORT_SYMBOL(aironet4500_RID_Select_Driver_name); 
-EXPORT_SYMBOL(aironet4500_RID_Select_Encapsulation); 
-EXPORT_SYMBOL(aironet4500_RID_Select_WEP_volatile); 
-EXPORT_SYMBOL(aironet4500_RID_Select_WEP_nonvolatile); 
-EXPORT_SYMBOL(aironet4500_RID_Select_Modulation); 
-EXPORT_SYMBOL(aironet4500_RID_Select_Active_Config); 
-EXPORT_SYMBOL(aironet4500_RID_Select_Capabilities); 
-EXPORT_SYMBOL(aironet4500_RID_Select_AP_Info); 
-EXPORT_SYMBOL(aironet4500_RID_Select_Radio_Info); 
-EXPORT_SYMBOL(aironet4500_RID_Select_Status); 
-EXPORT_SYMBOL(aironet4500_RID_Select_16_stats); 
-EXPORT_SYMBOL(aironet4500_RID_Select_16_stats_delta); 
-EXPORT_SYMBOL(aironet4500_RID_Select_16_stats_clear); 
-EXPORT_SYMBOL(aironet4500_RID_Select_32_stats); 
-EXPORT_SYMBOL(aironet4500_RID_Select_32_stats_delta); 
-EXPORT_SYMBOL(aironet4500_RID_Select_32_stats_clear); 
-
-
-struct awc_rid_dir awc_rids_temp[]={
-	// following MUST be consistent with awc_rids_setup !!!
-   {&aironet4500_RID_Select_General_Config,		0x100 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_SSID_list, 			 0x68 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_AP_list, 			 0x20 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_Driver_name, 		 0x12 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_Encapsulation, 		 0x22 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_Active_Config, 		0x100 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_Capabilities, 		 0x80 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_Status, 			 0x6c , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_AP_Info, 			 0x06 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_32_stats, 			0x184 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_32_stats_delta, 		0x184 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_32_stats_clear, 		0x184 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_WEP_volatile,  		0x1c , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_WEP_nonvolatile,		0x1c , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_Modulation, 		0x04 , NULL, NULL, NULL,0 },
-
-#ifdef AWC_USE_16BIT_STATS
-   {&aironet4500_RID_Select_16_stats, 			0xC2 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_16_stats_delta,		0xC2 , NULL, NULL, NULL,0 },
-   {&aironet4500_RID_Select_16_stats_clear, 		0xC2 , NULL, NULL, NULL,0 },
-#else 
-   {NULL},{NULL},{NULL},
-#endif	
- 
-   {0} 
-
-
-};
-
-
-
-int 
-awc_readrid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf ){
-	  struct awc_command cmd;
-
-	  int sleep_state ;
-
-       AWC_ENTRY_EXIT_DEBUG(" entry awc_readrid ");
-          if (!rid) return -1;
-          if (!rid->selector) return -1;
-          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x21, rid->selector->selector,
-          	rid->selector->selector, rid->offset, (rid->bits / 8),pBuf);
-
-	  sleep_state = cmd.priv->sleeping_bap ;
-	  cmd.priv->sleeping_bap = 1;
-	  udelay(500);
-	  AWC_BAP_LOCK_NOT_CLI(cmd);
-	  if (awc_issue_command_and_block(&cmd))	goto final;
-	  udelay(1);
-          if (awc_bap_setup(&cmd))			goto final;
-          udelay(1);
-          if (awc_bap_read(&cmd))			goto final;
-          cmd.priv->sleeping_bap = sleep_state;
-
-	  AWC_RELEASE_COMMAND(cmd);
-          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
- 	  return 0;
-     final:
-     	  cmd.priv->sleeping_bap = sleep_state;
-     	  AWC_RELEASE_COMMAND(cmd);
-     	  AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	   return -1; ;
-}
-
-int 
-awc_writerid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf){
-
-	  struct awc_command cmd;
-	  int sleep_state ;
-
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_writerid ");
-     
-
-          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x21, rid->selector->selector,
-          	rid->selector->selector,rid->offset, rid->bits/8,pBuf);
-
-	  sleep_state = cmd.priv->sleeping_bap ;
-	  cmd.priv->sleeping_bap = 1;
-
-	  udelay(500);
-	  AWC_BAP_LOCK_NOT_CLI(cmd);	  
-	  if (awc_issue_command_and_block(&cmd))	goto final;
-	  udelay(10);
-          if (awc_bap_setup(&cmd))			goto final;
-          udelay(10);
-          if (awc_bap_write(&cmd))			goto final;
-          udelay(10);	
-          cmd.command=0x121;
-	  if (awc_issue_command_and_block(&cmd))	goto final;
-          cmd.priv->sleeping_bap = sleep_state;
-
-	  AWC_RELEASE_COMMAND(cmd);
-          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
- 	  return 0;
-     final:
-     	  cmd.priv->sleeping_bap = sleep_state;
-     	  AWC_RELEASE_COMMAND(cmd);
-     	  AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	   return -1; ;
-}
-
-int 
-awc_readrid_dir(struct net_device * dev, struct awc_rid_dir * rid ){
-	  struct awc_command cmd;
-	  int sleep_state;
-
-     AWC_ENTRY_EXIT_DEBUG(" entry awcreadrid_dir ");
-     
-
-          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x21, rid->selector->selector,
-          	rid->selector->selector,0, rid->bufflen,rid->buff);
-
-	  sleep_state = cmd.priv->sleeping_bap ;
-	  cmd.priv->sleeping_bap = 1;
-
-	  udelay(500);
-
-	  AWC_BAP_LOCK_NOT_CLI(cmd);
-	  if (awc_issue_command_and_block(&cmd))	goto final;
-	  
-          if (awc_bap_setup(&cmd))			goto final;
-          if (awc_bap_read(&cmd))			goto final;
-          cmd.priv->sleeping_bap = sleep_state;
-
-	  AWC_RELEASE_COMMAND(cmd);
-          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
- 	  return 0;
-     final:
-     	  cmd.priv->sleeping_bap = sleep_state;
-     	  AWC_RELEASE_COMMAND(cmd);
-     	  AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	   return -1; ;
-}
-
-int 
-awc_writerid_dir(struct net_device * dev, struct awc_rid_dir * rid){
-
-	  struct awc_command cmd;
-	  int sleep_state ;
-
-
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_writerid_dir ");
-     
-
-
-          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x21, rid->selector->selector,
-          	rid->selector->selector,0, rid->bufflen,((char *)rid->buff));
-
-	  sleep_state = cmd.priv->sleeping_bap ;
-	  cmd.priv->sleeping_bap = 1;
-
-	  udelay(500);
-
-	  AWC_BAP_LOCK_NOT_CLI(cmd);
-
-	  if (awc_issue_command_and_block(&cmd))	goto final;
-          if (awc_bap_setup(&cmd))			goto final;
-          if (awc_bap_write(&cmd))			goto final;
-          cmd.priv->sleeping_bap = sleep_state;
-	            
-          cmd.command=0x121;
-          udelay(500);
-	  if (awc_issue_command_and_block(&cmd))	goto final;
-
-	  AWC_RELEASE_COMMAND(cmd);
-          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
- 	  return 0;
-     final:
-     	  cmd.priv->sleeping_bap = sleep_state;
-     	  AWC_RELEASE_COMMAND(cmd);
-     	  AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	   return -1; ;
-}
-
-EXPORT_SYMBOL(awc_readrid);
-EXPORT_SYMBOL(awc_writerid);
-EXPORT_SYMBOL(awc_readrid_dir);
-EXPORT_SYMBOL(awc_writerid_dir);
-
-/*****************************		STARTUP		*******************/
-
-
-inline
-int
-awc_issue_blocking_command(struct net_device * dev,u16 comm){
-
-	  struct awc_command cmd;
-//	  struct awc_private * priv = (struct awc_private *)dev->priv;
-
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_issue_blocking_command ");
-     
-          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,comm,0, 0, 0, 0 ,0 );
-
-          AWC_BAP_LOCK_NOT_CLI(cmd);
-
-          if (awc_issue_command_and_block(&cmd))
-          	goto final;
-
-	  AWC_RELEASE_COMMAND(cmd);
-          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
- 	  return 0;
-     final:
-     	  AWC_RELEASE_COMMAND(cmd);
-     	  AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	  return -1; ;
-	  
-};
-
-int 
-awc_issue_soft_reset(struct net_device * dev){
-
-	u16 status ;
-//	int i= 0;
-
-/*	outw(inw(dev->base_addr + 0x30), dev->base_addr + 0x32);
-	udelay(10);
-	outw(inw(dev->base_addr + 0x30), dev->base_addr + 0x34);
-
-	for (i=0; i< 32; i++)
-		outw(0,dev->base_addr + i*2);
-	udelay(100);
-	outw(0x6,dev->base_addr + 0x34);
-	udelay(100);
-	outw(0x6,dev->base_addr + 0x34);
-	outw(0x6,dev->base_addr + 0x34);
-                WAIT61x3;
-	        AWC_IN(dev->base_addr + 0x26);
-                AWC_OUT(dev->base_addr + 0x26, 0);    
-	  	WAIT61x3;
-	  	udelay(60);
-	
-
-	outw(0x4, dev->base_addr);
-	udelay(1000);
-        WAIT61x3;
-        AWC_IN(dev->base_addr + 0x26);
-        AWC_OUT(dev->base_addr + 0x26, 0);    
- 	WAIT61x3;
-	udelay(60);
-*/
-
-	status =  awc_issue_command_no_ack(dev, AWC_COMMAND_SOFT_RESET,0,0,0);
-	
-//	awc_command_busy_clear_wait(dev);
-
-	return status;
-};
-
-int
-awc_issue_noop(struct net_device * dev){
-	int retval;
-	AWC_OUT(dev->base_addr + 0x28, 0);
-	AWC_OUT(dev->base_addr + 0x2A, 0);
-	udelay(1000);
-	retval= awc_issue_blocking_command(dev, AWC_COMMAND_NOOP);
-	udelay(1000);
-	return retval;
-};
-
-EXPORT_SYMBOL(awc_enable_MAC);
-
-int
-awc_enable_MAC(struct net_device * dev){
-        
-   struct awc_private * priv = (struct awc_private *)dev->priv;
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_enable_MAC ");
-            
-        if (priv->mac_enabled){
-        
-        	AWC_ENTRY_EXIT_DEBUG(" mac already enabled exit \n"); 
- 		return 0;
-        }
-        udelay(500);
-	if (awc_issue_blocking_command(dev, AWC_COMMAND_ENABLE)){
-		AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	   return -1; ;
-	}
-        udelay(500);
-
-	priv->mac_enabled = 1;
-     
-	AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
- 	return 0;
-};
-
-EXPORT_SYMBOL(awc_disable_MAC);
-int
-awc_disable_MAC(struct net_device * dev){
-        
-   struct awc_private * priv = (struct awc_private *)dev->priv;
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_disable_MAC ");
-            
-        if (!priv->mac_enabled){
-        	AWC_ENTRY_EXIT_DEBUG(" mac allready disabled exit \n"); 
- 		return 0;
-        }
-        udelay(1000);
-	if (awc_issue_blocking_command(dev, AWC_COMMAND_DISABLE)){
-		AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-		return -1; ;
-	}
-	udelay(1000);
-	priv->mac_enabled = 0;
-        AWC_ENTRY_EXIT_DEBUG(" exit \n");
-	return 0;
-};
-
-
-
-int
-awc_read_all_rids(struct net_device * dev){
-
-	struct awc_private * priv = (struct awc_private *)dev->priv;
-	int status,i;
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_read_all_rids ");
-                                   
-  	for (i=0; i< AWC_NOF_RIDS && priv->rid_dir[i].selector  ; i++){
-  		status = awc_readrid_dir(dev,&priv->rid_dir[i]);
-  		udelay(50);
-  		if (status) return status;
-  		                
-  	}
-  	priv->rids_read = 1;
-  	
-     AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
-     return 0;
-}
-
-int
-awc_write_all_rids(struct net_device * dev){
-
-	struct awc_private * priv = (struct awc_private *)dev->priv;
-  	int i,status ;
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_write_all_rids ");
-                                   
-  	for (i=0;i < 5 &&  i< AWC_NOF_RIDS && priv->rid_dir[i].selector  ; i++){
-  	     status = awc_writerid_dir(dev,&priv->rid_dir[i]);
-  	     udelay(10);
-  	     if(status) return status;
-  	}
-     AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
-     return 0;
-}
-
-/**************************	FID QUEUES ****************************/
-/****************************	TX  ALLOC / DEALLOC 	***************/
-
-
-
-int  awc_tx_alloc(struct net_device * dev) {
-
-	  struct awc_command cmd;
-	  int k=0;
-	  int tot=0;
-	 struct awc_fid * fid = NULL;
-	 
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_tx_alloc ");
-     	  
-
-          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x0A,0, 0,0,0,NULL);
-	  cmd.par0 = dev->mtu + AWC_TX_HEAD_SIZE + 8 ;
-
-	  DEBUG(32,"about to allocate %x bytes ",cmd.priv->large_buff_mem);
-	  DEBUG(32,"in %x large buffers ",cmd.priv->large_buff_mem / (dev->mtu + AWC_TX_HEAD_SIZE + 8) );
-	  	
-	  k=0;tot=0;
-	  AWC_BAP_LOCK_NOT_CLI(cmd);
-
-	  while (k < cmd.priv->large_buff_mem / (dev->mtu + AWC_TX_HEAD_SIZE + 8) ) {
-	  	
-	  	fid = kmalloc(sizeof(struct awc_fid),GFP_KERNEL );
-	  	if (!fid)	goto final;
-		memset(fid, 0, sizeof(struct awc_fid));
-
-		if (awc_issue_command_and_block(&cmd))		goto final;
-		
-          	while ( awc_event_status_Alloc(cmd.port) == 0) ;
-		fid->u.tx.fid 		= awc_Tx_Allocated_Fid(cmd.port);
-		fid->u.tx.fid_size 	= dev->mtu + AWC_TX_HEAD_SIZE ;
-		
-		DEBUG(32,"allocated large tx fid %x ",fid->u.tx.fid);
-		if(fid->u.tx.fid == 0
-		   || cmd.status != 0xA){
-			printk(KERN_ERR "%s bad tx_alloc\n",dev->name);
-			fid->busy =1;
-			goto final;
-		} else {
-			fid->busy =0;
-			tot++;
-		}
-		awc_event_ack_Alloc(cmd.port);
-		
-		// shoudlnt goto final after that
-		awc_fid_queue_push_tail(&cmd.priv->tx_large_ready,fid);
-				
-		k++;
-	  }
-	  cmd.priv->tx_buffs_total = tot;
-	  DEBUG(32,"allocated %d large tx buffs\n",tot);
-
-	  cmd.par0 = AWC_TX_ALLOC_SMALL_SIZE ;
-	  k =0; tot = 0;
-
-	  while (k < cmd.priv->small_buff_no) {
-	  	
-	  	fid = kmalloc(sizeof(struct awc_fid),GFP_KERNEL );
-	  	if (!fid)	goto final;
-		memset(fid, 0, sizeof(struct awc_fid));
-
-	  	cmd.par0 = AWC_TX_ALLOC_SMALL_SIZE ;
-
-		if (awc_issue_command_and_block(&cmd))		goto final;
-		
-          	while ( awc_event_status_Alloc(cmd.port) == 0) ;
-		fid->u.tx.fid 		= awc_Tx_Allocated_Fid(cmd.port);
-		fid->u.tx.fid_size 	= AWC_TX_ALLOC_SMALL_SIZE;
-		
-		DEBUG(32,"allocated large tx fid %x ",fid->u.tx.fid);
-		if(fid->u.tx.fid == 0
-		   || cmd.status != 0xA){
-			printk(KERN_ERR "%s bad tx_alloc\n",dev->name);
-			fid->busy =1;
-			goto final;
-		} else {
-			fid->busy =0;
-			tot++;
-		}
-		awc_event_ack_Alloc(cmd.port);
-		
-		// shoudlnt goto final after that
-		awc_fid_queue_push_tail(&cmd.priv->tx_small_ready,fid);
-				
-		k++;
-	  }
-
-	  cmd.priv->tx_small_buffs_total = tot;
-	  DEBUG(32,"allocated %d small tx buffs\n",tot);
-
-	  AWC_RELEASE_COMMAND(cmd);
-          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
- 	  return 0;
-
-     final:
-     	  if (fid ) 
-     	  	kfree(fid);
-     	  printk(KERN_CRIT "%s awc tx prealloc failed \n",dev->name);
-     	  AWC_RELEASE_COMMAND(cmd);
-     	  AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	  return -1; ;
-
-};
-
-int 
-awc_tx_dealloc_fid(struct net_device * dev,struct awc_fid * fid){
-
-	  struct awc_command cmd;
-	  int fid_handle = 0;
-	  
-          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x0C,0, 0,0,0,NULL);
-
-	  AWC_BAP_LOCK_NOT_CLI(cmd);
-
-	  if (fid->u.tx.fid){
-	  		fid_handle = cmd.par0 = fid->u.tx.fid;
-	  		fid->u.tx.fid = 0;
-			fid->busy =0;
-	  		kfree(fid);
-
-			if (!cmd.priv->ejected)
-				if (awc_issue_command_and_block(&cmd))	goto final;
-						//awc_event_ack_Alloc(cmd.port);
-	  }
-
-	  AWC_RELEASE_COMMAND(cmd);
-          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
- 	  return 0;
-
-     	  final:
-     	  	printk(KERN_ERR "awc_tx_dealloc failed for fid %x \n",fid_handle);
-     	  	AWC_RELEASE_COMMAND(cmd);
-     	  	AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	  return -1; ;
-
-
-};
-
-int
-awc_tx_dealloc(struct net_device * dev){
-
- 	struct awc_private * priv = (struct awc_private *)dev->priv;
-
-
-
-//	  int k=0;
-	  struct awc_fid * fid;
-	  
-          AWC_ENTRY_EXIT_DEBUG(" entry awc_tx_dealloc ");
-     
-	  while (NULL != (fid = awc_fid_queue_pop_head(&priv->tx_large_ready)))
-		awc_tx_dealloc_fid(dev,fid);
-	  while (NULL != (fid = awc_fid_queue_pop_head(&priv->tx_small_ready)))
-		awc_tx_dealloc_fid(dev,fid);
-	  while (NULL != (fid = awc_fid_queue_pop_head(&priv->tx_post_process)))
-		awc_tx_dealloc_fid(dev,fid);
-	  while (NULL != (fid = awc_fid_queue_pop_head(&priv->tx_in_transmit)))
-		awc_tx_dealloc_fid(dev,fid);
-	
-	  return 0;
-
-};
-
-
-
-inline struct awc_fid *
-awc_tx_fid_lookup_and_remove(struct net_device * dev, u16 fid_handle){
-
- 	struct awc_private * priv = (struct awc_private *)dev->priv;
-//	int k = 0;
-	unsigned long flags;
-	struct awc_fid * fid = NULL;
-	int cnt=0;
-	
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_tx_fid_lookup ");
-
-	spin_lock_irqsave(&(priv->queues_lock),flags);
-
-
-	fid = priv->tx_in_transmit.head;
-	cnt = 0;
-	while (fid){
-	  	if (fid->u.tx.fid == fid_handle){
-	  		awc_fid_queue_remove(&priv->tx_in_transmit, fid);
-	  		spin_unlock_irqrestore(&(priv->queues_lock),flags);
-	  		return fid;
-	  	}
-	  	fid = fid->next;
-	//	printk("iT\n");
-		if (cnt++ > 200) {
-	//		printk("bbb in awc_fid_queue\n");
-			spin_unlock_irqrestore(&(priv->queues_lock),flags);
-	  		return 0;
-		};
-	};
-
-	cnt=0;
-	fid = priv->tx_post_process.head;
-	while (fid){
-	  	if (fid->u.tx.fid == fid_handle){
-	  		awc_fid_queue_remove(&priv->tx_post_process, fid);
-	  		spin_unlock_irqrestore(&(priv->queues_lock),flags);
-	  		return fid;
-	  	}
-	  	fid = fid->next;
-	//	printk("pp\n");
-		if (cnt++ > 200) {
-	//		printk("bbb in awc_fid_queue\n");
-			spin_unlock_irqrestore(&(priv->queues_lock),flags);
-	  		return 0;
-		};
-
-	};
-
-	cnt=0;
-	fid = priv->tx_large_ready.head;
-	while (fid){
-	  	if (fid->u.tx.fid == fid_handle){
-	  		awc_fid_queue_remove(&priv->tx_large_ready, fid);
-	  		spin_unlock_irqrestore(&(priv->queues_lock),flags);
-	  		return fid;
-	  	}
-	  	fid = fid->next;
-	//	printk("lr\n");
-		if (cnt++ > 200) {
-	//		printk("bbb in awc_fid_queue\n");
-			spin_unlock_irqrestore(&(priv->queues_lock),flags);
-	  		return 0;
-		};
-
-	};
-	cnt=0;
-	fid = priv->tx_small_ready.head;
-	while (fid){
-	  	if (fid->u.tx.fid == fid_handle){
-	  		awc_fid_queue_remove(&priv->tx_small_ready, fid);
-	  		spin_unlock_irqrestore(&(priv->queues_lock),flags);
-	  		return fid;
-	  	}
-	  	fid = fid->next;
-	//	printk("sr\n");
-		if (cnt++ > 200) {
-	//		printk("bbb in awc_fid_queue\n");
-			spin_unlock_irqrestore(&(priv->queues_lock),flags);
-	  		return 0;
-		};
-
-	};
-
-	spin_unlock_irqrestore(&(priv->queues_lock),flags);
-	
-	printk(KERN_ERR "%s tx fid %x not found \n",dev->name, fid_handle);  
-        AWC_ENTRY_EXIT_DEBUG(" BAD exit \n");   	  
-	return NULL;
-}
-
-
-
-
-
-int 
-awc_queues_init(struct net_device * dev){
- 	struct awc_private * priv = (struct awc_private *)dev->priv;
-	struct awc_fid * fid = NULL;
-	int retv =0;
-	int k = 0;
-
-	awc_fid_queue_init(&priv->tx_in_transmit);
-	awc_fid_queue_init(&priv->tx_post_process);
-	awc_fid_queue_init(&priv->tx_large_ready);
-	awc_fid_queue_init(&priv->tx_small_ready);
-	awc_fid_queue_init(&priv->rx_ready);
-	awc_fid_queue_init(&priv->rx_post_process);
-
-	retv = awc_tx_alloc(dev);
-
-	k = 0;
-	while (k < AWC_RX_BUFFS){
-		fid = kmalloc(sizeof(struct awc_fid),GFP_KERNEL);
-		if (!fid) return -1;
-		awc_fid_queue_push_tail(&priv->rx_ready,fid);
-		k++;
-	};
-
-	if (retv) return retv;
-
-	return 0;	
-};
-
-
-int 
-awc_queues_destroy(struct net_device * dev){
- 	struct awc_private * priv = (struct awc_private *)dev->priv;
-	struct awc_fid * fid = NULL;
-	int retv =0;
-	
-
-
-	while (NULL != (fid = awc_fid_queue_pop_head(&priv->rx_ready))){
-		kfree(fid);
-	}
-	while (NULL != (fid = awc_fid_queue_pop_head(&priv->rx_post_process))){
-		kfree(fid);
-	}
-
-	retv = awc_tx_dealloc(dev);
-
-	return retv;	
-};
-
-
-
-/****************************** 	802.11router	******************/
-inline int 
-awc_802_11_copy_path_skb(struct net_device * dev, struct awc_fid * rx_buff){
-
-	struct awc_private * priv = (struct awc_private * )dev->priv;
-
-	AWC_ENTRY_EXIT_DEBUG("awc_802_11_copy_path_skb");
-
-        if (rx_buff->pkt_len < 22 ) rx_buff->pkt_len = 22;
-        
-//	if (!rx_buff->skb)
-		rx_buff->skb =  dev_alloc_skb(rx_buff->pkt_len + 12 +2);
-	
-	
-	if (rx_buff->skb == NULL) {
-		printk(KERN_CRIT "couldnt alloc rx_buff->skb in rx event \n");
-		priv->stats.rx_dropped++;
-		return -1;
-	}
-	rx_buff->type |= p80211copy_path_skb;
-	
-	rx_buff->skb->dev = dev;
-
-//	skb_reserve(rx_buff->skb, rx_buff->pkt_len + 12 );
-
-	rx_buff->u.rx.payload = skb_put(rx_buff->skb, rx_buff->pkt_len + 12 ) ;
-	rx_buff->u.rx.payload  = ((char *)rx_buff->u.rx.payload ) +12;
-
-	AWC_ENTRY_EXIT_DEBUG("exit\n");
-
-	return 0;
-
-
-};
-
-
-int
-awc_802_11_find_copy_path(struct net_device * dev, struct awc_fid * rx_buff){
-
-//        struct awc_private * priv = (struct awc_private * )dev->priv;
-//        u8 is_802_3 = 0;
-//	int i = 0;
-
-	rx_buff->type =0;
-
-	return awc_802_11_copy_path_skb(dev,rx_buff);
-};
-
-
-/* 	called from INTERRUPT context,
-
-	must deliver the packet to where it was meant by 
-		awc_802_11_find_copy_path
-	
-	SHOULD be efficient and
-	queue the packet if operations take longer
-
-*/ 
-
-
-int parse_not_8023;
-       
-void
-awc_802_11_router_rx(struct net_device * dev,struct awc_fid * rx_buff){
-
-        struct awc_private * priv = (struct awc_private * )dev->priv;
-	struct sk_buff * skb = rx_buff->skb;
-	u8 * payload = rx_buff->u.rx.payload;
-//	u8 * p802_3_macs_place = payload -12;
-	u16    pkt_len = rx_buff->pkt_len;	
-	struct ieee_802_11_802_1H_header * bridge = NULL;
-	struct ieee_802_11_snap_header * snap = NULL;
-	struct ieee_802_11_802_1H_header * bridge_tmp;
-	struct ieee_802_11_snap_header * snap_tmp;
-
-	u16	ptr = 0;
-	u16	len;
-
-	AWC_ENTRY_EXIT_DEBUG("awc_802_11_router_rx");
-
-//	if (rx_buff->type & p80211_8023)
-		rx_buff->mac = rx_buff->u.rx.ieee_802_3.dst_mac;
-//	else	
-//		rx_buff->mac = rx_buff->u.rx.ieee_802_11.mac1;	
-
-	if ( rx_buff->u.rx.ieee_802_11.frame_control == 0x8 )	
-		memcpy(priv->bssid,rx_buff->u.rx.ieee_802_11.mac3,6);
-	
-	while ((ptr < pkt_len - 1 ) && payload && parse_not_8023){
-
-		bridge_tmp 	= (struct ieee_802_11_802_1H_header*) &payload[ptr];
-		snap_tmp 	= (struct ieee_802_11_snap_header*) &payload[ptr];
-		len		= ntohs( *((u16*)&payload[ptr]) );
-
-		
-
-		if (  len < 0x5DC)	{ // not a protocol
-			
-			if ( len != pkt_len-2 - ptr){
-				printk(KERN_ERR "%s bad encapsulation lenght %x at pkt offset %x \n",dev->name,len,ptr);
-				goto bad_packet;
-			}
-			DEBUG(1,"parisng packet of size %x\n",len);
-			ptr +=2;
-			continue;
-		}	
-		
-		DEBUG(1,"parisng packet of proto %x\n",len);
-		
-		if (snap_tmp->dsap == 0xaa &&  snap_tmp->ssap == 0xaa &&
-		    pkt_len - ptr > sizeof(struct ieee_802_11_snap_header) ){
-			
-			DEBUG(0x200,"%s SNAP ",dev->name);
-			if (snap_tmp->ctrl != 0x03){
-				printk(KERN_ERR "%s unknown snap ctrl %x \n",dev->name,snap_tmp->ctrl);
-				goto bad_packet;
-			};
-			if (snap_tmp->oui[0] == 0 && // LLC RFC1042
-			    snap_tmp->oui[1] == 0 &&
-			    snap_tmp->oui[2] == 0 ){
-			    	snap = 	snap_tmp;
-			    	ptr +=	sizeof(struct ieee_802_11_snap_header);
-			    	DEBUG(0x200,"%s LLC RFC1042 \n",dev->name);
-			    	continue;
-			}
-			if (snap_tmp->oui[0] == 0 && // LLC 802.1H
-			    snap_tmp->oui[1] == 0 &&
-			    snap_tmp->oui[2] == 0x78){
-			    	snap = snap_tmp;
-			    	DEBUG(0x200,"%s LLC 802.1H \n",dev->name);
-			    	ptr +=	sizeof(struct ieee_802_11_snap_header);
-			    	continue;  
-			};
-			if (snap_tmp->oui[0] == 0x00 && // 802.1H itself
-			    snap_tmp->oui[1] == 0x40 &&
-			    snap_tmp->oui[2] == 0x96){
-			    	ptr +=	sizeof(struct ieee_802_11_802_1H_header);
-			    	if (ptr >= pkt_len){
-			    		goto bad_packet;
-			    		DEBUG(1,"%s invalid packet len in 802.1H SNAP OUI check \n",dev->name);
-			    	}
-			    	DEBUG(0x200,"%s OUI 004096  \n",dev->name);
-			    	DEBUG(0x200," 802.1H uknown1 %x  ",ntohs(bridge_tmp->unknown1));
-			    	DEBUG(0x200," 802.1H uknw type %x  \n",0xf000 & ntohs(bridge_tmp->unknown2));
-			    	DEBUG(0x200," 802.1H payloadsize %x  \n",0x0fff & ntohs(bridge_tmp->unknown2));
-			    	
-			    	//goto bad_packet; // TODO
-			    	
-			    	bridge = bridge_tmp;
-			    	if (bridge_tmp->unknown1 == 0x0000 &&
-			    	     ((ntohs(bridge_tmp->unknown2) & 0xf000) == 0x1000 ) ){
-			    	     rx_buff->type |= p80211_8021H;
-			    	     rx_buff->mac   = &payload[ptr];
-			    	     DEBUG(0x200," 802.1H DATA packet of size %x\n",0xf000 & ntohs(bridge_tmp->unknown2) );
-			    	     memcpy(priv->p2p,rx_buff->u.rx.ieee_802_11.mac2, 6);
-			    	     ptr +=12;
-			    	     continue;
-			    	};
-			    	DEBUG(0x200,"%s droping unknown  004096 packet \n ",dev->name);
-			    	goto bad_packet;
-			    	
-			 
-			}
-			goto bad_packet;
-		}
-		if ( len > 0x5DC){ 
-			// packet without linklevel header for us
-		
-			if (  len == 0x8000 ||  len == 0x8006){
-			
-				DEBUG(0x200,"Non IP packet %x \n",ntohs(len));
-			
-			};
-			goto good_packet;
-		
-		};
-		
-		goto good_packet;
-	}
-	
-   good_packet:
-
-	if (ptr > pkt_len)	goto bad_packet;
-
-	if ( rx_buff->mac != (payload + ptr -12) )
-		memcpy( payload +ptr -12, rx_buff->mac , 12);
-
-	
-	
-	if (!payload || !skb || !rx_buff->skb || !rx_buff->u.rx.payload)
-		return ;
-	//skb->ip_summed = CHECKSUM_NONE;
-	skb->data = payload + ptr -12;
-	skb->len += ptr ;
-	
-	rx_buff->skb->protocol = eth_type_trans(rx_buff->skb,dev);
-	DEBUG(0x200,"eth_type_trans decided: %x\n",rx_buff->skb->protocol);
-	rx_buff->skb = NULL;
-	rx_buff->u.rx.payload = NULL;
-	priv->stats.rx_packets++;
-	priv->stats.rx_bytes += skb->len;
-	
-	netif_rx(skb);
-	dev->last_rx = jiffies;
-	AWC_ENTRY_EXIT_DEBUG("exit\n");
-	return ;
-
-   bad_packet:
-   	DEBUG(0x200,"%s packet dropped in packet hdr parse \n ",dev->name);
-	if (rx_buff->skb && (rx_buff->type & p80211copy_path_skb)){
-
-		dev_kfree_skb_irq(rx_buff->skb);		
-		rx_buff->skb = NULL;
-		rx_buff->u.rx.payload = NULL;
-	};
-
-	AWC_ENTRY_EXIT_DEBUG("exit\n");	
-
-};
-
-void
-awc_802_11_failed_rx_copy(struct net_device * dev,struct awc_fid * rx_buff){
-	struct awc_private * priv = (struct awc_private * )dev->priv;
-
-
-	AWC_ENTRY_EXIT_DEBUG("awc_802_11_failed_rx_copy");
-	if (rx_buff->skb)
-                dev_kfree_skb_irq(rx_buff->skb);
-        rx_buff->skb = NULL;
-        rx_buff->u.rx.payload = NULL;
-	priv->stats.rx_errors++;
-
-
-	AWC_ENTRY_EXIT_DEBUG("exit\n");
-};
-
-/*
-	called from kernel->driver tx routine
-	must decide where and how to post the packet 
-	must post the packet to wherever it decides
-	either copy to card or enqueue to destination queue
-
-*/
-
-
-int
-awc_802_11_tx_find_path_and_post(struct net_device * dev,
-				 struct sk_buff * skb){
-
-
-	struct awc_private * priv = (struct awc_private * )dev->priv;
-	int i;
-	int len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; /* check min length*/
-	struct awc_fid * fid = NULL;
-//	u16 saved_fid ;
-	u16 p2p_direct =priv->p2p_found;
-	struct iphdr * ip_hdr;
-	//buffer = skb->data;
-
-	AWC_ENTRY_EXIT_DEBUG("awc_802_11_tx_find_path_and_post");	
-
-	// netif_stop_queue(dev);
-	DOWN(&priv->tx_buff_semaphore);
-	if (len  > dev->mtu + 16 ) {
-		printk(KERN_ERR "%s packet size too large %d \n",dev->name, len);
-		goto final;
-	}
-
-	if (len + AWC_TX_HEAD_SIZE < AWC_TX_ALLOC_SMALL_SIZE  )
-		fid = awc_fid_queue_pop_head(&priv->tx_small_ready);
-
-	if (!fid)
-		fid = awc_fid_queue_pop_head(&priv->tx_large_ready);
-			
-	if (!fid) {
-		DEBUG(32,"%s buffs in use \n",dev->name);
-		goto no_space;
-	}		
-/*
-	if (fid->u.tx.fid_size < len + AWC_TX_HEAD_SIZE){
-		awc_fid_queue_push_tail(&priv->tx_small_ready, fid);
-		fid = awc_fid_queue_pop_head(&priv->tx_large_ready);
-	}
-*/
-	if (!fid) {
-	       DEBUG(32,"%s buffs in use \n",dev->name);
-	       goto no_space;
-	}
-	
-	if (fid->u.tx.fid_size < len + AWC_TX_HEAD_SIZE - 14){	
-		printk(KERN_ERR "found too small tx fid size %d, pktlen %d \n",fid->u.tx.fid_size, len);
-	}
-	memset(&fid->u.tx.radio_tx,		0,sizeof(struct aironet4500_radio_tx_header));
-	memset(&fid->u.tx.ieee_802_11,	0,sizeof(struct ieee_802_11_header));
-	memset(&fid->u.tx.ieee_802_3,	0,sizeof(struct ieee_802_3_header));
-	fid->u.tx.payload =NULL;
-	fid->u.tx.gap_length =0;
-	fid->busy = 1;
-	
-	
-	priv->tx_buffs_in_use++;
-	DEBUG(32,"found large buff %x \n",fid->u.tx.fid);
-
-/*
-	fid->type |= p80211_llc_snap;
-	fid->snap.dsap = 0xaa; 
-	fid->snap.ssap = 0xaa; 
-	fid->snap.ctrl = 0x03;	
-	fid->snap.oui[0] = 0x0;
-	fid->snap.oui[1] = 0x0;
-	fid->snap.oui[2] = 0x0;
-*/
-	fid->skb = skb;
-
-
-	if (priv->p2p_uc && !priv->p2p_found){ // we go without encapsulation to neighbour;
-	
-		for (i=0; i < 6; i++)
-			if (priv->p2p[i] != skb->data[i]){
-				p2p_direct = 1;
-				break;
-			}	
-	};
-
-	if (priv->force_tx_rate == 2 || priv->force_tx_rate == 4 || 
-		priv->force_tx_rate== 11 || priv->force_tx_rate == 22){
-			fid->u.tx.radio_tx.tx_bit_rate  = priv->force_tx_rate;
-	} else if (priv->force_tx_rate != 0 ) {
-		printk(KERN_ERR "wrong force_tx_rate=%d changed to default \n",	priv->force_tx_rate);
-		priv->force_tx_rate = 0;
-	};
-	fid->u.tx.radio_tx.TX_Control = 
-		aironet4500_tx_control_tx_ok_event_enable |
-		aironet4500_tx_control_tx_fail_event_enable |
-		aironet4500_tx_control_no_release;
-
-	if (len < priv->force_rts_on_shorter){
-		fid->u.tx.radio_tx.TX_Control |=
-			aironet4500_tx_control_use_rts;
-	};
-
-	ip_hdr = (struct iphdr * ) ((( char * ) skb->data) + 14);
-	if (ip_hdr && skb->data[12] == 0x80 ){
-		if (ip_hdr->tos & IPTOS_RELIABILITY && priv->ip_tos_reliability_rts)
-			fid->u.tx.radio_tx.TX_Control |=
-			    aironet4500_tx_control_use_rts;
-		if (ip_hdr->tos & IPTOS_THROUGHPUT && priv->ip_tos_troughput_no_retries)
-			fid->u.tx.radio_tx.TX_Control |=
-			    aironet4500_tx_control_no_retries;
-	};
-
-	if (priv->p802_11_send ||  memcmp(dev->dev_addr, skb->data +6, 6)  ){
-		fid->u.tx.radio_tx.TX_Control |=
-			aironet4500_tx_control_header_type_802_11;	
-		DEBUG(0x200,"%s bridging, forcing 802_11 send \n ",dev->name);
-	}
-
-
-	if (!priv->p2p_uc || p2p_direct) {
-		if ((fid->u.tx.radio_tx.TX_Control &
-		                 aironet4500_tx_control_header_type_802_11 )){
-
-			// including 802.3 header into 802.11 packet
-			fid->u.tx.radio_tx.PayloadLength 	= len -12;
-			fid->u.tx.ieee_802_3.payload_length = len -12 ;
-			fid->pkt_len = len -12;
-			fid->u.tx.payload = skb->data +12;
-
-			if (priv->simple_bridge){	
-				memcpy(fid->u.tx.ieee_802_11.mac1,skb->data,6);
-				memcpy(fid->u.tx.ieee_802_11.mac2,skb->data +6,6);
-				memcpy(fid->u.tx.ieee_802_11.mac3,priv->status.CurrentBssid ,6);
-				memset(fid->u.tx.ieee_802_11.mac4,0,6);
-				fid->u.tx.ieee_802_11.frame_control = 0x8;
-				fid->u.tx.ieee_802_11.gapLen=6;
-			} else {
-				memcpy(fid->u.tx.ieee_802_11.mac1,skb->data,6);
-				memcpy(fid->u.tx.ieee_802_11.mac2,dev->dev_addr,6);
-				memcpy(fid->u.tx.ieee_802_11.mac3,skb->data +6 ,6);
-				memset(fid->u.tx.ieee_802_11.mac4,0 ,6);
-				fid->u.tx.ieee_802_11.frame_control = 0x108;
-				fid->u.tx.ieee_802_11.gapLen=6;                 
-			}
-		} else { // plain old 802.3, with hdr copied
-			fid->u.tx.radio_tx.PayloadLength 	= len -12;
-			fid->u.tx.ieee_802_3.payload_length = len -12;
-			fid->pkt_len = len - 12;
-			fid->u.tx.payload = skb->data +12;
-		};	
-		memcpy(fid->u.tx.ieee_802_3.dst_mac,skb->data, 12);
-		DEBUG(0x200,"%s tx simply 802.3 type \n ",dev->name);		
-
-	} else {// 802.1H bridgeing
-		fid->type 		|= p80211_8021H;
-		fid->bridge_size 	= len + sizeof(fid->bridge) ;
-		fid->bridge.dsap 	= 0xaa;
-		fid->bridge.ssap 	= 0xaa;
-		fid->bridge.ctrl 	= 0x03;
-		fid->bridge.oui[0] = 0x0;
-		fid->bridge.oui[1] = 0x40;
-		fid->bridge.oui[2] = 0x96;
-		fid->bridge.unknown1= 0x0000;
-		fid->bridge.unknown2= htons((len) & 0x1000);
-		fid->u.tx.radio_tx.PayloadLength 	= fid->bridge_size + 2;
-		fid->u.tx.ieee_802_3.payload_length = fid->u.tx.radio_tx.PayloadLength ;
-		
-
-		fid->u.tx.payload = skb->data +12;
-		if ((fid->u.tx.radio_tx.TX_Control &
-		                 aironet4500_tx_control_header_type_802_11 )){
-	
-			memcpy(fid->u.tx.ieee_802_11.mac1,priv->p2p,6);
-			memcpy(fid->u.tx.ieee_802_11.mac2,skb->data +6,6);
-			memcpy(fid->u.tx.ieee_802_11.mac3,priv->bssid ,6);
-			memset(fid->u.tx.ieee_802_11.mac4,0,6);
-			fid->u.tx.ieee_802_11.gapLen=6;
-
-			fid->u.tx.ieee_802_11.frame_control = 0x8;                 
-		}		
-		memcpy(fid->u.tx.ieee_802_3.dst_mac,priv->p2p, 6);
-		memcpy(fid->u.tx.ieee_802_3.src_mac,dev->dev_addr, 6);
-		fid->u.tx.payload = skb->data + 2 + sizeof(fid->bridge);
-		fid->pkt_len = len ;
-	
-		DEBUG(0x200,"%s tx simply 802.1H type \n ",dev->name);
-		
-	};
-	
-	priv->stats.tx_bytes += fid->u.tx.ieee_802_3.payload_length;
-	priv->stats.tx_packets++;
-	
-	
-	awc_fid_queue_push_tail(&priv->tx_in_transmit,fid);
-	udelay(1);
-	awc_transmit_packet(dev,fid);
-	if (priv->tx_large_ready.size <= 2 || priv->tx_small_ready.size <= 2 ){
-		if (netif_running(dev))
-			netif_stop_queue(dev);
-	} else {
-	  	if (netif_running(dev)) 
-			netif_wake_queue(dev);
-	}
-	UP(&priv->tx_buff_semaphore);
-	AWC_ENTRY_EXIT_DEBUG("exit\n");
-	return 0;
-
-	
-   no_space:
-	DEBUG(32,"%s tx buffs not found \n ",dev->name);
-	#ifdef AWC_DEBUG
-//		printk("s");
-	#endif
-   	netif_stop_queue (dev); //weell, here it must be set anyway and before
-   	//priv->stats.tx_fifo_errors++;
-   	UP(&priv->tx_buff_semaphore);
-	AWC_ENTRY_EXIT_DEBUG("NoSpaceExit\n");
-   	return 1 ;
-  final:
-	priv->stats.tx_errors++;
-	UP(&priv->tx_buff_semaphore);
-	if (!netif_running(dev)) 
-		netif_start_queue(dev);
-	dev_kfree_skb(skb);
-	AWC_ENTRY_EXIT_DEBUG("BADExit\n");
-	return -1;
-  
-};
-
-/*
-	called from low level driver->card tx copy routine  
-	probably wants to free skbuf if failed transmits won't be
-	resubmitted to another device (if more than one path)
-	or tried again (if tx buffer in card needs to be filled again)
-*/  
-  
-  
-void
-awc_802_11_after_tx_packet_to_card_write(struct net_device * dev,
-					 struct awc_fid * tx_buff){
-
-
-	AWC_ENTRY_EXIT_DEBUG("awc_802_11_after_tx_packet_to_card_write");
-
-	if (!tx_buff){
-		DEBUG(1,"%s no damn tx_buff in awc_802_11_after_tx_packet_to_card_write \n",dev->name);
-	};
-
-	if(tx_buff->skb){
-		dev_kfree_skb(tx_buff->skb);
-		tx_buff->skb = NULL;
-	}
-
-	AWC_ENTRY_EXIT_DEBUG("exit\n");
-};
-
-/*
-        called from low level driver->card tx copy routine
-        probably wants to free skbuf if failed writes won't be
-        resubmitted to another device (if more than one path) 
-        or tried again (if tx buffer in card needs to be filled again)
-*/
-                        
-void
-awc_802_11_after_failed_tx_packet_to_card_write(struct net_device * dev,
-                                         struct awc_fid * tx_buff){
-        struct awc_private * priv = (struct awc_private *)dev->priv;
-
-
-	AWC_ENTRY_EXIT_DEBUG("awc_802_11_after_failed_tx_packet_to_card_write");
-
-	if (!tx_buff){
-		DEBUG(1,"%s no damn tx_buff in awc_802_11_after_failed_tx_packet_to_card_write \n",dev->name);
-	};
-
-	if(tx_buff->skb){
-		dev_kfree_skb(tx_buff->skb);
-		tx_buff->skb = NULL;
-		tx_buff->busy =0;
-		printk(KERN_ERR "%s packet to card write failed \n",dev->name);
-	}
-	
-	awc_fid_queue_remove(&priv->tx_in_transmit,tx_buff);
-	
-	if (tx_buff->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE)
-		awc_fid_queue_push_tail(&priv->tx_small_ready,tx_buff);
-	else 
-		awc_fid_queue_push_tail(&priv->tx_large_ready,tx_buff);
-
-	AWC_ENTRY_EXIT_DEBUG("exit\n");
-
-};
-                                         
-inline void 
-awc_802_11_after_tx_complete(struct net_device * dev, struct awc_fid * tx_buff){
-
-        struct awc_private * priv = (struct awc_private *)dev->priv;
-
-	AWC_ENTRY_EXIT_DEBUG("awc_802_11_after_tx_complete");                
-
-	DEBUG(32,"tx complete status %x \n ",tx_buff->u.tx.radio_tx.Status);
-
-	#ifdef AWC_DEBUG
-	 if (tx_buff->u.tx.radio_tx.Status)
-	 	printk("tf%x ",tx_buff->u.tx.radio_tx.Status);
-	#endif
-	if (tx_buff->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE){
-		awc_fid_queue_push_tail(&priv->tx_small_ready,tx_buff);
-		priv->tx_small_buffs_in_use--;
-	} else { 
-		awc_fid_queue_push_tail(&priv->tx_large_ready,tx_buff);
-		priv->tx_buffs_in_use--;
-	}
-
-	tx_buff->busy = 0;
-//	netif_wake_queue (dev);
-
-	AWC_ENTRY_EXIT_DEBUG("exit\n");
-};
-
-                                                 
-
-
-/********************************	R X	***********************/
-
-
-
-inline int
-awc_receive_packet(struct net_device * dev){
-	
-    struct awc_command cmd;
-    u16	Fid;
-//    struct sk_buff *skb = NULL;
-    struct awc_fid * rx_buff;
-
-
-    struct awc_private * priv ;
-	int i;    
-    
-    	priv= (struct awc_private *)dev->priv;
-      	rx_buff = priv->rx_ready.head        ;
-
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_receive_packet ");
-     
-	Fid = awc_Rx_Fid(dev->base_addr);
-	
-	DEBUG(128," RX FID  %x	\n",Fid);
-
-	if (!Fid){
-		printk(KERN_CRIT "No RxFid when rx event \n");
-		return -1;
-	}
-
-
-	
-	if (!rx_buff){
-		printk(KERN_CRIT "No rx_buff in rx event \n");
-		return -1;
-	}
-
-	rx_buff->type   = 0;
-
-	                
-	AWC_INIT_COMMAND(AWC_CLI,cmd,dev,0,0,
-			Fid, 0, 0x14 , &(rx_buff->u.rx.radio_rx));
-
-
-// header reading , order is important
-	AWC_BAP_LOCK_UNDER_CLI(cmd);
-
-	if (awc_bap_setup(&cmd))		goto final;
-	if (awc_bap_read(&cmd))		goto final;
-
-	DEBUG(128, "rx receive radio header, length %x \n",rx_buff->u.rx.radio_rx.PayloadLength);
-
-	cmd.buff 	= &(rx_buff->u.rx.ieee_802_11);
-	cmd.len		= 0x20;
-
-	if (awc_bap_read(&cmd))		goto final;
-
-	DEBUG(128, "rx receive 802_11 header, framecontrol %x \n",rx_buff->u.rx.ieee_802_11.frame_control);
-
-	if (rx_buff->u.rx.ieee_802_11.gapLen > 8) {
-		printk(KERN_ERR "%s: 802.11 gap lenght huge %d \n",dev->name,rx_buff->u.rx.ieee_802_11.gapLen);
-		goto final;
-	}
-	DEBUG(128,"SeqCtl %x, 802_11 macs: ",rx_buff->u.rx.ieee_802_11.SeqCtl);
-	if (awc_debug & 0x7000){
-		DEBUG(0x7000, " %s mac1 ",dev->name); for (i = 0; i < 6; i++) DEBUG(0x7000, "%02x:",((unsigned char)rx_buff->u.rx.ieee_802_11.mac1[i] )) ;
-		DEBUG(0x7000, " %s mac2 ",dev->name); for (i = 0; i < 6; i++) DEBUG(0x7000, "%02x:",((unsigned char)rx_buff->u.rx.ieee_802_11.mac2[i] )) ;
-		DEBUG(0x7000, " %s mac3 ",dev->name); for (i = 0; i < 6; i++) DEBUG(0x7000, "%02x:",((unsigned char)rx_buff->u.rx.ieee_802_11.mac3[i] )) ;
-		DEBUG(0x7000, " %s mac4 ",dev->name); for (i = 0; i < 6; i++) DEBUG(0x7000, "%02x:",((unsigned char)rx_buff->u.rx.ieee_802_11.mac4[i] )) ;
-	}	
-	DEBUG(128,"\n GapLen %d ",rx_buff->u.rx.ieee_802_11.gapLen );
-	
-	if (rx_buff->u.rx.ieee_802_11.gapLen > 0) {
-		cmd.buff     = rx_buff->u.rx.ieee_802_11.gap;
-		cmd.len      = rx_buff->u.rx.ieee_802_11.gapLen;
-		if (awc_bap_read(&cmd))	     goto final;
-		DEBUG(128, "rx receive gap header , gap length %x \n",rx_buff->u.rx.gap_length);
-	}
-	for (i = 0; i < rx_buff->u.rx.ieee_802_11.gapLen ; i++) DEBUG(128,"%x",((unsigned char)rx_buff->u.rx.ieee_802_11.gap[i] )) ;
-
-        
-	if ( !(priv->config.ReceiveMode & RXMODE_DISABLE_802_3_HEADER ) 
-	     ){
-		cmd.buff     	 = &(rx_buff->u.rx.ieee_802_3);
-		cmd.len      	 = 0x10;
-		rx_buff->type 	|= p80211_8023;
-		if (awc_bap_read(&cmd))				goto final;
-		DEBUG(128, "rx receive 802_3 header, payload length %x \n",rx_buff->u.rx.ieee_802_3.payload_length);
-        	DEBUG(128,"\n 802_3 status %x ",rx_buff->u.rx.ieee_802_3.status );
-		DEBUG(128," RX payloadLen %x, dst,src: ",rx_buff->u.rx.ieee_802_3.payload_length);
-		if (awc_debug & 0x7000){
-			for (i = 0; i < 6; i++) printk("%02x:",((unsigned char)rx_buff->u.rx.ieee_802_3.dst_mac[i] )) ;
-			for (i = 0; i < 6; i++) printk("%02x:",((unsigned char)rx_buff->u.rx.ieee_802_3.src_mac[i] )) ;
-		}
-	};
-
-	rx_buff->pkt_len = rx_buff->u.rx.radio_rx.PayloadLength;
-	
-	if (priv->config.OperatingMode & MODE_LLC_HOST)
-		rx_buff->type   |= p80211_llc_snap;
-
-	
-	if (awc_802_11_find_copy_path(dev,rx_buff))		goto final;
-
-
-	if (rx_buff->u.rx.payload ){	
-		cmd.buff = rx_buff->u.rx.payload;
-		cmd.len	 = rx_buff->pkt_len;
-		if (awc_bap_read(&cmd))				goto final;
-		DEBUG(128, "rx payload read %x \n",rx_buff->u.rx.ieee_802_3.payload_length);
-	};
-	
-	AWC_RELEASE_COMMAND(cmd);
-
-        DEBUG(128,"\n payload hdr %x ",rx_buff->u.rx.ieee_802_3.status );
-        if (awc_debug && rx_buff->u.rx.payload)
-		for (i = 0; i < 20; i++) DEBUG(128,"%x",((unsigned char)rx_buff->u.rx.payload[i] )) ;
-	DEBUG(128,"%c",'\n');
-
-	awc_802_11_router_rx(dev,rx_buff);
-
-	AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
- 	return 0;
-     final:
-     
-        awc_802_11_failed_rx_copy(dev,rx_buff);
-     	// if (skb) dev_kfree_skb(skb, FREE_WRITE);
-     	AWC_RELEASE_COMMAND(cmd);
-     	AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	return -1; ;
-     	
-};
-
-
-int
-awc_transmit_packet(struct net_device * dev, struct awc_fid * tx_buff) {
-	
-	struct awc_command cmd;
-	u16 size ;
-//	unsigned long flags;
-	int i;
-    struct awc_private * priv= (struct awc_private *)dev->priv;
-
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_transmit_packet ");
-     
-	if (priv->link_status_changed ){
-		priv->link_status_changed =0;
-  		awc_readrid_dir(dev,&priv->rid_dir[7]);
-	}
-	
-
-        AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0xB, tx_buff->u.tx.fid,
-          	tx_buff->u.tx.fid, 0, 0x14 , &(tx_buff->u.tx.radio_tx));
-	
-	AWC_BAP_LOCK_NOT_CLI(cmd);
-
-#ifdef AWC_BY_BOOK
-#warning  By books is bad, AWC_BY_BOOK  
-#error cli sti bad here
-	if (    !(tx_buff->type &(p80211_llc_snap|p80211_8021H) ) 
-	     && !(tx_buff->u.tx.radio_tx.TX_Control &
-	                   aironet4500_tx_control_header_type_802_11 )){
-	
-		cmd.buff=&(tx_buff->u.tx.radio_tx.TX_Control);
-		cmd.len = 0x2 ;
-        	cmd.offset = 0x8;
-        	save_flags(flags);
-        	cli();
-        	if (awc_bap_setup(&cmd))		goto final;        
-        	if (awc_bap_write(&cmd))		goto final;
-
-		cmd.buff=&(tx_buff->u.tx.ieee_802_3.payload_length);
-		cmd.len = 14;
-        	cmd.offset = 0x36;
-        	if (awc_bap_setup(&cmd))		goto final;        
-     		if (awc_bap_write(&cmd))		goto final;
-     		restore_flags(flags);
-
-	} else {
-#endif
-			
-        	if (awc_bap_setup(&cmd))		goto final;        
-        	if (awc_bap_write(&cmd))		goto final;
-        
-        	DEBUG(64," wrote radio tx header for fid %x \n",tx_buff->u.tx.fid);
-
-		// 802.11
-        	cmd.buff=&(tx_buff->u.tx.ieee_802_11);
-        	cmd.len = 0x20;
-        	if (awc_bap_write(&cmd))                goto final;
-
-		// Gap
-		if (tx_buff->u.tx.ieee_802_11.gapLen) {
-        		cmd.buff=&(tx_buff->u.tx.ieee_802_11.gap);
-        		cmd.len = tx_buff->u.tx.ieee_802_11.gapLen;
-        		if (awc_bap_write(&cmd))	goto final;
-        	}
-	        // 802.3
-	        if ( !	(tx_buff->u.tx.radio_tx.TX_Control & 
-	      	 	aironet4500_tx_control_header_type_802_11 )){
-	       		 
-       			cmd.buff=&(tx_buff->u.tx.ieee_802_3);
-			if (awc_debug & 0x7000){
-				printk("%s TX dst ",dev->name);
-				for (i=0; i < 6; i++) printk ("%02x:",(unsigned char) tx_buff->u.tx.ieee_802_3.dst_mac[i]);
-				printk(" src ");
-				for (i=0; i < 6; i++) printk ("%02x:",(unsigned char) tx_buff->u.tx.ieee_802_3.src_mac[i]);
-				printk(" \n ");
-			}
-       			cmd.len = 0x10; 
-       			if (awc_bap_write(&cmd))	goto final;
-       		};
-       	 	
-       		if (tx_buff->type & p80211_llc_snap) {
-       			cmd.buff=	& tx_buff->snap;
-       			cmd.len =	sizeof(tx_buff->snap);
-       			if (awc_bap_write(&cmd))		goto final;
-        	};
-	 
-	  	if (tx_buff->type & p80211_8021H) {
-       	 		size = htons(tx_buff->bridge_size);  
-        	//	size = tx_buff->bridge_size;// to seasure raw speed of f** UC  
-       			cmd.buff=	& size;
-       			cmd.len =	2 ;
-        		if (awc_bap_write(&cmd))                goto final;
-        		
-       			cmd.buff=	& tx_buff->bridge;
-       			cmd.len =	sizeof(tx_buff->bridge);
-       			if (awc_bap_write(&cmd))		goto final;
-        	};
-	       	 
-#ifdef AWC_BY_BOOK	       	 
-	       	 
-	}
-#endif
-       	cmd.buff=	tx_buff->u.tx.payload;
-       	cmd.len =	tx_buff->pkt_len;
-
-       	if (awc_bap_write(&cmd))			goto final;
-	AWC_RELEASE_COMMAND(cmd);
-// locking probs,  these two lines below and above, swithc order 
-	if (awc_issue_command_and_block(&cmd))		goto final_unlocked;      
-
-
-	tx_buff->transmit_start_time = jiffies;
-	awc_802_11_after_tx_packet_to_card_write(dev,tx_buff);         		
-           // issue the transmit command
-
-
-        AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
-	return 0;
-     final:
-	awc_802_11_after_failed_tx_packet_to_card_write(dev,tx_buff);     	        
-     	printk(KERN_CRIT "%s awc tx command failed \n",dev->name);
-     	AWC_RELEASE_COMMAND(cmd);
-     	AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	return -1; ;
-
-     final_unlocked:
-	awc_802_11_after_failed_tx_packet_to_card_write(dev,tx_buff);     	        
-     	printk(KERN_CRIT "%s awc tx command failed \n",dev->name);
-     	AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	return -1; ;
-
-}
-
-
-inline int
-awc_tx_complete_check(struct net_device * dev){
-
-	struct awc_fid	* fid;
-	struct awc_command cmd;
-
-
-     AWC_ENTRY_EXIT_DEBUG(" entry awc_tx_complete_check ");
-     
-		
-
-	fid = awc_fid_queue_pop_head(&((struct awc_private *)dev->priv)->tx_post_process);
-	
-	if (!fid) {
-		printk("awc_tx_complete_check with empty queue \n ");
-		return -1;
-	}
-
-	DEBUG(64," tx_complete fid %x \n",fid->u.tx.fid);
-	
-        AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0,0, fid->u.tx.fid,
-          			0, 0x14 , &(fid->u.tx.radio_tx));
-
-	fid->state  |= awc_tx_fid_complete_read;
-
-	AWC_BAP_LOCK_NOT_CLI(cmd);
-        if (awc_bap_setup(&cmd))		goto final;
-        if (awc_bap_read(&cmd))			goto final;
-	AWC_RELEASE_COMMAND(cmd);
-        
-	awc_802_11_after_tx_complete(dev,fid);         		
-
-	
-        AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
- 	return 0;
-        
-     final:
-        awc_802_11_after_tx_complete(dev,fid);
-        printk(KERN_ERR "%s awc_tx_complete_check failed \n",dev->name);
-     	AWC_RELEASE_COMMAND(cmd);
-     	AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
-	return -1; ;
-}
-
-
-#define AWC_QUEUE_BH {\
-	if (!priv->work_active && !priv->work_running){\
-		priv->work_active = 1;\
-		schedule_work(&priv->work); \
-	}\
-	}
-
-
-void
-awc_bh(struct net_device *dev){
-
-        struct awc_private * priv = (struct awc_private *)dev->priv;
-      	int  active_interrupts;
-	int enabled_interrupts;
-//	u16	tx_status;
-	int 	multi_ints = 0;
-//	u16	tx_fid = 0;
-//	unsigned long flags;
-
-	DEBUG(8, "awc_bh awoken on jiffie %ld \n",jiffies);
-
-	priv->work_running = 1;
-	
-	active_interrupts = awc_event_status(dev->base_addr);
-	
-        enabled_interrupts = awc_ints_enabled(dev->base_addr);
-
-	DEBUG(8, "awc_bh active ints %x \n",active_interrupts);
-
-        if (test_and_set_bit( 0, (void *) &priv->tx_chain_active) ) {
-//		printk(KERN_ERR "tx chain active in bh \n");
-//		schedule_work(&priv->work);
-		goto bad_end;
-	}
-start:
-	if (active_interrupts == 0xffff){
-	
-		printk(KERN_CRIT "%s device ejected in interrupt, disabling\n",dev->name);
-		netif_device_detach (dev);
-		if (priv->command_semaphore_on){
-			priv->command_semaphore_on--;
-			AWC_UNLOCK_COMMAND_ISSUING(priv);
-		}
-		priv->tx_chain_active =0;
-		goto bad_end;
-		    
-	}
-
-	if (priv->unlock_command_postponed ){
-	
-	   priv->unlock_command_postponed-- ;
-	   if( priv->command_semaphore_on ){
-		
-     		awc_read_response((&priv->cmd));
-     		priv->async_command_start = 0;
-     		if (priv->command_semaphore_on){
-     		
-     			priv->command_semaphore_on--;
-		        AWC_UNLOCK_COMMAND_ISSUING(priv);
-		}
-     	    }
-     	};
-
-/*        if ( active_interrupts & 0x1 ){
-	       		awc_receive_packet(dev) ;
-			awc_event_ack_Rx(dev->base_addr);
-			priv->waiting_interrupts &= ~0x1;
-	}
-*/
-	while (priv->tx_post_process.size)
-		if (awc_tx_complete_check(dev)) break;
-	
-	active_interrupts = awc_event_status(dev->base_addr);
-
-	if (priv->command_semaphore_on || priv->tx_post_process.size){
-			if (multi_ints++ < 10000){
-				goto start;
-			}
-		};
-		priv->work_active  = 0;
-		priv->work_running = 0;
-
-        priv->tx_chain_active = 0;
-
-  	
-
-  bad_end:
-//	if (!priv->tx_chain_active) 
-//		wake_up(&priv->tx_chain_wait_queue);
-  
-  	priv->work_running = 0;
-	priv->work_active = 0;
-	return ;
-};
-
-
-inline int
-awc_interrupt_process(struct net_device * dev){
-
-	struct awc_private * priv ;
-      	int  active_interrupts;
-	int enabled_interrupts;
-	u16	tx_status;
-	int 	multi_ints = 0;
-	u16	tx_fid = 0;
-//	u16	ints_to_ack =0;
-	struct awc_fid	* fid = NULL;
-//	int interrupt_reenter = 0;
-//	unsigned long flags;	
-
-//	save_flags(flags);
-//	cli();
-	// here we need it, because on 2.3 SMP there are truly parallel irqs 	
-	disable_irq(dev->irq);
-
-	DEBUG(2," entering interrupt handler %s ",dev->name);
-
-	if (!dev) {
-		printk(KERN_ERR "No dev in interrupt   \n");
-		goto bad_end;
-	};
-
-	priv = (struct awc_private *)dev->priv;
-
-	if (!priv) {
-		printk(KERN_ERR "No PRIV in interrupt \n");
-		goto bad_end;
-	};
-
-
-        enabled_interrupts = awc_ints_enabled(dev->base_addr);
-	active_interrupts = awc_event_status(dev->base_addr);
-
-	DEBUG(2,"entry: processing interrupts waiting %x \n",priv->waiting_interrupts);
-	DEBUG(2,"entry: processing interrupts active  %x \n",active_interrupts);
-	DEBUG(2,"entry: processing interrupts enabled %x \n",enabled_interrupts);
-//	printk("ikka interruptis\n");
-
-
-	priv->interrupt_count++;
-	if (priv->interrupt_count > 1 )
-		printk(" interrupt count on\n ");
-
-
-
-	if (priv->waiting_interrupts & active_interrupts)
-		printk(KERN_ERR "double interrupt waiting %x active %x \n",
-				priv->waiting_interrupts, active_interrupts);
-
- //       priv->waiting_interrupts |= active_interrupts;
-
-
-
-
-
-start:
-	DEBUG(2,"Start processing int, times %d\n",multi_ints);
-	
-	if (active_interrupts == 0xffff){
-	
-		printk(KERN_CRIT "%s device ejected, got interrupt, disabling\n",dev->name);
-		//priv->
-		netif_device_detach (dev);
-		priv->ejected = 1;
-		if (priv->work_active || priv->work_running){
-			priv->interrupt_count--;
-			goto bad_end;
-		} else if (priv->command_semaphore_on){
-			
-			printk(KERN_ERR "ejected, last BH fired \n");
-			
-			 AWC_QUEUE_BH;    
-		}
-		priv->interrupt_count--;
-		goto bad_end;
-	}
-
-	
-
-	if (active_interrupts & 0x100 ){
-		awc_event_ack_Awaken(dev->base_addr);
-		udelay(10);
-		DEBUG(1,"%s device awoke \n",dev->name);
-		priv->waiting_interrupts &= ~0x100;
-	};
-	if (active_interrupts & 0x80 ){
-	
-		priv->link_status = awc_Link_Status(dev->base_addr);
-		DEBUG(1,"link status changed %x \n",priv->link_status);
-		awc_event_ack_Link(dev->base_addr);
-		priv->waiting_interrupts &= ~0x80;
-	  	if(priv->link_status == 0x400)
-	  				printk(KERN_INFO "%s Associated\n",dev->name );
-	  	else { 
-	  		printk(KERN_INFO "%s Link status change : %s \n",dev->name, awc_print_string(awc_link_status_names, priv->link_status) );
-	  		if (	priv->link_status & 0x8100  ||
-	  			priv->link_status & 0x0100  ||
-	  			priv->link_status & 0x8200  ||
-	  			priv->link_status & 0x8400  ||
-	  			priv->link_status & 0x0300  )
-	  		printk(KERN_INFO "%s Link status change reason : %s \n",dev->name, awc_print_string(awc_link_failure_reason_names, priv->link_status & 0xff) );
-	  			
-	  	}
-	};
-
-
-	if (active_interrupts & 0x10 & enabled_interrupts ){
-
-//		printk(KERN_ERR "cmd int shouldnt be active in interrupt routine\n");
-
-     		awc_event_ack_Cmd(priv->cmd.port);
-     
-     		if ( priv->enabled_interrupts & 0x10) 
-     			priv->enabled_interrupts &= ~0x10;
-	     	
-	     	enabled_interrupts = awc_ints_enabled(dev->base_addr);
-
-		if (enabled_interrupts & 0x10){
-			awc_ints_enable(dev->base_addr, enabled_interrupts & ~0x10);
- 	    	}
-
-     		if (priv->command_semaphore_on){
-     			priv->unlock_command_postponed++;
-
-			AWC_QUEUE_BH;
-		}
-	}
-	
-	if ((active_interrupts & 0x10) && !(0x10 & enabled_interrupts) ){
-
-//		printk(KERN_ERR "%s: aironet4500: cmd int shouldnt be active in interrupt routine\n",dev->name);
-
-     		//awc_event_ack_Cmd(priv->cmd.port);
-	}     
-
-
-//	active_interrupts = awc_event_status(dev->base_addr);
-
-	tx_status = active_interrupts & 0x6 ;
-	
-
-
-	if (tx_status) {
-
-		tx_fid = awc_Tx_Compl_Fid(dev->base_addr);
-		if (!tx_fid){
-			udelay(10);
-			tx_fid = awc_Tx_Compl_Fid(dev->base_addr);
-		}
-		if (!tx_fid)
-			printk(KERN_ERR "No tx fid when tx int active\n");
-			
-		fid = awc_tx_fid_lookup_and_remove(dev, tx_fid);
-
-		if (fid) {
-			if (priv->process_tx_results) {
-				awc_fid_queue_push_tail(&priv->tx_post_process,fid);
-				AWC_QUEUE_BH;
-			}else {
-				if (fid->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE)
-    					awc_fid_queue_push_tail(&priv->tx_small_ready,fid);
-          			else
-      					awc_fid_queue_push_tail(&priv->tx_large_ready,fid);
-				netif_wake_queue (dev);
-			}
-		} else 
-			printk(KERN_ERR "awc fid %x not found\n",tx_fid);
-		
-
-		if (tx_status & 2){
-			awc_event_ack_Tx(dev->base_addr);
-			priv->stats.tx_packets++;
-			priv->waiting_interrupts  &= ~0x2;
-		}
-		if (tx_status & 4){
-			priv->stats.tx_errors++;
-			awc_event_ack_TxExc(dev->base_addr);
-			priv->waiting_interrupts  &= ~0x4;
-		}
-		if ((tx_status&6) == 6)
-			printk(KERN_NOTICE "%s: both tx and txExc up\n",dev->name);
-
-
-	}
-
-//	active_interrupts = awc_event_status(dev->base_addr);
-
-        if ( active_interrupts & 0x1 ){
-	       		awc_receive_packet(dev);
-			awc_event_ack_Rx(dev->base_addr);
-			priv->waiting_interrupts &= ~0x1;
-	}
-
-	active_interrupts = awc_event_status(dev->base_addr);
-
-	if ((active_interrupts & 0x7) && 
-	     !priv->work_active && 
-	     !priv->work_running ){
-		if (multi_ints++ < 5)
-			goto start;
-        }
-	if (multi_ints >=5 )
-		printk(KERN_ERR "%s multi_ints > 5 interrupts still active %x\n",dev->name,active_interrupts); 
-
- 
-	priv->interrupt_count--;
-
-	awc_ints_enable(dev->base_addr, 0x0000);
-
-
-	DEBUG(0x8, " enabling ints in interrupt_process %x \n",
-		priv->enabled_interrupts & ~priv->waiting_interrupts);
- 
-
-
-        AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
-
- 	awc_ints_enable(dev->base_addr, 
- 		priv->enabled_interrupts);
-
-//end_here:
-
-	enable_irq(dev->irq);
-//  	restore_flags(flags);
-
-        return 0;
-
-bad_end:
-        AWC_ENTRY_EXIT_DEBUG(" bad_end exit \n"); 	
-	enable_irq(dev->irq);
-//	restore_flags(flags);
-	return -1;
-
-
-};
-
-static const char *aironet4500_core_version =
-"aironet4500.c v0.1 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n";
-
-struct net_device * aironet4500_devices[MAX_AWCS];
-
-int awc_debug; //  0xffffff;
-static int p802_11_send; // 1
-
-static int awc_process_tx_results;
-int tx_queue_len = 10;
-int tx_rate;
-int channel = 5;
-//static int tx_full_rate;
-int max_mtu = 2312;
-int adhoc;
-int large_buff_mem = 1700 * 10;
-int small_buff_no	= 20;
-int awc_full_stats;
-char SSID[33];
-int master;
-int slave;
-int awc_simple_bridge;
-// int debug =0;
-
-#if LINUX_VERSION_CODE >= 0x20100
-
-MODULE_PARM(awc_debug,"i");
-MODULE_PARM(tx_rate,"i");
-MODULE_PARM(channel,"i");
-//MODULE_PARM(tx_full_rate,"i");
-MODULE_PARM(adhoc,"i");
-MODULE_PARM(master,"i");
-MODULE_PARM(slave,"i");
-MODULE_PARM(awc_simple_bridge,"i");
-MODULE_PARM(max_mtu,"i");
-MODULE_PARM(large_buff_mem,"i");
-MODULE_PARM(small_buff_no,"i");
-MODULE_PARM(SSID,"c33");
-MODULE_PARM_DESC(awc_debug,"Aironet debug mask");
-MODULE_PARM_DESC(channel,"Aironet ");
-MODULE_PARM_DESC(adhoc,"Aironet Access Points not available (0-1)");
-MODULE_PARM_DESC(master,"Aironet is Adhoc master (creates network sync) (0-1)");
-MODULE_PARM_DESC(slave,"Aironet is Adhoc slave (0-1)");
-MODULE_PARM_DESC(max_mtu,"Aironet MTU limit (256-2312)");
-#endif
-MODULE_LICENSE("GPL");
-
-
-/*EXPORT_SYMBOL(tx_queue_len);
-EXPORT_SYMBOL(awc_debug);
- */
-EXPORT_SYMBOL(awc_init);
-EXPORT_SYMBOL(awc_open);
-EXPORT_SYMBOL(awc_close);
-EXPORT_SYMBOL(awc_reset);
-EXPORT_SYMBOL(awc_config);
-
-EXPORT_SYMBOL(aironet4500_devices);
-EXPORT_SYMBOL(awc_debug);
-//EXPORT_SYMBOL();
-
-EXPORT_SYMBOL(awc_private_init);
-EXPORT_SYMBOL(awc_tx_timeout);
-EXPORT_SYMBOL(awc_start_xmit);
-EXPORT_SYMBOL(awc_interrupt);
-EXPORT_SYMBOL(awc_get_stats);
-EXPORT_SYMBOL(awc_change_mtu);
-EXPORT_SYMBOL(awc_set_multicast_list);
-
-EXPORT_SYMBOL(awc_proc_set_fun);
-EXPORT_SYMBOL(awc_proc_unset_fun);
-EXPORT_SYMBOL(awc_register_proc);
-EXPORT_SYMBOL(awc_unregister_proc);
-
-
-/***************************  RESET INIT CONFIG ***********************/
-
-
- void awc_reset(struct net_device *dev)
-{
-
-	long long jiff;
-
-	DEBUG(2, " awc_reset dev %p \n", dev);
-	DEBUG(2, "%s: awc_reset \n",  dev->name);
-	
-	awc_issue_soft_reset(dev);
-	
-	jiff = jiffies;
-	udelay(1000);
-	while (awc_command_read(dev->base_addr)){
-		udelay(1000);
-		if (jiffies - jiff > 5*HZ){
-			printk(KERN_CRIT "%s bad reset\n",dev->name);
-			break;
-		}
-	};
-
-}
-
- int awc_config(struct net_device *dev)
-{
-//	struct awc_private *priv = (struct awc_private *)dev->priv;
-
-	DEBUG(2, "%s: awc_config \n",  dev->name);
-
-	
-        if( awc_disable_MAC(dev))		goto final;
-	udelay(100);        
-	if( awc_write_all_rids(dev) )		goto final;
-	udelay(100);
-        if( awc_enable_MAC(dev))		goto final;
-
-	return 0;
-   final: 
-   	return -1;
-}
-
-
-char name[] = "ElmerLinux";
-
- int awc_init(struct net_device *dev){
-        struct awc_private *priv = (struct awc_private *)dev->priv;
-	int i;        
-	const char * radioType;
- 
-	DEBUG(2, "%s: awc_init \n",  dev->name);
-
-	/* both_bap_lock decreases performance about 15% 
-	 * but without it card gets screwed up 
-	 */ 
-#ifdef CONFIG_SMP
-		both_bap_lock = 1;
-		bap_setup_spinlock = 1;
-#endif
-	//awc_dump_registers(dev);
-
-	if (adhoc & !max_mtu)
-		max_mtu= 2250;
-	else if (!max_mtu)
-		max_mtu= 1500;
-			
-        priv->sleeping_bap = 1;
-        	
-
-	priv->enabled_interrupts = awc_ints_enabled(dev->base_addr);
-        
- 	if( awc_issue_noop(dev) ) 	goto final;
-
-	awc_ints_enable(dev->base_addr,0);
-
- 	if( awc_disable_MAC(dev) )	goto final;
-
-		
-//	awc_rids_setup(dev);
-	i=0;
-	while ( i < AWC_NOF_RIDS){
-		if (awc_rids_temp[i].selector)
-			memcpy(&priv->rid_dir[i],&awc_rids_temp[i],sizeof(priv->rid_dir[0]) );
-		else priv->rid_dir[i].selector = NULL;
-		i++;
-	}
-	
-	// following MUST be consistent with awc_rids in count and ordrering !!!
- 	priv->rid_dir[0].buff = &priv->config; // card RID mirrors
-	priv->rid_dir[1].buff = &priv->SSIDs;
-	priv->rid_dir[2].buff = &priv->fixed_APs;
-     	priv->rid_dir[3].buff = &priv->driver_name;
-      	priv->rid_dir[4].buff = &priv->enc_trans;
-	priv->rid_dir[5].buff = &priv->general_config; //      	
-	priv->rid_dir[6].buff = &priv->capabilities;
- 	priv->rid_dir[7].buff = &priv->status;
-  	priv->rid_dir[8].buff = &priv->AP;
-   	priv->rid_dir[9].buff = &priv->statistics;
-    	priv->rid_dir[10].buff = &priv->statistics_delta;
-     	priv->rid_dir[11].buff = &priv->statistics_delta_clear;
-	priv->rid_dir[12].buff = &priv->wep_volatile;
-	priv->rid_dir[13].buff = &priv->wep_nonvolatile;
-	priv->rid_dir[14].buff = &priv->modulation;
-
-      	priv->rid_dir[15].buff = &priv->statistics16;
-	priv->rid_dir[16].buff = &priv->statistics16_delta;
- 	priv->rid_dir[17].buff = &priv->statistics16_delta_clear;
-                       	
- 	priv->rid_dir[0].bufflen = sizeof(priv->config); // card RID mirrors
-	priv->rid_dir[1].bufflen = sizeof(priv->SSIDs);
-	priv->rid_dir[2].bufflen = sizeof(priv->fixed_APs);
-     	priv->rid_dir[3].bufflen = sizeof(priv->driver_name);
-      	priv->rid_dir[4].bufflen = sizeof(priv->enc_trans);
-	priv->rid_dir[5].bufflen = sizeof(priv->general_config); //
-	priv->rid_dir[6].bufflen = sizeof(priv->capabilities);
- 	priv->rid_dir[7].bufflen = sizeof(priv->status);
-  	priv->rid_dir[8].bufflen = sizeof(priv->AP);
-   	priv->rid_dir[9].bufflen = sizeof(priv->statistics);
-    	priv->rid_dir[10].bufflen = sizeof(priv->statistics_delta);
-     	priv->rid_dir[11].bufflen = sizeof(priv->statistics_delta_clear);
-	priv->rid_dir[12].bufflen = sizeof(priv->wep_volatile);
-	priv->rid_dir[13].bufflen = sizeof(priv->wep_nonvolatile);
-	priv->rid_dir[14].bufflen = sizeof(priv->modulation);
-
-      	priv->rid_dir[15].bufflen = sizeof(priv->statistics16);
-	priv->rid_dir[16].bufflen = sizeof(priv->statistics16_delta);
- 	priv->rid_dir[17].bufflen = sizeof(priv->statistics16_delta_clear);
-
-
- 	if( awc_read_all_rids(dev) )	goto final;
- 
-
- 	priv->config.OperatingMode = 0;// MODE_LLC_HOST;
- 	DEBUG(1,"ReceiveMode %x \n",priv->config.ReceiveMode);
- //	priv->config.ReceiveMode	=  RXMODE_DISABLE_802_3_HEADER;
- 	
-	if (!adhoc)
-	        priv->config.OperatingMode = MODE_STA_ESS;
-//        priv->config.OperatingMode = MODE_AP;
-// Setting rates does not work with new hardware, use force_tx_rate via proc
-//	priv->config.Rates[0]	=0x82;
-//	priv->config.Rates[1]	=0x4;
-//	priv->config.Rates[2]	=tx_full_rate;
-//	priv->config.Rates[3]	=0;
-//	priv->config.Rates[4]	=0;
-//	priv->config.Rates[5]	=0;
-//	priv->config.Rates[6]	=0;
-//	priv->config.Rates[7]	=0;
-	priv->config.Channel	= channel;
-	if (adhoc && master){
-		priv->config.JoinNetTimeout	= 0x1;//0 is facotry default
-	} else if (adhoc && slave){
-		// by spec 0xffff, but, this causes immediate bad behaviour
-		// firmware behvaiour changed somehere around ver 2??
-		priv->config.JoinNetTimeout	= 0x7fff;
-	};	
-//	priv->config.AuthenticationType = 1;
-	priv->config.Stationary	=1;
-//	priv->config.ScanMode	= 1;
-//	priv->config.LinkLossDelay	= 100;
-	priv->config.FragmentThreshold = 1700;
-	priv->config.RtsThreshold	= 1700;
-	memcpy(priv->config.NodeName, name, 10);
-
-	DEBUG(1,"%s supported Rates \n",dev->name);
-	for (i=0; i< 8; i++)
-		DEBUG(1,"%x ",priv->capabilities.SupportedRates[i]);
-	DEBUG(1,"%c",'\n');
-	DEBUG(1,"%s default Rates \n",dev->name);
-	for (i=0; i< 8; i++)
-		DEBUG(1,"%x ",priv->config.Rates[i]);
-	DEBUG(1,"%c",'\n');
-			
-
-	// here we go, bad aironet
-	memset(&priv->SSIDs,0,sizeof(priv->SSIDs));
-
-	spin_lock_init(&priv->queues_lock);
-        priv->SSIDs.ridLen		=0;
-        if (!SSID) {
-	        priv->SSIDs.SSID[0].SSID[0] 	='a';
-	        priv->SSIDs.SSID[0].SSID[1] 	='b';
-	        priv->SSIDs.SSID[0].SSID[2] 	='c';
-        	priv->SSIDs.SSID[0].lenght 	=3;
-        } else {
-        	int sidlen = strlen(SSID);
-        	memcpy(priv->SSIDs.SSID[0].SSID,SSID,sidlen);
-        	priv->SSIDs.SSID[0].lenght = sidlen;
-        };
-        
-        priv->SSIDs.SSID[1].lenght 	=0;
-        priv->SSIDs.SSID[1].SSID[0] 	=0;
-        priv->SSIDs.SSID[1].SSID[1] 	=0;        
-        priv->SSIDs.SSID[2].lenght 	=0;
-        priv->SSIDs.SSID[2].SSID[0] 	=0;
-        priv->SSIDs.SSID[2].SSID[1] 	=0;
-
-
-//	priv->enc_trans.rules[0].etherType= 0x0008;
-//	priv->enc_trans.rules[0].Action   = 1;        
-         	
- 	memcpy(	priv->config.StationMacAddress,
- 		priv->capabilities.FactoryAddress,	6	);
-
-        memcpy(dev->dev_addr, priv->config.StationMacAddress, 6);
-
-	DEBUG(2, "%s: awc_init success \n",  dev->name);
-	
-	if (priv->capabilities.RadioType == 1) radioType = "802.11 Frequency Hoping";
-	else if (priv->capabilities.RadioType == 2) radioType = "802.11 Direct Sequence";
-	else if (priv->capabilities.RadioType == 4) radioType = "LM2000";
-	else radioType = "Multiple Radio Types";
-
-	printk("%s: %s %s found @ 0x%lx irq %d firmwareVersion %d \n",dev->name,
-		priv->capabilities.ProductName,radioType,
-		dev->base_addr,dev->irq,
-		priv->capabilities.SoftwareVersion);
- 
- 	return 0; 
-   final:
-   	printk(KERN_ERR "aironet init failed \n");
-   	return -ENODEV;
-   	
- };
-
-int awc_private_init(struct net_device * dev){
-	struct awc_private * priv = (struct awc_private *) dev->priv;
-	int i = 0;
-
-	DEBUG(2, "%s: awc_private_init \n",  dev->name);
-	
-	
-	memset(priv, 0, sizeof(struct awc_private)); 
-	
-	spin_lock_init(&priv->queues_lock);
-	
-	priv->bap0.select 	= dev->base_addr + awc_Select0_register;
-	priv->bap0.offset 	= dev->base_addr + awc_Offset0_register;
-	priv->bap0.data		= dev->base_addr + awc_Data0_register;
-	priv->bap0.lock 	= 0;
-	priv->bap0.status	= 0;
-	spin_lock_init(&priv->bap0.spinlock);
-	init_MUTEX(&priv->bap0.sem);
-	priv->bap1.select 	= dev->base_addr + awc_Select1_register;
-	priv->bap1.offset 	= dev->base_addr + awc_Offset1_register;
-	priv->bap1.data		= dev->base_addr + awc_Data1_register;
-	priv->bap1.lock 	= 0;
-	priv->bap1.status	= 0;
-	spin_lock_init(&priv->bap1.spinlock);
-	init_MUTEX(&priv->bap1.sem);
-	priv->sleeping_bap	= 1;
-	
-//spinlock now	init_MUTEX(&priv->command_semaphore);
-	spin_lock_init(&priv->command_issuing_spinlock);
-	spin_lock_init(&priv->both_bap_spinlock);
-	spin_lock_init(&priv->bap_setup_spinlock);
-	spin_lock_init(&priv->interrupt_spinlock);
-	
-	priv->command_semaphore_on = 0;
-	priv->unlock_command_postponed = 0;
-	INIT_WORK(&priv->work, (void *)(void *)awc_work, dev);
-	priv->work_running	= 0;
-	priv->work_active	= 0;
-	priv->tx_chain_active	= 0;
-	priv->enabled_interrupts= 0x00;
-	priv->waiting_interrupts= 0x00;
-	
-	
-	init_MUTEX(&priv->tx_buff_semaphore);
-	priv->tx_buffs_in_use	= 0;
-	priv->tx_small_buffs_in_use = 0;
-	priv->mac_enabled 	=0;
-	priv->link_status	=0;
-	priv->large_buff_mem	= large_buff_mem;
-	if (priv->large_buff_mem < max_mtu + AWC_TX_HEAD_SIZE + 10 )
-		priv->large_buff_mem = max_mtu + AWC_TX_HEAD_SIZE + 10;
-	priv->small_buff_no	= small_buff_no;
-	if (priv->small_buff_no  < 1 )
-		priv->small_buff_no = 1 ;
-
-	priv->process_tx_results = awc_process_tx_results;
-
-	//init_waitqueue(&priv->tx_chain_wait_queue);
-
-	for (i=0; i< 6 ; i++ ) {
-		priv->p2p[i] = 0xff;
-		priv->bssid[i] =0;
-	}
-//	priv->p2p_uc 		=1;
-	priv->p2p_found		=0;
-
-	priv->p802_11_send	=p802_11_send;
-	priv->full_stats	= awc_full_stats;
-	priv->simple_bridge	= awc_simple_bridge;
-	priv->force_rts_on_shorter = 0;
-	priv->force_tx_rate	= tx_rate;
-	priv->ip_tos_reliability_rts = 0;
-	priv->ip_tos_troughput_no_retries = 0 ;	
-
-	priv->ejected		=0;	
-	priv->interrupt_count	=0;
-	
-	return 0;
-	
-};
-
-/****************************	OPEN	CLOSE	**********************/
-
- 
- int awc_open(struct net_device *dev)
-{
-	struct awc_private *priv = (struct awc_private *)dev->priv;
-
-
-
-	DEBUG(2, "%s: awc_open \n",  dev->name);
-
-	if( awc_queues_init(dev) )		goto final;
-	if( awc_config(dev) )		goto final;
-	
-	memcpy(dev->dev_addr, priv->config.StationMacAddress, 6);
-	 
-	priv->enabled_interrupts = 0x87;
-	awc_ints_enable(dev->base_addr,priv->enabled_interrupts);
-
-//	priv->p8022_client 	= register_8022_client;
-//	priv->snap_client	= register_snap_client;	
-	DEBUG(2, "%s: opened \n", dev->name);
-
-	priv->sleeping_bap  = 0;
-	
-	
-	MOD_INC_USE_COUNT;
-//	kernel_thread(awc_thread,dev,0);
-
-	netif_start_queue (dev);
-	return 0;					/* Always succeed */
-
-   final:
-   	netif_device_detach (dev);
-   	printk(KERN_ERR "aironet open failed \n");
-   	return -1;
-}
-
-
- int awc_close(struct net_device *dev)
-{
-	struct awc_private * priv = (struct awc_private *) dev->priv;
-
-	DEBUG(2, "%s: closing device.\n", dev->name);
-
-	netif_stop_queue (dev);
-	
-	awc_disable_MAC(dev);
-	awc_queues_destroy(dev);
-	
-	awc_reset(dev);
-	
-	mdelay(10);
-	
-	AWC_LOCK_COMMAND_ISSUING(priv);
-
-	MOD_DEC_USE_COUNT;
-
-	AWC_UNLOCK_COMMAND_ISSUING(priv);
-	 
-	return 0;
-}
-
-
-
-/******************************		TX  RX STUFF	******************/
-
-
-
-void awc_tx_timeout (struct net_device *dev)
-{
-	struct awc_private *priv = (struct awc_private *) dev->priv;
-	struct awc_fid * fid;
-	int cnt;
-	unsigned long flags;
-
-	DEBUG (2, "%s: awc_tx_timeout \n", dev->name);
-
-	printk (KERN_NOTICE "%s: Transmit timed out , buffs %d %d, queues tx %d pp %d lrg %d sm %d  \n ",
-	     dev->name, priv->tx_small_buffs_total, priv->tx_buffs_total,
-		priv->tx_in_transmit.size, priv->tx_post_process.size,
-		priv->tx_large_ready.size, priv->tx_small_ready.size);
-	priv->stats.tx_errors++;
-
-	save_flags(flags);
-	cli();
-	fid = priv->tx_in_transmit.head;
-	cnt = 0;
-	while (fid) { // removing all fids older that that
-		if (jiffies - fid->transmit_start_time > (HZ)) {
-			//      printk(KERN_ERR "%s staled tx_buff found, age %uld jiffies\n",dev->name,
-			//              jiffies - fid->transmit_start_time );
-			awc_fid_queue_remove (&priv->tx_in_transmit, fid);
-			if (fid->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE)
-				awc_fid_queue_push_tail (&priv->tx_small_ready, fid);
-			else
-				awc_fid_queue_push_tail (&priv->tx_large_ready, fid);
-		}
-		fid = fid->next;
-		if (cnt++ > 200) {
-			printk ("bbb in awc_fid_queue\n");
-			restore_flags(flags);
-			return;
-		};
-
-	}
-	restore_flags(flags);
-	dev->trans_start = jiffies;
-	netif_wake_queue (dev);
-}
-
-
-long long last_tx_q_hack;
-int direction = 1;
-
-int awc_start_xmit(struct sk_buff *skb, struct net_device *dev) {
-
-	struct awc_private *priv = (struct awc_private *)dev->priv;
-	int retval = 0;
-//	unsigned long flags;
-
-	DEBUG(2, "%s: awc_start_xmit \n",  dev->name);
-
-
-	if (!dev) {
-		DEBUG(1, " xmit dev=NULL, jiffie %ld \n",jiffies);
-		return -1;
-	};
-
-	if (!skb) {
-		DEBUG(1, " xmit skb=NULL, jiffie %ld \n",jiffies);
-		return -1;
-	};
-	
-//	if (test_and_set_bit( 0, (void *) &priv->tx_chain_active) ) {
-//		netif_start_queue (dev);
-//		return 1;
-//	}
-
-	dev->trans_start = jiffies;
-	retval = awc_802_11_tx_find_path_and_post(dev,skb);
-	priv->tx_chain_active = 0;
-//	wake_up_interruptible(&priv->tx_chain_wait_queue);	
-
-//	if (!dev->tbusy) dev_tint(dev);
-	return retval;
-}
-
-void awc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-	struct net_device *dev = dev_id;
-	struct awc_private *priv;
-	unsigned long flags;
-
-//	if ((dev == NULL)) return;
-
-	priv = (struct awc_private *)dev->priv;
-
-
-	
-
-	DEBUG(2, "%s: awc_interrupt \n",  dev->name);
-	spin_lock_irqsave(&priv->interrupt_spinlock, flags);	  
-
-	awc_interrupt_process(dev);
-
-	spin_unlock_irqrestore(&priv->interrupt_spinlock, flags);	  
-}
-
-
-
-/************************	STATS, MULTICAST & STUFF  ****************/
-
-
-
- struct net_device_stats *awc_get_stats(struct net_device *dev)
-{
-	struct awc_private *priv = (struct awc_private *)dev->priv;
-//        unsigned long flags;
-//	int cnt = 0;
-//	int unlocked_stats_in_interrupt=0;
-	
-	DEBUG(2, "%s: awc_get_stats \n",  dev->name);
-
-	if (!netif_running(dev)) {
-		return 0;			
-	}
-//	save_flags(flags);
-//	cli();
-	if (awc_full_stats)
-		awc_readrid_dir(dev, &priv->rid_dir[9]);
-//	restore_flags(flags);
-
-	// the very following is the very wrong very probably
-	if (awc_full_stats){
-		priv->stats.rx_bytes		= priv->statistics.HostRxBytes;
-		priv->stats.tx_bytes		= priv->statistics.HostTxBytes;
-		priv->stats.rx_fifo_errors 	= priv->statistics.RxOverrunErr ;
-		priv->stats.rx_crc_errors 	= priv->statistics.RxPlcpCrcErr + priv->statistics.RxMacCrcErr ;
-		priv->stats.rx_frame_errors 	= priv->statistics.RxPlcpFormat ;
-		priv->stats.rx_length_errors	=  priv->statistics.RxPlcpLength   ;
-		priv->stats.rx_missed_errors	= priv->statistics.RxAged ;
-		priv->stats.rx_over_errors	= priv->statistics.RxOverrunErr ;
-			
-		priv->stats.collisions 		= priv->statistics.TxSinColl;
-		priv->stats.tx_aborted_errors 	= priv->statistics.TxAged ;
-		priv->stats.tx_fifo_errors	= priv->statistics.HostTxFail ;
-		priv->stats.tx_window_errors 	= priv->statistics.TxMulColl  ;
-		priv->stats.tx_heartbeat_errors	= priv->statistics.DefersProt +priv->statistics.DefersEngy ;
-		priv->stats.tx_carrier_errors	= priv->statistics.RetryLong +priv->statistics.RetryShort  ;
-		priv->stats.multicast		= priv->statistics.HostRxMc;
-	}
-
-
-//	printk("rx_packets %d\n",priv->stats.rx_packets);
-	return &(priv->stats);
-}
-
-
-int awc_change_mtu(struct net_device *dev, int new_mtu){
-
-//	struct awc_private *priv = (struct awc_private *)dev->priv;
-        unsigned long flags;
-
-       if ((new_mtu < 256 ) || (new_mtu > 2312) || (max_mtu && new_mtu > max_mtu) )
-                return -EINVAL;
-
-	if (netif_running(dev)) {
-		printk("PLEASE, ifconfig %s down for mtu change\n",dev->name);
-
-	};
-	if (dev->mtu != new_mtu) {
-		save_flags(flags);
-		cli();
-		 netif_stop_queue(dev);
-		 awc_disable_MAC(dev);
-		restore_flags(flags); 
-				
-		awc_tx_dealloc(dev);
-		dev->mtu = new_mtu;
-		awc_tx_alloc(dev);
-		awc_enable_MAC(dev);
-		netif_start_queue(dev);
-
-		printk("%s mtu has been changed to %d \n ",dev->name,dev->mtu);
-
-	}
-
-	return 0;
-
-};
-
-
- void
-awc_set_multicast_list(struct net_device *dev) {
-//	int ioaddr = dev->base_addr;
-
-/*	if (dev->flags & IFF_PROMISC)
-		promisc
-	else if (dev->mc_count || (dev->flags & IFF_ALLMULTI))
-		allmulti
-	else
-		normal
-		*/
-
-
-}
-
-
-
-int (* awc_proc_set_fun) (int);
-int (* awc_proc_unset_fun) (int);
-
-
-int awc_register_proc(int (*awc_proc_set_device)(int),int (*awc_proc_unset_device)(int)){
-
-	AWC_ENTRY_EXIT_DEBUG("awc_register_proc");
-	awc_proc_set_fun 	= awc_proc_set_device;
-	awc_proc_unset_fun 	= awc_proc_unset_device;
-	AWC_ENTRY_EXIT_DEBUG("exit");
-	return 0;
-};
-
-int awc_unregister_proc(void){
-
-	AWC_ENTRY_EXIT_DEBUG("awc_unregister_proc");
-	
-	awc_proc_set_fun        = NULL;
-	awc_proc_unset_fun      = NULL;	                
-	AWC_ENTRY_EXIT_DEBUG("exit");
-	return 0;
-};
-
-static int aironet_core_init(void)
-{
-//	unsigned long flags;
-
-		
-	printk(KERN_INFO"%s", aironet4500_core_version);
-	return 0;
-	
-
-}
-
-static void aironet_core_exit(void)
-{
-	printk(KERN_INFO "aironet4500 unloading core module \n");
-
-}
-        
-module_init(aironet_core_init);
-module_exit(aironet_core_exit);
-
diff -Nru a/drivers/net/aironet4500_proc.c b/drivers/net/aironet4500_proc.c
--- a/drivers/net/aironet4500_proc.c	Sun Feb 23 22:25:22 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,719 +0,0 @@
-/*
- *	 Aironet 4500 /proc interface
- *
- *		Elmer Joandi, Januar 1999
- *	Copyright GPL
- *	
- *
- *	Revision 0.1 ,started  30.12.1998
- *
- *
- */
-#include <linux/config.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/module.h>
-#include <linux/if_arp.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
-#include <linux/kernel.h>
-#include <linux/version.h>
-#include <linux/skbuff.h>
-#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/in.h>
-
-#include <asm/io.h>
-#include <asm/system.h>
-#include <asm/bitops.h>
-
-#ifdef CONFIG_PROC_FS
-
-#include <linux/sysctl.h>
-#include <linux/fs.h>
-
-#include "aironet4500.h"
-#include "aironet4500_rid.c"
-
-
-#define AWC_STR_SIZE 	0x2ff0
-#define DEV_AWC_INFO 	1
-#define DEV_AWC 	1
-
-static spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
-
-struct awc_proc_private{
-	struct ctl_table_header *	sysctl_header;
-  	struct ctl_table	*	proc_table;
-  	struct ctl_table		proc_table_device_root[2];
-  	struct ctl_table		proc_table_sys_root[2];
-	char 				proc_name[10];
-};	        
-static char awc_drive_info[AWC_STR_SIZE]="Zcom \n\0";
-static char awc_proc_buff[AWC_STR_SIZE];
-static int  awc_int_buff;
-static struct awc_proc_private awc_proc_priv[MAX_AWCS]; 
-
-extern int awc_proc_unset_device(int device_number);
-
-int awc_proc_format_array(int write,char * buff, size_t * len, struct awc_rid_dir * rid_dir, struct aironet4500_RID * rid){
-
-  u8 * data = rid_dir->buff + rid->offset;
-  int pos = 0;
-  int null_past = 0;
-  int hex = ((rid->mask == 0xff) && (rid->value == 0x0 ));
-  int string = ((rid->mask == 0) && (rid->value == 0 ));
-  u32 val =0;
-  int bytes = (rid->bits / 8);
-  int ch =0;
-  int i,k;
-  int array_len = rid->array;
-  int nullX = 0;
-
- 
-  	AWC_ENTRY_EXIT_DEBUG("awc_proc_format_array");
-
-      if (rid->bits %8 ) bytes +=1;
-     
-     if (bytes > 4 && rid->array == 1){
-     	array_len = bytes;
-     	bytes = 1;
-     	hex = 1;
-     };
-     if (bytes < 1 || bytes > 4){
-     	printk(KERN_ERR " weird number of bytes %d in aironet rid \n",bytes);
-     	return -1;
-     };    	
-     DEBUG(0x20000,"awc proc array  bytes %d",bytes);
-     DEBUG(0x20000," hex %d",hex);
-     DEBUG(0x20000," string %d",string);
-
-     DEBUG(0x20000," array_len %d \n",array_len);
-     DEBUG(0x20000," offset %d \n",rid->offset);
-
-     if (!write){
-	for (i=0; i < array_len ; i++){
-	
-		if 	(bytes <= 1 ) val = data[i*bytes];
-		else if (bytes <= 2 ) val = *((u16 *)&data[i*bytes]);
-		else if (bytes <= 4 ) val = *((u32 *)&data[i*bytes]);
-		
-		if (rid->null_terminated && !val)
-			null_past =1;
-			 
-		if (hex && !string)
-			for (k=0; k <bytes; k++)
-				pos += sprintf(buff+pos, "%02x",(unsigned char ) data[i*bytes +k]);
-		else if (string)
-			pos += sprintf(buff+pos, "%c",val);
-		else	pos += sprintf(buff+pos, "%c",val);
-
-		DEBUG(0x20000, "awcproc %x %x \n",data[i], val);
-	};
-	
-     } else {
-     	for (i=0; i < array_len ; i++){
-     	
-     		DEBUG(0x20000, "awcproc %x %x \n",data[i], buff[i]);
-
-     		if (hex && ! string){
-     			
-     			val = 0;
-     			
-     			for (k=0; k < bytes; k++){
-     				val <<= 8;
-       				ch = *(buff + 2*i*bytes +k + nullX);
-     				if (ch >= '0' && ch <='9')
-     					ch -= '0';
-     				if (ch >= 'A' && ch <='F')
-     					ch -= 'A'+ 0xA;
-     				if (ch >= 'a' && ch <='f')
-     					ch -= 'a'+ 0xA;
-				val += ch <<4;
-				k++;
-				
-     				ch = *(buff + 2*i*bytes +k + nullX);
-     				if (val == 0 && (ch == 'X' || ch == 'x')){
-     					nullX=2;
-     					val = 0;
-     					k = -1;
-     					continue;
-     				};
-     				if (ch >= '0' && ch <='9')
-     					ch -= '0';
-     				if (ch >= 'A' && ch <='F')
-     					ch -= 'A'+ 0xA;
-     				if (ch >= 'a' && ch <='f')
-     					ch -= 'a'+ 0xA;
-     					
-     				val += ch;
-     				if (i*bytes > *len )
-     					val = 0;	
-     			}
-			if (rid->bits <=8 ) 	            data[i*bytes]  = val;
-			else if (rid->bits <=16 ) *((u16 *)&data[i*bytes]) = val;
-			else if (rid->bits <=32 ) *((u32 *)&data[i*bytes]) = val;
-     			if (!val) null_past=1;	
-     			
-     		} else {
-     			for (k=0; k < bytes; k++){
-     				data[i*bytes +k] = *(buff + i*bytes +k);
-     				if (i*bytes +k > *len || !data[i*bytes +k])
-     					null_past = 1;;
-     			}
-     	
-     		}
-     		if (null_past){
-     			if (rid->bits <=8 ) 	            data[i*bytes]  = 0;
-			else if (rid->bits <=16 ) *((u16 *)&data[i*bytes]) = 0;
-			else if (rid->bits <=32 ) *((u32 *)&data[i*bytes]) = 0;
-		}
-
-     	}
-     	
-     };
-     
-	
-//     *len = pos;
- 
-  	AWC_ENTRY_EXIT_DEBUG("awc_proc_format_array");
-     return 0;	
-};
-
-
-int awc_proc_format_bits(int write,u32 * buff, size_t* lenp, struct awc_rid_dir * rid_dir, struct aironet4500_RID * rid){
-
-  u8 * data = rid_dir->buff + rid->offset;
-  u32 val = 0;
-  int not_bool = 0;
- 
-  	AWC_ENTRY_EXIT_DEBUG("awc_proc_format_bits");
-
-	if ((rid->bits == 8 && rid->mask == 0xff) 	|| 
-	    (rid->bits == 16 && rid->mask == 0xffff) 	|| 
-	    (rid->bits == 32 && rid->mask == 0xffffffff)   )
-	    not_bool = 1;
-	    
-	if (rid->bits <=8 ) 		val = 		*data;
-	else if (rid->bits <=16 ) 	val = *((u16 *)data);
-	else if (rid->bits <=32 ) 	val = *((u32 *)data);
-
-	DEBUG(0x20000,"awc proc int enter data %x \n",val);
-	DEBUG(0x20000,"awc proc int enter buff %x \n",*buff);
-	DEBUG(0x20000,"awc proc int enter intbuff %x \n",awc_int_buff);
-	DEBUG(0x20000,"awc proc int enter lenp  %x \n",*lenp);
-
-
-
-	if (!write){
-		if (rid->mask)
-			val &= rid->mask;
-
-		if (!not_bool && rid->mask && 
-		    ((val & rid->mask) == (rid->value & rid->mask)))
-			*buff = 1;
-		else if (!not_bool) *buff = 0;
-		else *buff = val;
-	} else {
-		if (not_bool){
-			val &= ~rid->mask; 
-			val |= (*buff & rid->mask);
-		} else {
-			if (*buff){
-				val &= ~rid->mask;
-				if (rid->value)
-					val |= rid->mask & rid->value;
-				else 	val |= rid->mask & ~rid->value;
-			} else val &= ~rid->mask;
-		};
-		if (rid->bits == 8) *data = val & 0xff;
-		if (rid->bits == 16) *((u16*)data) = val &0xffff;
-		if (rid->bits == 32) *((u32*)data) = val &0xffffffff; 
-	
-	}
-	DEBUG(0x20000,"awc proc int buff %x \n",awc_int_buff);
-	if (rid->bits <=8 ) 		val = 		*data;
-	else if (rid->bits <=16 ) 	val = *((u16 *)data);
-	else if (rid->bits <=32 ) 	val = *((u32 *)data);
-
-	DEBUG(0x20000,"awc proc int data %x \n",val);
-	
-// both of them are crazy
-//	*lenp = sizeof(int);
-// 	*lenp += 1;
- 	
-  	AWC_ENTRY_EXIT_DEBUG("exit");
-	return 0;
-
-};
-
-int awc_proc_fun(ctl_table *ctl, int write, struct file * filp,
-                           void *buffer, size_t *lenp)
-{
-        int retv =-1;
-   	struct awc_private *priv = NULL;
-	unsigned long  flags;
-//	int device_number = (int ) ctl->extra1;
-
-	struct awc_rid_dir * rid_dir;
-
-	struct net_device * dev= NULL;
-	struct aironet4500_RID * rid = (struct aironet4500_RID * ) ctl->extra2;
-	
- 
-  	AWC_ENTRY_EXIT_DEBUG("awc_proc_fun");
-
-	if (!write && filp)
-	 if (filp->f_pos){
-//	 	printk(KERN_CRIT "Oversize read\n");
-		*lenp = 0;// hack against reading til eof
-	  	return	0;
-	 }
- 
-	MOD_INC_USE_COUNT;
-
-	rid_dir = ((struct awc_rid_dir *)ctl->extra1);
-	dev = rid_dir->dev;
-	
-	if (!dev){
-		printk(KERN_ERR " NO device here \n");
-		goto final;
-	}
-
-	if(ctl->procname == NULL || awc_drive_info == NULL ){
-		printk(KERN_WARNING " procname is NULL in sysctl_table or awc_mib_info is NULL \n at awc module\n ");
-		MOD_DEC_USE_COUNT;
-		return -1;
-	}
-	priv = (struct awc_private * ) dev->priv; 
-
-	if ((rid->selector->read_only || rid->read_only) && write){
-		printk(KERN_ERR "This value is read-only \n");
-		goto final;
-	};
-
-	if (!write && rid->selector->may_change) {
-		spin_lock_irqsave(&driver_lock, flags);
-		awc_readrid(dev,rid,rid_dir->buff + rid->offset);
-		spin_unlock_irqrestore(&driver_lock, flags);
-	};
-	
-	if (rid->array > 1 || rid->bits > 32){
-		if (write){
-        		retv = proc_dostring(ctl, write, filp, buffer, lenp);
-        		if (retv) goto final;
-			retv = awc_proc_format_array(write, awc_proc_buff, lenp, rid_dir, rid);
-			if (retv) goto final;
-		} else {
-			retv = awc_proc_format_array(write, awc_proc_buff, lenp, rid_dir, rid);
-			if (retv) goto final;
-        		retv = proc_dostring(ctl, write, filp, buffer, lenp);
-			if (retv) goto final;
-        	}
-        } else {
-        	if (write){
-        		retv = proc_dointvec(ctl, write, filp, buffer, lenp);        
-			if (retv) goto final;	
-			retv = awc_proc_format_bits(write, &awc_int_buff, lenp, rid_dir, rid);
-			if (retv) goto final;	
-		} else {
-			retv = awc_proc_format_bits(write, &awc_int_buff, lenp,rid_dir, rid);
-			if (retv) goto final;	
-        		retv = proc_dointvec(ctl, write, filp, buffer, lenp);        
-			if (retv) goto final;	
-		}
-        }
-	if (write) {
-		spin_lock_irqsave(&driver_lock, flags);
-		
-		if (rid->selector->MAC_Disable_at_write){
-			awc_disable_MAC(dev);
-		};
-		awc_writerid(dev,rid,rid_dir->buff + rid->offset);
-		if (rid->selector->MAC_Disable_at_write){
-			awc_enable_MAC(dev);
-		};
-		spin_lock_irqsave(&driver_lock, flags);
-	};
-
-       	DEBUG(0x20000,"awc proc ret  %x \n",retv);
-       	DEBUG(0x20000,"awc proc lenp  %x \n",*lenp);
- 
-	MOD_DEC_USE_COUNT;
-	return retv;
-  
-final:
- 
-  	AWC_ENTRY_EXIT_DEBUG("exit");
-	MOD_DEC_USE_COUNT;
-        return -1 ;
-}
-
-
-char  conf_reset_result[200];
-
-
-ctl_table awc_exdev_table[] = {
-	{
-	       .ctl_name	= 0,
-	       .maxlen		= 0,
-	       .mode		= 0400,
-       },
-	{ .ctl_name = 0 }
-};
-ctl_table awc_exroot_table[] = {
-	{
-		.ctl_name	= 254,
-		.procname	= "aironet4500",
-		.maxlen		= 0,
-		.mode		= 0555,
-	},
-	{ .ctl_name = 0 }
-};
-
-ctl_table awc_driver_proc_table[] = {
-	{
-		.ctl_name	= 1,
-		.procname	= "debug",
-		.data		= &awc_debug,
-		.maxlen		= sizeof(awc_debug),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.ctl_name	= 2,
-		.procname	= "bap_sleep",
-		.data		= &bap_sleep,
-		.maxlen		= sizeof(bap_sleep),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.ctl_name	= 3,
-		.procname	= "bap_sleep_after_setup",
-		.data		= &bap_sleep_after_setup,
-		.maxlen		= sizeof(bap_sleep_after_setup),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.ctl_name	= 4,
-		.procname	= "sleep_before_command",
-		.data		= &sleep_before_command,
-		.maxlen		= sizeof(sleep_before_command),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{ 
-		.ctl_name	= 5,
-		.procname	= "bap_sleep_before_write",
-		.data		= &bap_sleep_before_write,
-		.maxlen		= sizeof(bap_sleep_before_write),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.ctl_name	= 6,
-		.procname	= "sleep_in_command",
-		.data		= &sleep_in_command,
-		.maxlen		= sizeof(sleep_in_command),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.ctl_name	= 7,
-		.procname	= "both_bap_lock",
-		.data		= &both_bap_lock,
-		.maxlen		= sizeof(both_bap_lock),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec
-	},
-	{
-		.ctl_name	= 8,
-		.procname	= "bap_setup_spinlock",
-		.data		= &bap_setup_spinlock,
-		.maxlen		= sizeof(bap_setup_spinlock),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{ .ctl_name = 0 }
-};
-
-ctl_table awc_driver_level_ctable[] = {
-	{
-		.ctl_name	= 1,
-		.procname	= "force_rts_on_shorter",
-		.maxlen		= sizeof(int),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.ctl_name	= 2,
-		.procname	= "force_tx_rate",
-		.maxlen		= sizeof(int),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.ctl_name	= 3,
-		.procname	= "ip_tos_reliability_rts",
-		.maxlen		= sizeof(int),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.ctl_name	= 4,
-		.procname	= "ip_tos_troughput_no_retries",
-		.maxlen		= sizeof(int),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.ctl_name	= 5,
-		.procname	= "debug",
-		.maxlen		= sizeof(int),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.ctl_name	= 6,
-		.procname	= "simple_bridge",
-		.maxlen		= sizeof(int),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.ctl_name	= 7,
-		.procname	= "p802_11_send",
-		.maxlen		= sizeof(int),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.ctl_name	= 8,
-		.procname	= "full_stats",
-		.maxlen		= sizeof(int),
-		.mode		= 0600,
-		.proc_handler	= proc_dointvec,
-	},
-	{ .ctl_name = 0 }
-};
-
-ctl_table awc_root_table[] = {
-	{
-		.ctl_name	= 254,
-		.procname	= "aironet4500",
-		.maxlen		= 0,
-		.mode		= 0555,
-		.child		= awc_driver_proc_table,
-	},
-	{ .ctl_name = 0 }
-};
-
-struct ctl_table_header * awc_driver_sysctl_header;
-
-const char awc_procname[]= "awc5";
-
-
-int awc_proc_set_device(int device_number){
-  int group =0;
-  int rid = 0;
-  struct awc_private * priv;
-  ctl_table * tmp_table_ptr;
- 
-  AWC_ENTRY_EXIT_DEBUG("awc_proc_set_device");  
-  if (!aironet4500_devices[device_number] || (awc_nof_rids <=0 )) return -1 ;
-  priv = (struct awc_private * )aironet4500_devices[device_number]->priv;
-
-  awc_rids_setup(aironet4500_devices[device_number]);
-
-  memcpy(&(awc_proc_priv[device_number].proc_table_sys_root[0]), awc_exroot_table,sizeof(struct ctl_table)*2);
-  awc_proc_priv[device_number].proc_table_sys_root[0].ctl_name = 254 - device_number;
-  memcpy(awc_proc_priv[device_number].proc_table_device_root, awc_exdev_table,sizeof(awc_exdev_table) );
-  awc_proc_priv[device_number].proc_table_device_root[0].ctl_name = device_number+1;
-
-  awc_proc_priv[device_number].proc_table_sys_root->child = awc_proc_priv[device_number].proc_table_device_root;
-  memcpy(awc_proc_priv[device_number].proc_name,(struct NET_DEVICE * )aironet4500_devices[device_number]->name,5);
-  awc_proc_priv[device_number].proc_name[4]=0;
- // awc_proc_priv[device_number].proc_name[3]=48+device_number;
-  awc_proc_priv[device_number].proc_table_device_root[0].procname = &(awc_proc_priv[device_number].proc_name[0]);
-  awc_proc_priv[device_number].proc_table = kmalloc(sizeof(struct ctl_table) * (awc_nof_rids+2),GFP_KERNEL);
-  if (!awc_proc_priv[device_number].proc_table){
-   printk(KERN_CRIT "Out of memory on aironet4500_proc huge table alloc \n");
-   return -1;
-  }
-  awc_proc_priv[device_number].proc_table_device_root[0].child=awc_proc_priv[device_number].proc_table;
-  
-
- if (awc_debug) printk("device  %d of %d proc interface setup ",device_number, awc_nof_rids);
-
-
-  while (awc_rids[group].selector && group < awc_nof_rids){
-     	if (awc_debug & 0x20000)
-     		printk(KERN_CRIT "ridgroup %s  size %d \n", awc_rids[group].selector->name,awc_rids[group].size);
-
-  	awc_proc_priv[device_number].proc_table[group].ctl_name = group +1;
-  	awc_proc_priv[device_number].proc_table[group+1].ctl_name = 0;
-  	awc_proc_priv[device_number].proc_table[group].procname = awc_rids[group].selector->name;
-  	awc_proc_priv[device_number].proc_table[group].data	= awc_proc_buff;
-  	awc_proc_priv[device_number].proc_table[group].maxlen  = sizeof(awc_proc_buff) -1;
-  	awc_proc_priv[device_number].proc_table[group].mode	= 0600;
-  	awc_proc_priv[device_number].proc_table[group].child	= kmalloc(sizeof(struct ctl_table) * (awc_rids[group].size +2), GFP_KERNEL);
-  	awc_proc_priv[device_number].proc_table[group].proc_handler = NULL;
-  	awc_proc_priv[device_number].proc_table[group].strategy = NULL;
-  	awc_proc_priv[device_number].proc_table[group].de	= NULL;
-  	awc_proc_priv[device_number].proc_table[group].extra1	= NULL;
-  	awc_proc_priv[device_number].proc_table[group].extra2	= NULL;
-  	if (!awc_proc_priv[device_number].proc_table[group].child) {
-  		awc_proc_priv[device_number].proc_table[group].ctl_name = 0;
-   		printk(KERN_CRIT "Out of memory on aironet4500_proc huge table alloc \n");
-  		return 0;
-  	}
-  	rid=0;
-  	while (awc_rids[group].rids[rid].selector && (rid < awc_rids[group].size -1)){
-
-//  	   	DEBUG(0x20000,"rid %s  \n", awc_rids[group].rids[rid].name);
-
-	  	awc_proc_priv[device_number].proc_table[group].child[rid].ctl_name 	= rid +1;
-	  	awc_proc_priv[device_number].proc_table[group].child[rid+1].ctl_name 	= 0;
-	  	awc_proc_priv[device_number].proc_table[group].child[rid].procname 	= awc_rids[group].rids[rid].name;
-	  	if (awc_rids[group].rids[rid].array > 1 ||
-	  	    awc_rids[group].rids[rid].bits  > 32 ){
-	  		awc_proc_priv[device_number].proc_table[group].child[rid].data		= awc_proc_buff;
-	  		awc_proc_priv[device_number].proc_table[group].child[rid].maxlen  	= sizeof(awc_proc_buff) -1;		
-	  	} else {
-	  	 	awc_proc_priv[device_number].proc_table[group].child[rid].data		= &awc_int_buff;
-	  		awc_proc_priv[device_number].proc_table[group].child[rid].maxlen  	= sizeof(awc_int_buff);
-	  
-	  	}
-	  		if ( awc_rids[group].rids[rid].read_only ||
-	  	     awc_rids[group].rids[rid].selector->read_only )
-	  		awc_proc_priv[device_number].proc_table[group].child[rid].mode		= 0400;
-	  	else
-	  		awc_proc_priv[device_number].proc_table[group].child[rid].mode          = 0600;
-	  	awc_proc_priv[device_number].proc_table[group].child[rid].child		= NULL;
-	  	awc_proc_priv[device_number].proc_table[group].child[rid].proc_handler 	= awc_proc_fun;
-	  	awc_proc_priv[device_number].proc_table[group].child[rid].strategy 	= NULL;
-	  	awc_proc_priv[device_number].proc_table[group].child[rid].de		= NULL;
-	  	awc_proc_priv[device_number].proc_table[group].child[rid].extra1	= (void *) &(((struct awc_private* )aironet4500_devices[device_number]->priv)->rid_dir[group]);
-	  	awc_proc_priv[device_number].proc_table[group].child[rid].extra2	= (void *) &(awc_rids[group].rids[rid]);
-
-  		rid++;	
-  	}
-  	
-  	group++;
-
-  };
-// here are driver-level params dir  
-  	awc_proc_priv[device_number].proc_table[group].ctl_name = group +1;
-  	awc_proc_priv[device_number].proc_table[group+1].ctl_name = 0;
-  	awc_proc_priv[device_number].proc_table[group].procname = "driver-level";
-  	awc_proc_priv[device_number].proc_table[group].data	= awc_proc_buff;
-  	awc_proc_priv[device_number].proc_table[group].maxlen  = sizeof(awc_proc_buff) -1;
-  	awc_proc_priv[device_number].proc_table[group].mode	= 0600;
-  	awc_proc_priv[device_number].proc_table[group].child	= kmalloc(sizeof(awc_driver_level_ctable) , GFP_KERNEL);
-  	awc_proc_priv[device_number].proc_table[group].proc_handler = NULL;
-  	awc_proc_priv[device_number].proc_table[group].strategy = NULL;
-  	awc_proc_priv[device_number].proc_table[group].de	= NULL;
-  	awc_proc_priv[device_number].proc_table[group].extra1	= NULL;
-  	awc_proc_priv[device_number].proc_table[group].extra2	= NULL;
-  	if (!awc_proc_priv[device_number].proc_table[group].child) {
-  		awc_proc_priv[device_number].proc_table[group].ctl_name = 0;
-   		printk(KERN_CRIT "Out of memory on aironet4500_proc huge table alloc \n");
-  		return 0;
-  	}
-
-	
-	tmp_table_ptr = awc_proc_priv[device_number].proc_table[group].child;
-	memcpy(tmp_table_ptr,awc_driver_level_ctable,sizeof(awc_driver_level_ctable));
-
-
-        tmp_table_ptr[0].data = 
-         &(priv->force_rts_on_shorter);
-        tmp_table_ptr[1].data =   &priv->force_tx_rate;
-        tmp_table_ptr[2].data = (void *) &priv->ip_tos_reliability_rts;
-        tmp_table_ptr[3].data = (void *) &priv->ip_tos_troughput_no_retries;
-        tmp_table_ptr[4].data = (void *) &priv->debug;
-        tmp_table_ptr[5].data = (void *) &priv->simple_bridge;
-        tmp_table_ptr[6].data = (void *) &priv->p802_11_send;
-        tmp_table_ptr[7].data = (void *) &priv->full_stats;
-
-
-	awc_proc_priv[device_number].sysctl_header = 
-		register_sysctl_table(awc_proc_priv[device_number].proc_table_sys_root,0);
- 
-	AWC_ENTRY_EXIT_DEBUG("exit");
-
-	if (awc_proc_priv[device_number].sysctl_header)
-		return 0;
-	return 1;  
-
-};
-
-int awc_proc_unset_device(int device_number){
-  int k;
-
- AWC_ENTRY_EXIT_DEBUG("awc_proc_unset_device");
-  if (awc_proc_priv[device_number].sysctl_header){
-  	unregister_sysctl_table(awc_proc_priv[device_number].sysctl_header);
-	awc_proc_priv[device_number].sysctl_header = NULL;
-  }
-  if (awc_proc_priv[device_number].proc_table){
-	  for (k=0; awc_proc_priv[device_number].proc_table[k].ctl_name ; k++ ){
-	  	if (awc_proc_priv[device_number].proc_table[k].child)
-	  		kfree(awc_proc_priv[device_number].proc_table[k].child);
-	  }
-	  kfree(awc_proc_priv[device_number].proc_table);
-	  awc_proc_priv[device_number].proc_table = NULL;
-  }
-  if (awc_proc_priv[device_number].proc_table_device_root[0].ctl_name)
-          awc_proc_priv[device_number].proc_table_device_root[0].ctl_name = 0;
-  if (awc_proc_priv[device_number].proc_table_sys_root[0].ctl_name)
-          awc_proc_priv[device_number].proc_table_sys_root[0].ctl_name = 0;
-  
-	AWC_ENTRY_EXIT_DEBUG("exit");
-   return 0;
-};
-
-static int aironet_proc_init(void) {
-	int i=0;
-
-	AWC_ENTRY_EXIT_DEBUG("init_module");
-
-
-	for (i=0; i < MAX_AWCS;  i++){
-		awc_proc_set_device(i);
-	}
-
-	awc_register_proc(awc_proc_set_device, awc_proc_unset_device);
-
-	awc_driver_sysctl_header = register_sysctl_table(awc_root_table,0);
-
-	AWC_ENTRY_EXIT_DEBUG("exit");
-	return 0;
-
-};
-
-static void aironet_proc_exit(void){
-
-	int i=0;
-	AWC_ENTRY_EXIT_DEBUG("cleanup_module");
-	awc_unregister_proc();
-	for (i=0; i < MAX_AWCS;  i++){
-		awc_proc_unset_device(i);
-	}
-	if (awc_driver_sysctl_header)
-		unregister_sysctl_table(awc_driver_sysctl_header);
-	AWC_ENTRY_EXIT_DEBUG("exit");
-};
-
-module_init(aironet_proc_init);
-module_exit(aironet_proc_exit);
-
-#else
-#error awc driver needs CONFIG_PROC_FS
-
-#endif // whole proc system styff
-MODULE_LICENSE("GPL");
diff -Nru a/drivers/net/aironet4500_rid.c b/drivers/net/aironet4500_rid.c
--- a/drivers/net/aironet4500_rid.c	Sun Feb 23 22:25:23 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,2205 +0,0 @@
-/*
- *	 Aironet 4500 Pcmcia driver
- *
- *		Elmer Joandi, Januar 1999
- *	Copyright Elmer Joandi, all rights restricted
- *	
- *
- *	Revision 0.1 ,started  30.12.1998
- *
- *
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-
-#include "aironet4500.h"
-
-
-
-#define awc_RID_gen_RidLen 				{(const struct aironet4500_rid_selector *)&aironet4500_RID_Select_General_Config,0x0000, 8,1,1,1,0, 0xffffffff,0x0000, "Length of RID" }
-#define awc_RID_gen_OperatingMode_adhoc 		{&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000003,0x0000,"Opmode IBSS Adhoc operation" } // Without AP
-#define awc_RID_gen_OperatingMode_Infrastructure 	{&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000003,0x0001,"Opmode Infrastructure Station operation" }// With AP
-#define awc_RID_gen_OperatingMode_AP			{&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000003,0x0002,"Opmode Access Point" } // Aironet doesn't release info on use 
-#define awc_RID_gen_OperatingMode_AP_and_repeater 	{&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000003,0x0003,"Opmode Access Point and Repeater" } // no info
-#define awc_RID_gen_OperatingMode_No_payload_modify	{&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000100,0x0100,"Opmode Payload without modify" } 
-#define awc_RID_gen_OperatingMode_LLC_802_3_convert	{&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000100,0x0000,"Opmode LLC -> 802.3 convert" }
-#define awc_RID_gen_OperatingMode_proprietary_ext 	{&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000200,0x0200,"Opmode Aironet Extentsions enabled" } // neened for 11Mbps
-#define awc_RID_gen_OperatingMode_no_proprietary_ext 	{&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0,0x00000200,0x0000,"Opmode Aironet Extentsions disabled" }
-#define awc_RID_gen_OperatingMode_AP_ext 		{&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000400,0x0400,"Opmode AP Extentsions enabled" }	// no info
-#define awc_RID_gen_OperatingMode_no_AP_ext	 	{&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000400,0x0000,"Opmode AP Extentsions disabled" }
-#define awc_RID_gen_ReceiveMode 			{&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000ffff,0x0000,"RX Mode"}
-#define awc_RID_gen_ReceiveMode_BMA 			{&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0000,"RX Mode BC MC ADDR"}
-#define awc_RID_gen_ReceiveMode_BA 			{&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0001,"RX Mode BC ADDR"}
-#define awc_RID_gen_ReceiveMode_A 			{&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0002,"RX Mode ADDR"}
-#define awc_RID_gen_ReceiveMode_802_11_monitor		{&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0003,"RX Mode 802.11 Monitor current BSSID"}
-#define awc_RID_gen_ReceiveMode_802_11_any_monitor 	{&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0004,"RX Mode 802.11 Monitor any BSSID"}
-#define awc_RID_gen_ReceiveMode_LAN_monitor 		{&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0005,"RX Mode LAN Monitor current BSSID"}
-#define awc_RID_gen_ReceiveMode_802_3_hdr_disable 	{&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x00000100,0x0100,"RX Mode Disable RX 802.3 Header"}
-#define awc_RID_gen_ReceiveMode_802_3_hdr_enable 	{&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x00000100,0x0000,"RX Mode Enable RX 802.3 header"}
-#define awc_RID_gen_Fragmentation_threshold		{&aironet4500_RID_Select_General_Config,0x0006,16,1,1,0,0,0x0000ffff,0x0000,"Fragmentation Threshold"}		// treshold of packet size starting to be fragmented
-#define awc_RID_gen_RTS_threshold 			{&aironet4500_RID_Select_General_Config,0x0008,16,1,1,0,0,0xffff,0x0000,"RTS Threshold"}	// packet size, larger ones get sent with RTS/CTS
-#define awc_RID_gen_Station_Mac_Id 			{&aironet4500_RID_Select_General_Config,0x000A, 8,6,1,0,0,0xff,0,"Station MAC Id"}
-#define awc_RID_gen_Supported_rates 			{&aironet4500_RID_Select_General_Config,0x0010, 8,8,1,0,1,0xff,0x00,"Supported Rates"}	// Hex encoded 500kbps 
-#define awc_RID_gen_Basic_Rate 				{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x80,0x80,"Basic Rate"}	// if 0x80 bit is set
-#define awc_RID_gen_Rate_500kbps 			{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x01,"Rate 500kbps"}
-#define awc_RID_gen_Rate_1Mbps 				{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x02,"Rate 1Mbps"}
-#define awc_RID_gen_Rate_2Mbps 				{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x04,"Rate 2Mbps"}
-#define awc_RID_gen_Rate_4Mbps 				{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x08,"Rate 4Mbps"}
-#define awc_RID_gen_Rate_5Mbps 				{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x0B,"Rate 5.5Mbps"}
-#define awc_RID_gen_Rate_10Mbps 			{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x14,"Rate 10Mbps"}
-#define awc_RID_gen_Rate_11Mbps 			{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x16,"Rate 11Mbps"}
-#define awc_RID_gen_BasicRate_500kbps 			{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x81,"BasicRate 500kbps"}
-#define awc_RID_gen_BasicRate_1Mbps 				{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x82,"BasicRate 1Mbps"}
-#define awc_RID_gen_BasicRate_2Mbps 				{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x84,"BasicRate 2Mbps"}
-#define awc_RID_gen_BasicRate_4Mbps 				{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x88,"BasicRate 4Mbps"}
-#define awc_RID_gen_BasicRate_5Mbps 				{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x8B,"BasicRate 5.5Mbps"}
-#define awc_RID_gen_BasicRate_10Mbps 			{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x94,"BasicRate 10Mbps"}
-#define awc_RID_gen_BasicRate_11Mbps 			{&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x96,"BasicRate 11Mbps"}
-
-
-#define awc_RID_gen_Long_retry_limit 			{&aironet4500_RID_Select_General_Config,0x0018,16, 1,1,0,0,0xffff,0,"Short Retry Limit"}
-#define awc_RID_gen_Short_retry_limit 			{&aironet4500_RID_Select_General_Config,0x001A,16, 1,1,0,0,0xffff,0,"Long Retry Limit"}
-#define awc_RID_gen_Tx_MSDU_lifetime 			{&aironet4500_RID_Select_General_Config,0x001C,16, 1,1000,0,0,0xffff,0,"TX MSDU Lifetime"}
-#define awc_RID_gen_Rx_MSDU_lifetime 			{&aironet4500_RID_Select_General_Config,0x001E,16, 1,1000,0,0,0xffff,0,"RX MSDU Lifetime"}
-#define awc_RID_gen_Stationary 				{&aironet4500_RID_Select_General_Config,0x0020,16, 1,1,0,0,0xffff,0,"Stationary"}
-#define awc_RID_gen_BC_MC_Ordering 			{&aironet4500_RID_Select_General_Config,0x0022,16, 1,1,0,0,0xffff,0,"Strictly order Bcast and Mcast"}
-#define awc_RID_gen_Device_type 			{&aironet4500_RID_Select_General_Config,0x0024,16, 1,1,1,0,0xffff,0x00,"Radio Type"}
-#define awc_RID_gen_Reserved_0x0026 			{&aironet4500_RID_Select_General_Config,0x0026, 8,10,1,0,0,0xff,0,"Reserved0x28"}
-
-
-//SCANNING/ASSOCIATING
-#define awc_RID_gen_ScanMode				awc_def_gen_RID(0x0030,"ScanMode",		16,0xf,0, NULL)
-#define awc_RID_gen_ScanMode_Active 			awc_def_gen_RID(0x0030,"ScanMode Active",		16,0xf,0, "Active")
-#define awc_RID_gen_ScanMode_Passive 			awc_def_gen_RID(0x0030,"ScanMode Passive",		16,0xf,1, "Passive")
-#define awc_RID_gen_ScanMode_Aironet_ext		awc_def_gen_RID(0x0030,"ScanMode Aironet Ext",		16,0xf,2, "Aironet Ext")
-#define awc_RID_gen_ProbeDelay 				awc_def_gen_RID(0x0032,"ProbeDelay",		16,0xffff,0," msek") 		//                 Time ms to wait after switching to a channel for clear channel assessment.
-#define awc_RID_gen_ProbeEnergyTimeout 			awc_def_gen_RID(0x0034,"ProbeEnergyTimeout",	16,0xffff,0,"msek") 	//          Time to wait for energy after an active probe.
-#define awc_RID_gen_ProbeResponseTimeout		awc_def_gen_RID(0x0036,"ProbeResponseTimeout",	16,0xffff,0,"msek") 	// Time to wait for a probe response after energy detected.
-#define awc_RID_gen_BeaconListenTimeout 		awc_def_gen_RID(0x0038,"BeaconListenTimeout",	16,0xffff,0,"msek")	//    0 default    40          Time to listen for a beacon on each channel.
-#define awc_RID_gen_IbssJoinNetTimeout 			awc_def_gen_RID(0x003A,"IbssJoinNetTimeout",	16,0xffff,0,"msek")	//       0 default    10000       IBSS: Time to scan for an IBSS before forming a
-#define awc_RID_gen_AuthenticationTimeout 		awc_def_gen_RID(0x003C,"AuthenticationTimeout",16,0xffff,0,"msek")	//       0 default    2000        Time limit after which an authentication sequence will
-#define awc_RID_gen_AuthenticationType 			awc_def_gen_RID(0x003E,"AuthenticationType",	16,0xffff,0,NULL)	//       0 default    1 (open) //    Selects the desired authentication and privacy methods.		 
-#define awc_RID_gen_AuthenticationType_None 		awc_def_gen_RID(0x003E,"AuthenticationType None",	16,0xffff,0,"None") 	//   0x00 = None	
-#define awc_RID_gen_AuthenticationType_Open		awc_def_gen_RID(0x003E,"AuthenticationType Open",	16,0xffff,1,"Open") 	//             0x01 = Open
-#define awc_RID_gen_AuthenticationType_Shared		awc_def_gen_RID(0x003E,"AuthenticationType Shared-Key",	16,0xffff,2,"Shared-Key")  	//     0x02 = Shared-Key
-#define awc_RID_gen_AuthenticationType_Exclude_Open 	awc_def_gen_RID(0x003E,"AuthenticationType Exclude Open",	16,0xffff,4,"Exclude Open")   	//              0x04 = Exclude Unencrypted
-#define awc_RID_gen_AssociationTimeout 			awc_def_gen_RID(0x0040,"AssociationTimeout",	16,0xffff,0,"msek")	//       0 default    2000        ESS: Time limit after which an association sequence
-#define awc_RID_gen_SpecifiedAPtimeout 			awc_def_gen_RID(0x0042,"SpecifiedAPtimeout",	16,0xffff,0,"msek")	//       0 default    10000       0 selects the factory default [~10 sec].
-#define awc_RID_gen_OfflineScanInterval 		awc_def_gen_RID(0x0044,"OfflineScanInterval",	16,0xffff,0,"msek")	//       0            0           0 disables offline scanning.(kus)        The time period between offline scans.
-#define awc_RID_gen_OfflineScanDuration 		awc_def_gen_RID(0x0046,"OfflineScanDuration",	16,0xffff,0,"msek")	//       0            0           0 disables offline scanning. //    (kus)        The duration of an offline scan.
-#define awc_RID_gen_LinkLossDelay 			awc_def_gen_RID(0x0048,"LinkLossDelay",	16,0xffff,0,"msek")	//       0  0 Time to delay before reporting a loss of association
-#define awc_RID_gen_MaxBeaconLostTime 			awc_def_gen_RID(0x004A,"MaxBeaconLostTime",	16,0xffff,0,"msek")	//      0 default    500        If no beacons are received for this time period, the unit
-#define awc_RID_gen_RefreshInterval 			awc_def_gen_RID(0x004C,"RefreshInterval",	16,0xffff,0,"msek")		//      0 default    10000      At the specified interval, the station will send a refresh
-//POWER SAVE OPERATION
-#define awc_RID_gen_PowerSaveMode 			awc_def_gen_RID(0x0050,"PowerSaveMode",	16,0xffff,0,NULL) 		//      0  0Note, for IBSS there is only one PSP mode and it is only enabled if the ATIMwindow is non-zero.
-#define awc_RID_gen_PowerSaveMode_CAM 		awc_def_gen_RID(0x0050,"PowerSaveMode CAM",	16,0x000f,0,"CAM") 	// 0 = CAM
-#define awc_RID_gen_PowerSaveMode_PSP 		awc_def_gen_RID(0x0050,"PowerSaveMode PSP",	16,0x000f,1,"PSP") 	// 1 = PSP
-#define awc_RID_gen_PowerSaveMode_Fast_PSP		awc_def_gen_RID(0x0050,"PowerSaveMode Fast PSP",	16,0x000f,2,"Fast PSP")	//2 = PSP-CAM [FASTPSP]
-#define awc_RID_gen_SleepForDTIMs 			awc_def_gen_RID(0x0052,"SleepForDTIMs",	16,0xffff,0,"DTIMs")	//      0  0If non-zero, the station may sleep through DTIMs; this
-#define awc_RID_gen_ListenInterval 			awc_def_gen_RID(0x0054,"ListenInterval",	16,0xffff,0,"msek")		//      0 default    200 kus    Maximum time to awaken for TIMs. 0 selects factory
-#define awc_RID_gen_FastListenInterval 		awc_def_gen_RID(0x0056,"FastListenInterval",	16,0xffff,0,"msek")     // 0 default    100 kus    The listen interval to be used immediately after
-#define awc_RID_gen_ListenDecay 			awc_def_gen_RID(0x0058,"ListenDecay",		16,0xffff,0,"times")	//      0 default    2Number of times to use the current listen interval
-#define awc_RID_gen_FastListenDelay 		awc_def_gen_RID(0x005A,"FastListenDelay",	16,0xffff,0,"msek")	//      0 default    200 kus    Time interval to delay before going to fast listen
-#define awc_RID_gen_Reserved0x005C 			awc_def_gen_RID(0x005C,"Reserved0x005C",	32,0xffffffff,0,"")	//
-//ADHOC (or AP) OPERATION
-#define awc_RID_gen_BeaconPeriod 			awc_def_gen_RID(0x0060,"BeaconPeriod",		16,0xffff,0,"msek")	//      0 default    100        0 selects the factory default of [~100 ms].  (kus)
-#define awc_RID_gen_AtimDuration 			awc_def_gen_RID(0x0062,"AtimDuration",		16,0xffff,0,"msek")	//      0 default    5 kus      The time period reserved for ATIMs immediately after (kus)      the beacon. 0xFFFF will disable the ATIM window; power save mode will not operate.This parameter only applies to adhoc/IBSS.
-#define awc_RID_gen_Reserved0x0064 			awc_def_gen_RID(0x0064,"Reserved64",		16,0xffff,0,"")	//      0  0Reserved for future use
-#define awc_RID_gen_DSChannel 			awc_def_gen_RID(0x0066,"DSChannel",		16,0xffff,0,"")	//      0 default    1The desired operating channel.  ()refer to 802.11)       For North America, a Channel of 0 is 2412 MHz.
-#define awc_RID_gen_Reserved0x0068 			awc_def_gen_RID(0x0068,"Reserved68",		16,0xffff,0,"")	//      0  0Reserved for future use
-#define awc_RID_gen_DTIM_Period 			awc_def_gen_RID(0x006A,"DTIM Period",		16,0xffff,0,"")	//      0 default    1Selects how often a beacon is a DTIM for APs
-#define awc_RID_gen_Reserved0x0006C 		awc_def_gen_RID(0x006C,"Reserved6C",		32,0xffffffff,0,"")	//    0's0's        Reserved for future use
-//RADIO OPERATION
-#define awc_RID_gen_RadioSpreadType 		awc_def_gen_RID(0x0070,"RadioSpreadType",	16,0xffff,0,NULL)	//      0 default    0Selects the radio operational mode. By default, this will
-#define awc_RID_gen_RadioSpreadType_FH 		awc_def_gen_RID(0x0070,"RadioSpreadType FH",	16,0xffff,0,"FH")	//0 = 802.11 FH Radio (Default)
-#define awc_RID_gen_RadioSpreadType_DS 		awc_def_gen_RID(0x0070,"RadioSpreadType DS",	16,0xffff,1,"DS")	//1 = 802.11 DS Radio
-#define awc_RID_gen_RadioSpreadType_LM 		awc_def_gen_RID(0x0070,"RadioSpreadType LM2000",	16,0xffff,2,"LM2000")	//2 = LM2000 (Legacy) DS Radio
-#define awc_RID_gen_TX_antenna_Diversity 		awc_def_gen_RID(0x0072,"TX antenna Diversity",	16,0xff00,0,NULL)	//       0 default    0x0303    This field is bit-mapped to select the operational
-#define awc_RID_gen_TX_antenna_Diversity_default	awc_def_gen_RID(0x0072,"TX antenna Diversity Default",	16,0xff00,0x0000,"Default")	//  0 = Diversity as programmed at the factory
-#define awc_RID_gen_TX_antenna_Diversity_1 		awc_def_gen_RID(0x0072,"TX antenna Diversity Antenna 1",	16,0xff00,0x0100,"Antenna 1")	//  1 = Antenna 1 only
-#define awc_RID_gen_TX_antenna_Diversity_2 		awc_def_gen_RID(0x0072,"TX antenna Diversity Antenna 2",	16,0xff00,0x0200,"Antenna 2")	//  2 = Antenna 2 only
-#define awc_RID_gen_TX_antenna_Diversity_both 	awc_def_gen_RID(0x0072,"TX antenna Diversity both antennas",	16,0xff00,0x0300,"both antennas")	//  3 = Antennas 1 and 2 are active
-#define awc_RID_gen_RX_antenna_Diversity		awc_def_gen_RID(0x0072,"RX antenna Diversity",	16,0x00ff,0,NULL)	//       0 default    0x0303    This field is bit-mapped to select the operational
-#define awc_RID_gen_RX_antenna_Diversity_default	awc_def_gen_RID(0x0072,"RX antenna Diversity Default",	16,0x00ff,0,"Default")	//  0 = Diversity as programmed at the factory
-#define awc_RID_gen_RX_antenna_Diversity_1		awc_def_gen_RID(0x0072,"RX antenna Diversity Antenna 1",	16,0x00ff,1,"Antenna 1")	//  1 = Antenna 1 only
-#define awc_RID_gen_RX_antenna_Diversity_2 		awc_def_gen_RID(0x0072,"RX antenna Diversity Antenna 2",	16,0x00ff,2,"Antenna 2")	//  2 = Antenna 2 only
-#define awc_RID_gen_RX_antenna_Diversity_both	awc_def_gen_RID(0x0072,"RX antenna Diversity both antennas",	16,0x00ff,3,"both antennas")	//
-#define awc_RID_gen_TransmitPower 			awc_def_gen_RID(0x0074,"TransmitPower",	16,0xffff,0,"mW (rounded up, btw)")	//       0 default    250 or    0 selects the default (maximum power allowed for the
-#define awc_RID_gen_RSSIthreshold 			awc_def_gen_RID(0x0076,"RSSIthreshold",	16,0xffff,0,"units")	//       0 default    0         RSSI threshold. 0 selects factory default.
-#define awc_RID_gen_Modulation 				awc_def_gen_RID(0x0078,"Modulation",	8,0xff,0,"")	//     modulation type
-#define awc_RID_gen_Reserved0x0079 			awc_def_gen_RID(0x0079,"Reserved0x0079",	56,0xff,0,"")	//     0's0's       reserved for future radio specific parameters
-
-
-//AIRONET EXTENSIONS
-#define awc_RID_gen_NodeName 			awc_def_gen_RID(0x0080,"NodeName",		128,0,0,"")	//    0  0         Station name.
-#define awc_RID_gen_ARLThreshold 			awc_def_gen_RID(0x0090,"ARLThreshold",		16,0xffff,0,"times")	//       0 default    0xFFFF    0 selects the factory defaults. (which for now is
-#define awc_RID_gen_ARLDecay 			awc_def_gen_RID(0x0092,"ARLDecay",		16,0xffff,0,"times")	//       0 default    0xFFFF    0 selects the factory defaults. (which for now is
-#define awc_RID_gen_ARLDelay 			awc_def_gen_RID(0x0094,"ARLDelay",		16,0xffff,0,"times")	//       0 default    0xFFFF    0 selects the factory defaults. (which for now is
-#define awc_RID_gen_Unused0x0096 			awc_def_gen_RID(0x0096,"Reserved0x96",		16,0xffff,0,"")	//
-#define awc_RID_gen_MagicPacketAction 		awc_def_gen_RID(0x0098,"MagicPacketAction",	8,0xff,0," hell knows what")	//        0  0         0 selects no action to be taken on a magic packet and"
-#define awc_RID_gen_MagicPacketControl 		awc_def_gen_RID(0x0099,"MagicPacketControl",	8,0xff,0," hell know what")	//        0  0         0 will disable the magic packet mode command"
-
-
-#define awc_RID_act_RidLen 				{&aironet4500_RID_Select_Active_Config,0x0000, 8,1,1,1,0, 0xffffffff,0x0000, "Length of RID" }
-#define awc_RID_act_OperatingMode_adhoc 		{&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000003,0x0000,"Opmode IBSS Adhoc operation" }
-#define awc_RID_act_OperatingMode_Infrastructure 	{&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000003,0x0001,"Opmode Infrastructure Station operation" }
-#define awc_RID_act_OperatingMode_AP		{&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000003,0x0002,"Opmode Access Point" }
-#define awc_RID_act_OperatingMode_AP_and_repeater 	{&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000003,0x0003,"Opmode Access Point and Repeater" }
-#define awc_RID_act_OperatingMode_No_payload_modify	{&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000100,0x0100,"Opmode Payload without modify" }
-#define awc_RID_act_OperatingMode_LLC_802_3_convert	{&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000100,0x0000,"Opmode LLC -> 802.3 convert" }
-#define awc_RID_act_OperatingMode_proprietary_ext 	{&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000200,0x0200,"Opmode Aironet Extentsions enabled" }
-#define awc_RID_act_OperatingMode_no_proprietary_ext {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0,0x00000200,0x0000,"Opmode Aironet Extentsions disabled" }
-#define awc_RID_act_OperatingMode_AP_ext 		{&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000400,0x0400,"Opmode AP Extentsions enabled" }
-#define awc_RID_act_OperatingMode_no_AP_ext	 	{&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000400,0x0000,"Opmode AP Extentsions disabled" }
-#define awc_RID_act_ReceiveMode 			{&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0xffffffff,0x0000,"RX Mode"}
-#define awc_RID_act_ReceiveMode_BMA 		{&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0000,"RX Mode BC MC ADDR"}
-#define awc_RID_act_ReceiveMode_BA 			{&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0001,"RX Mode BC ADDR"}
-#define awc_RID_act_ReceiveMode_A 			{&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0002,"RX Mode ADDR"}
-#define awc_RID_act_ReceiveMode_802_11_monitor	{&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0003,"RX Mode 802.11 Monitor current BSSID"}
-#define awc_RID_act_ReceiveMode_802_11_any_monitor 	{&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0004,"RX Mode 802.11 Monitor any BSSID"}
-#define awc_RID_act_ReceiveMode_LAN_monitor 	{&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0005,"RX Mode LAN Monitor current BSSID"}
-#define awc_RID_act_ReceiveMode_802_3_hdr_disable 	{&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x00000100,0x0100,"RX Mode Disable RX 802.3 Header"}
-#define awc_RID_act_ReceiveMode_802_3_hdr_enable 	{&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x00000100,0x0000,"RX Mode Enable RX 802.3 header"}
-#define awc_RID_act_Fragmentation_threshold		{&aironet4500_RID_Select_Active_Config,0x0006,16,1,1,0,0,0x0000ffff,0x0000,"Fragmentation Threshold"}
-#define awc_RID_act_RTS_threshold 			{&aironet4500_RID_Select_Active_Config,0x0008,16,1,1,0,0,0xffff,0x0000,"RTS Threshold"}
-#define awc_RID_act_Station_Mac_Id 			{&aironet4500_RID_Select_Active_Config,0x000A, 8,6,1,0,0,0xff,0,"Station MAC Id"}
-#define awc_RID_act_Supported_rates 			{&aironet4500_RID_Select_Active_Config,0x0010, 8,8,1,0,1,0xff,0x00,"Supported Rates"}
-#define awc_RID_act_Basic_Rate 				{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x80,0x80,"Basic Rate"}
-#define awc_RID_act_Rate_500kbps 			{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x01,"Rate 500kbps"}
-#define awc_RID_act_Rate_1Mbps 				{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x02,"Rate 1Mbps"}
-#define awc_RID_act_Rate_2Mbps 				{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x04,"Rate 2Mbps"}
-#define awc_RID_act_Rate_4Mbps 				{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x08,"Rate 4Mbps"}
-#define awc_RID_act_Rate_5Mbps 				{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x0B,"Rate 5.5Mbps"}
-#define awc_RID_act_Rate_10Mbps 			{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x14,"Rate 10Mbps"}
-#define awc_RID_act_Rate_11Mbps 			{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x16,"Rate 11Mbps"}
-#define awc_RID_act_BasicRate_500kbps 			{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x81,"BasicRate 500kbps"}
-#define awc_RID_act_BasicRate_1Mbps 				{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x82,"BasicRate 1Mbps"}
-#define awc_RID_act_BasicRate_2Mbps 				{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x84,"BasicRate 2Mbps"}
-#define awc_RID_act_BasicRate_4Mbps 				{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x88,"BasicRate 4Mbps"}
-#define awc_RID_act_BasicRate_5Mbps 				{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x8B,"BasicRate 5.5Mbps"}
-#define awc_RID_act_BasicRate_10Mbps 			{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x94,"BasicRate 10Mbps"}
-#define awc_RID_act_BasicRate_11Mbps 			{&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x96,"BasicRate 11Mbps"}
-
-
-#define awc_RID_act_Long_retry_limit 		{&aironet4500_RID_Select_Active_Config,0x0018,16, 1,1,0,0,0xffff,0,"Short Retry Limit"}
-#define awc_RID_act_Short_retry_limit 		{&aironet4500_RID_Select_Active_Config,0x001A,16, 1,1,0,0,0xffff,0,"Long Retry Limit"}
-#define awc_RID_act_Tx_MSDU_lifetime 		{&aironet4500_RID_Select_Active_Config,0x001C,16, 1,1000,0,0,0xffff,0,"TX MSDU Lifetime"}
-#define awc_RID_act_Rx_MSDU_lifetime 		{&aironet4500_RID_Select_Active_Config,0x001E,16, 1,1000,0,0,0xffff,0,"RX MSDU Lifetime"}
-#define awc_RID_act_Stationary 			{&aironet4500_RID_Select_Active_Config,0x0020,16, 1,1,0,0,0xffff,0,"Stationary"}
-#define awc_RID_act_BC_MC_Ordering 			{&aironet4500_RID_Select_Active_Config,0x0022,16, 1,1,0,0,0xffff,0,"Strictly order Bcast and Mcast"}
-#define awc_RID_act_Device_type 			{&aironet4500_RID_Select_Active_Config,0x0024,16, 1,1,1,0,0xffff,0x0065,"Radio Type PC4500"}
-#define awc_RID_act_Reserved_0x0026 			{&aironet4500_RID_Select_Active_Config,0x0026, 8,10,1,0,0,0xff,0,"Reserved0x28"}
-
-
-//SCANNING/ASSOCIATING
-#define awc_RID_act_ScanMode			awc_def_act_RID(0x0030,"ScanMode",		16,0xf,0, NULL)
-#define awc_RID_act_ScanMode_Active 		awc_def_act_RID(0x0030,"ScanMode Active",		16,0xf,0, "Active")
-#define awc_RID_act_ScanMode_Passive 		awc_def_act_RID(0x0030,"ScanMode Passive",		16,0xf,1, "Passive")
-#define awc_RID_act_ScanMode_Aironet_ext		awc_def_act_RID(0x0030,"ScanMode Aironet Ext",	16,0xf,2, "Aironet Ext")
-#define awc_RID_act_ProbeDelay 			awc_def_act_RID(0x0032,"ProbeDelay",		16,0xffff,0," msek") 		//                 Time ms to wait after switching to a channel for clear channel assessment.
-#define awc_RID_act_ProbeEnergyTimeout 		awc_def_act_RID(0x0034,"ProbeEnergyTimeout",	16,0xffff,0,"msek") 	//          Time to wait for energy after an active probe.
-#define awc_RID_act_ProbeResponseTimeout		awc_def_act_RID(0x0036,"ProbeResponseTimeout",	16,0xffff,0,"msek") 	// Time to wait for a probe response after energy detected.
-#define awc_RID_act_BeaconListenTimeout 		awc_def_act_RID(0x0038,"BeaconListenTimeout",	16,0xffff,0,"msek")	//    0 default    40          Time to listen for a beacon on each channel.
-#define awc_RID_act_IbssJoinNetTimeout 		awc_def_act_RID(0x003A,"IbssJoinNetTimeout",	16,0xffff,0,"msek")	//       0 default    10000       IBSS: Time to scan for an IBSS before forming a
-#define awc_RID_act_AuthenticationTimeout 		awc_def_act_RID(0x003C,"AuthenticationTimeout",16,0xffff,0,"msek")	//       0 default    2000        Time limit after which an authentication sequence will
-#define awc_RID_act_AuthenticationType 		awc_def_act_RID(0x003E,"AuthenticationType",	16,0xffff,0,NULL)	//       0 default    1 (open) //    Selects the desired authentication and privacy methods.		 
-#define awc_RID_act_AuthenticationType_None 	awc_def_act_RID(0x003E,"AuthenticationType None",	16,0xffff,0,"None") 	//   0x00 = None	
-#define awc_RID_act_AuthenticationType_Open		awc_def_act_RID(0x003E,"AuthenticationType Open",	16,0xffff,1,"Open") 	//             0x01 = Open
-#define awc_RID_act_AuthenticationType_Shared	awc_def_act_RID(0x003E,"AuthenticationType Shared-Key",	16,0xffff,2,"Shared-Key")  	//     0x02 = Shared-Key
-#define awc_RID_act_AuthenticationType_Exclude_Open awc_def_act_RID(0x003E,"AuthenticationType Exclude Open",	16,0xffff,4,"Exclude Open")   	//              0x04 = Exclude Unencrypted
-#define awc_RID_act_AssociationTimeout 		awc_def_act_RID(0x0040,"AssociationTimeout",	16,0xffff,0,"msek")	//       0 default    2000        ESS: Time limit after which an association sequence
-#define awc_RID_act_SpecifiedAPtimeout 		awc_def_act_RID(0x0042,"SpecifiedAPtimeout",	16,0xffff,0,"msek")	//       0 default    10000       0 selects the factory default [~10 sec].
-#define awc_RID_act_OfflineScanInterval 		awc_def_act_RID(0x0044,"OfflineScanInterval",	16,0xffff,0,"msek")	//       0            0           0 disables offline scanning.(kus)        The time period between offline scans.
-#define awc_RID_act_OfflineScanDuration 		awc_def_act_RID(0x0046,"OfflineScanDuration",	16,0xffff,0,"msek")	//       0            0           0 disables offline scanning. //    (kus)        The duration of an offline scan.
-#define awc_RID_act_LinkLossDelay 			awc_def_act_RID(0x0048,"LinkLossDelay",	16,0xffff,0,"msek")	//       0  0 Time to delay before reporting a loss of association
-#define awc_RID_act_MaxBeaconLostTime 		awc_def_act_RID(0x004A,"MaxBeaconLostTime",	16,0xffff,0,"msek")	//      0 default    500        If no beacons are received for this time period, the unit
-#define awc_RID_act_RefreshInterval 		awc_def_act_RID(0x004C,"RefreshInterval",	16,0xffff,0,"msek")		//      0 default    10000      At the specified interval, the station will send a refresh
-//POWER SAVE OPERATION
-#define awc_RID_act_PowerSaveMode 			awc_def_act_RID(0x0050,"PowerSaveMode",	16,0xffff,0,NULL) 		//      0  0Note, for IBSS there is only one PSP mode and it is only enabled if the ATIMwindow is non-zero.
-#define awc_RID_act_PowerSaveMode_CAM 		awc_def_act_RID(0x0050,"PowerSaveMode CAM",	16,0x000f,0,"CAM") 	// 0 = CAM
-#define awc_RID_act_PowerSaveMode_PSP 		awc_def_act_RID(0x0050,"PowerSaveMode PSP",	16,0x000f,1,"PSP") 	// 1 = PSP
-#define awc_RID_act_PowerSaveMode_Fast_PSP		awc_def_act_RID(0x0050,"PowerSaveMode Fast PSP",	16,0x000f,2,"Fast PSP")	//2 = PSP-CAM [FASTPSP]
-#define awc_RID_act_SleepForDTIMs 			awc_def_act_RID(0x0052,"SleepForDTIMs",	16,0xffff,0,"DTIMs")	//      0  0If non-zero, the station may sleep through DTIMs; this
-#define awc_RID_act_ListenInterval 			awc_def_act_RID(0x0054,"ListenInterval",	16,0xffff,0,"msek")		//      0 default    200 kus    Maximum time to awaken for TIMs. 0 selects factory
-#define awc_RID_act_FastListenInterval 		awc_def_act_RID(0x0056,"FastListenInterval",	16,0xffff,0,"msek")  //    0 default    100 kus    The listen interval to be used immediately after
-#define awc_RID_act_ListenDecay 			awc_def_act_RID(0x0058,"ListenDecay",		16,0xffff,0,"times")	//      0 default    2Number of times to use the current listen interval
-#define awc_RID_act_FastListenDelay 		awc_def_act_RID(0x005A,"FastListenDelay",	16,0xffff,0,"msek")	//      0 default    200 kus    Time interval to delay before going to fast listen
-#define awc_RID_act_Reserved0x005C 			awc_def_act_RID(0x005C,"Reserved0x005C",	32,0,0,"")	//
-//ADHOC (or AP) OPERATION
-#define awc_RID_act_BeaconPeriod 			awc_def_act_RID(0x0060,"BeaconPeriod",		16,0xffff,0,"msek")	//      0 default    100        0 selects the factory default of [~100 ms].  (kus)
-#define awc_RID_act_AtimDuration 			awc_def_act_RID(0x0062,"AtimDuration",		16,0xffff,0,"msek")	//      0 default    5 kus      The time period reserved for ATIMs immediately after (kus)      the beacon. 0xFFFF will disable the ATIM window; power save mode will not operate.This parameter only applies to adhoc/IBSS.
-#define awc_RID_act_Reserved0x0064 			awc_def_act_RID(0x0064,"Reserved64",		16,0xffff,0,"")	//      0  0Reserved for future use
-#define awc_RID_act_DSChannel 			awc_def_act_RID(0x0066,"DSChannel",		16,0xffff,0,"")	//      0 default    1The desired operating channel.  ()refer to 802.11)       For North America, a Channel of 0 is 2412 MHz.
-#define awc_RID_act_Reserved0x0068 			awc_def_act_RID(0x0068,"Reserved68",		16,0xffff,0,"")	//      0  0Reserved for future use
-#define awc_RID_act_DTIM_Period 			awc_def_act_RID(0x006A,"DTIM Period",		16,0xffff,0,"")	//      0 default    1Selects how often a beacon is a DTIM for APs
-#define awc_RID_act_Reserved0x0006C 		awc_def_act_RID(0x006C,"Reserved6C",		32,0xffffffff,0,"")	//    0's0's        Reserved for future use
-//RADIO OPERATION
-#define awc_RID_act_RadioSpreadType 		awc_def_act_RID(0x0070,"RadioSpreadType",	16,0xffff,0,NULL)	//      0 default    0Selects the radio operational mode. By default, this will
-#define awc_RID_act_RadioSpreadType_FH 		awc_def_act_RID(0x0070,"RadioSpreadType FH",	16,0xffff,0,"FH")	//0 = 802.11 FH Radio (Default)
-#define awc_RID_act_RadioSpreadType_DS 		awc_def_act_RID(0x0070,"RadioSpreadType DS",	16,0xffff,1,"DS")	//1 = 802.11 DS Radio
-#define awc_RID_act_RadioSpreadType_LM 		awc_def_act_RID(0x0070,"RadioSpreadType LM2000",	16,0xffff,2,"LM2000")	//2 = LM2000 (Legacy) DS Radio
-#define awc_RID_act_TX_antenna_Diversity 		awc_def_act_RID(0x0072,"TX antenna Diversity",	16,0xff00,0,NULL)	//       0 default    0x0303    This field is bit-mapped to select the operational
-#define awc_RID_act_TX_antenna_Diversity_default	awc_def_act_RID(0x0072,"TX antenna Diversity Default",	16,0xff00,0x0000,"Default")	//  0 = Diversity as programmed at the factory
-#define awc_RID_act_TX_antenna_Diversity_1 		awc_def_act_RID(0x0072,"TX antenna Diversity Antenna 1",	16,0xff00,0x0100,"Antenna 1")	//  1 = Antenna 1 only
-#define awc_RID_act_TX_antenna_Diversity_2 		awc_def_act_RID(0x0072,"TX antenna Diversity Antenna 2",	16,0xff00,0x0200,"Antenna 2")	//  2 = Antenna 2 only
-#define awc_RID_act_TX_antenna_Diversity_both 	awc_def_act_RID(0x0072,"TX antenna Diversity both antennas",	16,0xff00,0x0300,"both antennas")	//  3 = Antennas 1 and 2 are active
-#define awc_RID_act_RX_antenna_Diversity		awc_def_act_RID(0x0072,"RX antenna Diversity",	16,0x00ff,0,NULL)	//       0 default    0x0303    This field is bit-mapped to select the operational
-#define awc_RID_act_RX_antenna_Diversity_default	awc_def_act_RID(0x0072,"RX antenna Diversity Default",	16,0x00ff,0,"Default")	//  0 = Diversity as programmed at the factory
-#define awc_RID_act_RX_antenna_Diversity_1		awc_def_act_RID(0x0072,"RX antenna Diversity Antenna 1",	16,0x00ff,1,"Antenna 1")	//  1 = Antenna 1 only
-#define awc_RID_act_RX_antenna_Diversity_2 		awc_def_act_RID(0x0072,"RX antenna Diversity Antenna 2",	16,0x00ff,2,"Antenna 2")	//  2 = Antenna 2 only
-#define awc_RID_act_RX_antenna_Diversity_both	awc_def_act_RID(0x0072,"RX antenna Diversity both antennas",	16,0x00ff,3,"both antennas")	//
-#define awc_RID_act_TransmitPower 			awc_def_act_RID(0x0074,"TransmitPower",	16,0xffff,0,"mW (rounded up, btw)")	//       0 default    250 or    0 selects the default (maximum power allowed for the
-#define awc_RID_act_RSSIthreshold 			awc_def_act_RID(0x0076,"RSSIthreshold",	16,0xffff,0,"units")	//       0 default    0         RSSI threshold. 0 selects factory default.
-#define awc_RID_act_Reserved0x0078 			awc_def_act_RID(0x0078,"Reserved0x0078",	64,0,0,"")	//     0's0's       reserved for future radio specific parameters
-#define awc_RID_act_Modulation 				awc_def_act_RID(0x0078,"Modulation",	8,0xff,0,"")	//     modulation type
-#define awc_RID_act_Reserved0x0079 			awc_def_act_RID(0x0079,"Reserved0x0079",	56,0xff,0,"")	//     0's0's       reserved for future radio specific parameters
-
-//AIRONET EXTENSIONS
-#define awc_RID_act_NodeName 			awc_def_act_RID(0x0080,"NodeName",		128,0,0,"")	//    0  0         Station name.
-#define awc_RID_act_ARLThreshold 		awc_def_act_RID(0x0090,"ARLThreshold",		16,0xffff,0,"times")	//       0 default    0xFFFF    0 selects the factory defaults. (which for now is
-#define awc_RID_act_ARLDecay 			awc_def_act_RID(0x0092,"ARLDecay",		16,0xffff,0,"times")	//       0 default    0xFFFF    0 selects the factory defaults. (which for now is
-#define awc_RID_act_ARLDelay 			awc_def_act_RID(0x0094,"ARLDelay",		16,0xffff,0,"times")	//       0 default    0xFFFF    0 selects the factory defaults. (which for now is
-#define awc_RID_act_Unused0x0096 		awc_def_act_RID(0x0096,"Reserved0x96",		16,0xffff,0,"")	//
-#define awc_RID_act_MagicPacketAction 		awc_def_act_RID(0x0098,"MagicPacketAction",	8,0xff,0," hell knows what")	//        0  0         0 selects no action to be taken on a magic packet and"
-#define awc_RID_act_MagicPacketControl 		awc_def_act_RID(0x0099,"MagicPacketControl",	8,0xff,0," hell know what")	//        0  0         0 will disable the magic packet mode command"
-
-
-
-// ***************************        SSID  RID
-
-
-
-#define awc_RID_SSID_RidLen 				awc_def_SSID_RID(0x0000,"RidLen",		16,0xffff,0,"")	//RidLen     ",16,0xffff,,"")	//      read-only        Length of this RID including the length field 0x68
-#define awc_RID_SSID_Accept_any 		awc_def_SSID_RID(0x0002,"Accept Any SSID",	16,0xffff,0,"Accept ANY SSID")	//
-#define awc_RID_SSIDlen1 			awc_def_SSID_RID(0x0002,"SSIDlen1",		16,0xffff,0,"")	//      7      The length of the SSID1 byte string.
-#define awc_RID_SSID1 				awc_def_SSID_RID(0x0004,"SSID1",		255,0,0,"")	//    "tsunami"        The identifier uniquely identifying the wireless system.
-#define awc_RID_SSIDlen2 			awc_def_SSID_RID(0x0024,"SSIDlen2",		16,0xffff,0,"")	//      0      The length of the SSID2 byte string.
-#define awc_RID_SSID2 				awc_def_SSID_RID(0x0026,"SSID2",		255,0,0,"") 	//   
-#define awc_RID_SSIDlen3 			awc_def_SSID_RID(0x0046,"SSIDlen3",		16,0xffff,0,"")	//      0      The length of the SSID3 byte string.
-#define awc_RID_SSID3 				awc_def_SSID_RID(0x0048,"SSID3",		255,0,0,"")	//    
-#define awc_RID_SSID1hex 				awc_def_SSID_RID(0x0004,"SSID1hex",		255,0xff,0,"")	
-#define awc_RID_SSID2hex 				awc_def_SSID_RID(0x0026,"SSID2hex",		255,0xff,0,"") 	
-#define awc_RID_SSID3hex 				awc_def_SSID_RID(0x0048,"SSID3hex",		255,0xff,0,"")	
-
-// AP list
-
-#define awc_RID_AP_List_RidLen 			awc_def_AP_List_RID(0x0000,"RidLen",		16,0xffff,0,"")		//      read-only     Length of this RID including the length field
-#define awc_RID_AP_List_SpecifiedAP1 		awc_def_AP_List_RID(0x0002,"SpecifiedAP1",		48,0xff,0,"")	//    0   Specifies the MAC address of an access point to attempt to associate to first, before looking for other Access Points
-#define awc_RID_AP_List_SpecifiedAP2 		awc_def_AP_List_RID(0x0008,"SpecifiedAP2",		48,0xff,0,"")	//    0   Allows for a secondary AP to associate to if the radio cannot associate to the primary AP.
-#define awc_RID_AP_List_SpecifiedAP3 		awc_def_AP_List_RID(0x000E,"SpecifiedAP3",		48,0xff,0,"")	//    0   Allows for a third option when specifying a list of APs.
-#define awc_RID_AP_List_SpecifiedAP4 		awc_def_AP_List_RID(0x0014,"SpecifiedAP4",		48,0xff,0,"")	//    0   Allows for a fourth option when specifying a list of  APs.
-
-//   Driver Name
-
-#define awc_RID_Dname_RidLen 			awc_def_Dname_RID(0x0000,"RidLen",		16,0xffff,0,"")	//      read-only     Length of this RID including the length field
-#define awc_RID_Dname_DriverName 		awc_def_Dname_RID(0x0002,"DriverName",		128,0,0,"")	// The driver name and version can be written here for  debugging support
-
-
-//       Encapsulation Transformations RID
-
-#define awc_RID_Enc_RidLen 			awc_def_Enc_RID(0x0000,"RidLen",	16,0xffff,0,"")	//       read-only     Length of this RID including the length field
-#define awc_RID_Enc_EtherType1 			awc_def_Enc_RID(0x0002,"EtherType1",	16,0xffff,0,"")	//       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
-#define awc_RID_Enc_Action_RX_1 		awc_def_Enc_RID(0x0004,"RX Action 1",	16,0x0001,0,NULL)	//       0   This field is bit encoded as follows:
-#define awc_RID_Enc_Action_RX_1_RFC_1042 	awc_def_Enc_RID(0x0004,"RX Action 1",	16,0x0001,1,"RX RFC1042")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_RX_1_802_11 		awc_def_Enc_RID(0x0004,"RX Action 1",	16,0x0001,0,"RX 802.11")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_TX_1 		awc_def_Enc_RID(0x0004,"TX Action 1",	16,0x0002,0,NULL)	//
-#define awc_RID_Enc_Action_TX_1_RFC_1042 	awc_def_Enc_RID(0x0004,"TX Action 1",	16,0x0002,1,"TX 802.11" )	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_Action_TX_1_802_11 		awc_def_Enc_RID(0x0004,"Tx Action 1",	16,0x0002,0,"TX RFC1042")	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_EtherType2 			awc_def_Enc_RID(0x0006,"EtherType2",	16,0xffff,0,"")	//       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
-#define awc_RID_Enc_Action_RX_2 		awc_def_Enc_RID(0x0008,"RX Action 2",	16,0x0001,0,NULL)	//       0   This field is bit encoded as follows:
-#define awc_RID_Enc_Action_RX_2_RFC_1042 	awc_def_Enc_RID(0x0008,"RX Action 2",	16,0x0001,1,"RX RFC1042")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_RX_2_802_11 		awc_def_Enc_RID(0x0008,"RX Action 2",	16,0x0001,0,"RX 802.11")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_TX_2 		awc_def_Enc_RID(0x0008,"TX Action 2",	16,0x0002,0,NULL)	//
-#define awc_RID_Enc_Action_TX_2_RFC_1042 	awc_def_Enc_RID(0x0008,"TX Action 2",	16,0x0002,1,"TX 802.11" )	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_Action_TX_2_802_11 		awc_def_Enc_RID(0x0008,"Tx Action 2",	16,0x0002,0,"TX RFC1042")	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_EtherType3 			awc_def_Enc_RID(0x000A,"EtherType3",	16,0xffff,0,"")	//       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
-#define awc_RID_Enc_Action_RX_3 		awc_def_Enc_RID(0x000C,"RX Action 3",	16,0x0001,0,NULL)	//       0   This field is bit encoded as follows:
-#define awc_RID_Enc_Action_RX_3_RFC_1042 	awc_def_Enc_RID(0x000C,"RX Action 3",	16,0x0001,1,"RX RFC1042")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_RX_3_802_11 		awc_def_Enc_RID(0x000C,"RX Action 3",	16,0x0001,0,"RX 802.11")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_TX_3_ 		awc_def_Enc_RID(0x000C,"TX Action 3",	16,0x0002,0,NULL)	//
-#define awc_RID_Enc_Action_TX_3_RFC_1042 	awc_def_Enc_RID(0x000C,"TX Action 3",	16,0x0002,1,"TX 802.11" )	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_Action_TX_3_802_11 		awc_def_Enc_RID(0x000C,"Tx Action 3",	16,0x0002,0,"TX RFC1042")	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_EtherType4			awc_def_Enc_RID(0x000E,"EtherType4",	16,0xffff,0,"")	//       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
-#define awc_RID_Enc_Action_RX_4			awc_def_Enc_RID(0x0010,"RX Action 4",	16,0x0001,0,NULL)	//       0   This field is bit encoded as follows:
-#define awc_RID_Enc_Action_RX_4_RFC_1042 	awc_def_Enc_RID(0x0010,"RX Action 4",	16,0x0001,1,"RX RFC1042")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_RX_4_802_11 		awc_def_Enc_RID(0x0010,"RX Action 4",	16,0x0001,0,"RX 802.11")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_TX_4 		awc_def_Enc_RID(0x0010,"TX Action 4",	16,0x0002,0,NULL)	//
-#define awc_RID_Enc_Action_TX_4_RFC_1042 	awc_def_Enc_RID(0x0010,"TX Action 4",	16,0x0002,1,"TX 802.11" )	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_Action_TX_4_802_11 		awc_def_Enc_RID(0x0010,"Tx Action 4",	16,0x0002,0,"TX RFC1042")	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_EtherType5 			awc_def_Enc_RID(0x0012,"EtherType5",	16,0xffff,0,"")	//       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
-#define awc_RID_Enc_Action_RX_5 		awc_def_Enc_RID(0x0014,"RX Action 5",	16,0x0001,0,NULL)	//       0   This field is bit encoded as follows:
-#define awc_RID_Enc_Action_RX_5_RFC_1042 	awc_def_Enc_RID(0x0014,"RX Action 5",	16,0x0001,1,"RX RFC1042")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_RX_5_802_11 		awc_def_Enc_RID(0x0014,"RX Action 5",	16,0x0001,0,"RX 802.11")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_TX_5 		awc_def_Enc_RID(0x0014,"TX Action 5",	16,0x0002,0,NULL)	//
-#define awc_RID_Enc_Action_TX_5_RFC_1042 	awc_def_Enc_RID(0x0014,"TX Action 5",	16,0x0002,1,"TX 802.11" )	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_Action_TX_5_802_11 		awc_def_Enc_RID(0x0014,"Tx Action 5",	16,0x0002,0,"TX RFC1042")	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_EtherType6 			awc_def_Enc_RID(0x0016,"EtherType6",	16,0xffff,0,"")	//       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
-#define awc_RID_Enc_Action_RX_6 		awc_def_Enc_RID(0x0018,"RX Action 6",	16,0x0001,0,NULL)	//       0   This field is bit encoded as follows:
-#define awc_RID_Enc_Action_RX_6_RFC_1042 	awc_def_Enc_RID(0x0018,"RX Action 6",	16,0x0001,1,"RX RFC1042")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_RX_6_802_11 		awc_def_Enc_RID(0x0018,"RX Action 6",	16,0x0001,0,"RX 802.11")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_TX_6 		awc_def_Enc_RID(0x0018,"TX Action 6",	16,0x0002,0,NULL)	//
-#define awc_RID_Enc_Action_TX_6_RFC_1042 	awc_def_Enc_RID(0x0018,"TX Action 6",	16,0x0002,1,"TX 802.11" )	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_Action_TX_6_802_11 		awc_def_Enc_RID(0x0018,"Tx Action 6",	16,0x0002,0,"TX RFC1042")	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_EtherType7 			awc_def_Enc_RID(0x001A,"EtherType7",	16,0xffff,0,"")	//       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
-#define awc_RID_Enc_Action_RX_7 		awc_def_Enc_RID(0x001C,"RX Action 8",	16,0x0001,0,NULL)	//       0   This field is bit encoded as follows:
-#define awc_RID_Enc_Action_RX_7_RFC_1042 	awc_def_Enc_RID(0x001C,"RX Action 7",	16,0x0001,1,"RX RFC1042")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_RX_7_802_11 		awc_def_Enc_RID(0x001C,"RX Action 7",	16,0x0001,0,"RX 802.11")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_TX_7 		awc_def_Enc_RID(0x001C,"TX Action 7",	16,0x0002,0,NULL)	//
-#define awc_RID_Enc_Action_TX_7_RFC_1042 	awc_def_Enc_RID(0x001C,"TX Action 7",	16,0x0002,1,"TX 802.11" )	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_Action_TX_7_802_11 		awc_def_Enc_RID(0x001C,"Tx Action 7",	16,0x0002,0,"TX RFC1042")	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_EtherType8 			awc_def_Enc_RID(0x001E,"EtherType7",	16,0xffff,0,"")	//       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
-#define awc_RID_Enc_Action_RX_8 		awc_def_Enc_RID(0x0020,"RX Action 8",	16,0x0001,0,NULL)	//       0   This field is bit encoded as follows:
-#define awc_RID_Enc_Action_RX_8_RFC_1042 	awc_def_Enc_RID(0x0020,"RX Action 8",	16,0x0001,1,"RX RFC1042")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_RX_8_802_11 		awc_def_Enc_RID(0x0020,"RX Action 8",	16,0x0001,0,"RX 802.11")	//  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
-#define awc_RID_Enc_Action_TX_8 		awc_def_Enc_RID(0x0020,"TX Action 8",	16,0x0002,0,NULL)	//
-#define awc_RID_Enc_Action_TX_8_RFC_1042 	awc_def_Enc_RID(0x0020,"TX Action 8",	16,0x0002,1,"TX 802.11" )	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-#define awc_RID_Enc_Action_TX_8_802_11 		awc_def_Enc_RID(0x0020,"Tx Action 8",	16,0x0002,0,"TX RFC1042")	//  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
-
-
-// WEP Key volatile
-#define awc_RID_WEPv_RidLen 			awc_def_WEPv_RID(0x0000,"RidLen",	16,0xffff,0,"")	//       read-only     Length of this RID including the length field
-#define awc_RID_WEPv_KeyIndex 			awc_def_WEPv_RID(0x0002,"KeyIndex",	16,0xffff,0,"Index to list of keys")	
-#define awc_RID_WEPv_Address 			awc_def_WEPv_RID(0x0004,"Address",	48,0xff,0,"mac address related to keys")	
-#define awc_RID_WEPv_KeyLen 			awc_def_WEPv_RID(0x000A,"KeyLen",	16,0xffff,0,"Key Length (0 and 5 are valid)")	
-#define awc_RID_WEPv_Key 			awc_def_WEPv_RID(0x000C,"Key",		128,0xff,0,"Key itself in hex coding")
-#define awc_RID_WEPv_KeyAscii 			awc_def_WEPv_RID(0x000C,"KeyAscii",	128,0,0,"Key itself in ascii coding")
-
-// WEP Key non-volatile
-#define awc_RID_WEPnv_RidLen 			awc_def_WEPnv_RID(0x0000,"RidLen",	16,0xffff,0,"")	//       read-only     Length of this RID including the length field
-#define awc_RID_WEPnv_KeyIndex 			awc_def_WEPnv_RID(0x0002,"KeyIndex",	16,0xffff,0,"Index to list of keys")	
-#define awc_RID_WEPnv_Address 			awc_def_WEPnv_RID(0x0004,"Address",	48,0xff,0,"mac address related to keys")	
-#define awc_RID_WEPnv_KeyLen 			awc_def_WEPnv_RID(0x000A,"KeyLen",	16,0xffff,0,"Key Length (0 and 5 are valid)")	
-#define awc_RID_WEPnv_Key 			awc_def_WEPnv_RID(0x000C,"Key",		128,0xff,0,"Key itself in hex coding")
-#define awc_RID_WEPnv_KeyAscii 			awc_def_WEPnv_RID(0x000C,"KeyAscii",	128,0,0,"Key itself in ascii coding")
-
-// Modulation
-#define awc_RID_Modulation_RidLen 		awc_def_Modulation_RID(0x0000,"RidLen",		16,0xffff,0,"")	//       read-only     Length of this RID including the length field
-#define awc_RID_Modulation_Modulation 		awc_def_Modulation_RID(0x0002,"Modulation",	16,0xffff,0,"Modulation")	
-
-
-//   Capabilities RID
-#define awc_RID_Cap_RidLen 		awc_def_Cap_RID(0x0000,"RidLen",		16,0xffff,0,"")	//        read-only      Length of this RID including the length field
-#define awc_RID_Cap_OUI 		awc_def_Cap_RID(0x0002,"OUI",			24,0xffff,0,"")	//      0x00 0x40      This field will give the manufacturer OUI (fourth byte   always zero).
-#define awc_RID_Cap_ProductNum 		awc_def_Cap_RID(0x0006,"ProductNum",		24,0xffff,0,"")	//      0x0004         This field will give the product number.
-#define awc_RID_Cap_ManufacturerName 	awc_def_Cap_RID(0x0008,"ManufacturerName",	255,0,0,"")	//      ASCIIz encoding of manufacturer name.
-#define awc_RID_Cap_ProductName 	awc_def_Cap_RID(0x0028,"ProductName",		128,0,0,"")	//     PC4500         ASCIIz encoding of product name.
-#define awc_RID_Cap_ProductVersion 	awc_def_Cap_RID(0x0038,"ProductVersion",	64,0,0,"")	//      .    ASCIIz encoding of product (firmware?) version.
-#define awc_RID_Cap_FactoryAddress 	awc_def_Cap_RID(0x0040,"FactoryAddress",	48,0xff,0,"")	// This field will contain the OEM assigned IEEE address. If there is no OEM address assigned, the Aironet assigned  IEEE Address will be returned in this field.
-#define awc_RID_Cap_AironetAddress 	awc_def_Cap_RID(0x0046,"AironetAddress",	48,0xff,0,"")	// This field will contain the Aironet factory assigned    IEEE address.
-#define awc_RID_Cap_RadioSpreadType_DS 	awc_def_Cap_RID(0x004C,"RadioType_FH",		16,0x0001,1,"")	//	  0x01 = 802.11 FH
-#define awc_RID_Cap_RadioSpreadType_FH 	awc_def_Cap_RID(0x004C,"RadioType_DS",		16,0x0002,2,"")	//	  0x02 = 802.11 DS
-#define awc_RID_Cap_RadioSpreadType_Legacy awc_def_Cap_RID(0x004C,"RadioType_Legacy",	16,0x0004,4,"")	//	  0x04 = LM2000 (Legacy) DS //  Note, more than one bit may be set for radios     supporting multiple modes of operation.
-#define awc_RID_Cap_RegDomain 		awc_def_Cap_RID(0x004E,"RegDomain",		16,0xffff,0,"")	// This field indicates the registration domain/country   The values as assigned by 802.11 will be used.
-#define awc_RID_Cap_Callid 		awc_def_Cap_RID(0x0050,"Callid",		48,0xff,0,"")	// This field indicates the callid assigned to the unit (if  RegDomain is Japan) Each nibble will contain one decimal digit of the 12 digit callid. (Note, this is not the encoded format).
-#define awc_RID_Cap_SupportedRates 	awc_def_Cap_RID(0x0056,"SupportedRates",	64,0xff,0,"")	//      0x02, 0x04,    This field will indicate the 802.11 supported rates as  specified in the rates.
-#define awc_RID_Cap_RxDiversity 	awc_def_Cap_RID(0x005E,"RxDiversity",		8 ,0xff,0,"")	//         0x03 This field will indicate the number of antennas  supported as a bit mask.
-#define awc_RID_Cap_TxDiversity 	awc_def_Cap_RID(0x005F,"TxDiversity",		8 ,0xff,0,"")	//         0x03 This field will indicate the number of antennas supported as a bit mask.
-#define awc_RID_Cap_TxPowerLevels 	awc_def_Cap_RID(0x0060,"TxPowerLevels",	128,0xff,0,"")	//     250  This table indicates the supported transmit power  levels. (values are in mW)  Zero terminates the list. Note, this may be further restricted depending on   country selected.
-#define awc_RID_Cap_HardwareVersion 	awc_def_Cap_RID(0x0070,"HardwareVersion",	16,0xffff,0,"")	//        0    This indicates the revision of hardware.
-#define awc_RID_Cap_HardwareCapabilit 	awc_def_Cap_RID(0x0072,"HardwareCapabilit",	16,0xffff,0,"")	//        0    This is a bit-mapped field indicating harware  capabilities. No bits have been assigned yet. Initially this is zero.
-#define awc_RID_Cap_TemperatureRange 	awc_def_Cap_RID(0x0074,"TemperatureRange",	16,0xffff,0,"")	//        0    This indicates the temperature range capability.
-#define awc_RID_Cap_SoftwareVersion 	awc_def_Cap_RID(0x0076,"SoftwareVersion",	16,0xffff,0,"")	//        0    This indicates the revision of software.
-#define awc_RID_Cap_SoftwareVersion_major 	awc_def_Cap_RID(0x0076,"SoftwareVersion major",	16,0xff00,0,"")	//  The upper byte indicates the major version and the
-#define awc_RID_Cap_SoftwareVersion_minor 	awc_def_Cap_RID(0x0076,"SoftwareVersion minor",	16,0x00ff,0,"")	//  lower byte the minor version.
-#define awc_RID_Cap_SoftwareSubVersion 	awc_def_Cap_RID(0x0078,"SoftwareSubVersio",	16,0xffff,0,"")	//        0    This indicates the sub-revision of software.
-#define awc_RID_Cap_InterfaceVersion	awc_def_Cap_RID(0x007A,"InterfaceVersion",	16,0xffff,0,"")	//        0    This indicates the revision of the interface. This will be bumped whenever there are incompatible  modifications made to the interfac  This may be bumped on first release to ensure that  "unreleased" utilities/drivers become unusable.
-#define awc_RID_Cap_SoftwareCapabilities awc_def_Cap_RID(0x007C,"SoftwareCapabiliti",	160,0xff,0,"")	//    0    This field gives a bit mapped indication of capabilities. No capability bits have yet been assigned.
-#define awc_RID_Cap_BootBlockVersion 	awc_def_Cap_RID(0x007E,"BootBlockVersion ",	16,0xffff,0,"")	// This indicates the revision of bootblock software. The upper byte indicates the major version and the lower byte the minor version.  Note, BCD encoding is used. (version 2.11 would be  0x0211.)
-
-
-// Status RID 
-
-#define awc_RID_Status_RidLen 		awc_def_Stat_RID( 0x0000,"RidLen",		16,0xffff,0,"")		//    Length of this RID including the length field
-#define awc_RID_Status_MacAddress 	awc_def_Stat_RID( 0x0002,"MacAddress",		48,0xff,0,"")		//  The MAC address in use by the station.
-#define awc_RID_Status_OperationalMode 	awc_def_Stat_RID( 0x0008,"OperationalMode",	16,0xffff,0,NULL)	//    Bit-mapped.
-#define awc_RID_Status_Configured 	awc_def_Stat_RID( 0x0008,"OperationalMode Configured",	16,0x0001,1,"Configured")	//
-#define awc_RID_Status_MAC_Enabled 	awc_def_Stat_RID( 0x0008,"OperationalMode MAC Enabled",	16,0x0002,2,"MAC Enabled")	//
-#define awc_RID_Status_Receive_Enabled 	awc_def_Stat_RID( 0x0008,"OperationalMode Receive Enabled",	16,0x0004,4,"Receive Enabled")	//
-#define awc_RID_Status_In_Sync 		awc_def_Stat_RID( 0x0008,"OperationalMode In Sync with cell",	16,0x0010,10,"In Sync with cell")	//
-#define awc_RID_Status_Associated 	awc_def_Stat_RID( 0x0008,"OperationalMode Associated",	16,0x0020,20,"Associated")	//
-#define awc_RID_Status_Error 		awc_def_Stat_RID( 0x0008,"OperationalMode Error",	16,0x8000,0x8000,"Error")	//
-#define awc_RID_Status_ErrorCode 	awc_def_Stat_RID( 0x000A,"ErrorCode",		16,0xffff,0,"")		//    Non-zero if an error state has been entered
-#define awc_RID_Status_CurrentSignalQuality awc_def_Stat_RID( 0x000C,"CurrentSignalQuality",16,0xffff,0,"")		//    A measure of the current signal quality.
-#define awc_RID_Status_SSIDlength 	awc_def_Stat_RID( 0x000E,"SSIDlength",		16,0xffff,0,"")		//    This length of the following SSID.
-#define awc_RID_Status_SSID 		awc_def_Stat_RID( 0x0010,"SSID",		255,0,0,"")		// The SSID that is currently in effect.
-#define awc_RID_Status_ApName 		awc_def_Stat_RID( 0x0030,"ApName",		128,0,0,"")		// The name of the current BSSID (ESS mode only)
-#define awc_RID_Status_CurrentBssid 	awc_def_Stat_RID( 0x0040,"CurrentBssid",	48,0xff,0,"")		// BSSID that is currently in effect.
-#define awc_RID_Status_PreviousBssid1 	awc_def_Stat_RID( 0x0046,"PreviousBssid1",	48,0xff,0,"")		// A former BSSID.
-#define awc_RID_Status_PreviousBssid2 	awc_def_Stat_RID( 0x004C,"PreviousBssid2",	48,0xff,0,"")		//  A former BSSID.
-#define awc_RID_Status_PreviousBssid3 	awc_def_Stat_RID( 0x0052,"PreviousBssid3",	48,0xff,0,"")		//  A former BSSID.
-#define awc_RID_Status_BeaconPeriod 	awc_def_Stat_RID( 0x0058,"BeaconPeriod",	16,0xffff,0,"msek")	// (kus)        The current beacon period.
-#define awc_RID_Status_DtimPeriod 	awc_def_Stat_RID( 0x005A,"DtimPeriod",		16,0xffff,0,"units")	//    The current DTIM period (number of beacons between DTIMs).
-#define awc_RID_Status_AtimDuration 	awc_def_Stat_RID( 0x005C,"AtimDuration",	16,0xffff,0,"msek")	// (kus)        The current ATIM window duration. Adhoc/Ibss only
-#define awc_RID_Status_HopPeriod 	awc_def_Stat_RID( 0x005E,"HopPeriod",		16,0xffff,0,"msek")	// (kus)        The current hopping period.
-#define awc_RID_Status_ChannelSet 	awc_def_Stat_RID( 0x0060,"ChannelSet",		16,0xffff,0,"Set")	//    The current channel set.
-#define awc_RID_Status_Channel		awc_def_Stat_RID( 0x0062,"Channel",		16,0xffff,0," ")	//    The current operating channel.
-#define awc_RID_Status_HopsToBackbone 	awc_def_Stat_RID( 0x0064,"HopsToBackbone",	16,0xffff,0,"hops")	//    0 indicates a backbone association.
-#define awc_RID_Status_ApTotalLoad 	awc_def_Stat_RID( 0x0066,"ApTotalLoad",	16,0xffff,0,"units")	//    Total load including broadcast/multicast from backbone.  This is the value extracted from the Aironet element.
-#define awc_RID_Status_OurGeneratedLoad awc_def_Stat_RID( 0x0068,"OurGeneratedLoad",	16,0xffff,0,"units")	//   Total load generated by our station (transmitted and received). Excludes received broadcast/multicast traffic.
-#define awc_RID_Status_AccumulatedArl 	awc_def_Stat_RID( 0x006A,"AccumulatedArl",	16,0xffff,0,"units")	//
-
-// AP RID
-
-#define awc_RID_AP_16RidLen 		awc_def_AP_RID(0x0000,"RidLen",		16,0xffff,0,"")	//        0x06, read-only Length of this RID including the length field
-#define awc_RID_AP_TIM_addr 		awc_def_AP_RID(0x0002,"TIM Addr",		16,0xffff,0,"")	//        Read only       The "Traffic Indication Map" is updated by the host via
-#define awc_RID_AP_Airo_addr 		awc_def_AP_RID(0x0004,"Airo Addr",		16,0xffff,0,"")	//        Read only       The "Aironet Information Element" is updated by the host via the AUX I/O ports. This is the address of the Aironet Element.
-
-
-// Statistics RID
-
-#define awc_RID_Stats_RidLen 		awc_def_Stats_RID(0x0000,0x0000,"RidLen",		"Length of the RID including the length field.")
-#define awc_RID_Stats_RxOverrunErr 	awc_def_Stats_RID(0x0002,0x0004,"Stats_RxOverrunErr",	"Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)")
-#define awc_RID_Stats_RxPlcpCrcErr 	awc_def_Stats_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr",	"PLCP header checksum errors (CRC16).")
-#define awc_RID_Stats_RxPlcpFormat 	awc_def_Stats_RID(0x0006,0x000C,"Stats_RxPlcpFormat",	"PLCP format errors.")
-#define awc_RID_Stats_RxPlcpLength 	awc_def_Stats_RID(0x0008,0x0010,"Stats_RxPlcpLength",	"PLCP length is incorrect.")
-#define awc_RID_Stats_RxMacCrcErr 	awc_def_Stats_RID(0x000A,0x0014,"Stats_RxMacCrcErr",	"Count of MAC CRC32 errors.")
-#define awc_RID_Stats_RxMacCrcOk 	awc_def_Stats_RID(0x000C,0x0018,"Stats_RxMacCrcOk",	"Count of MAC CRC32 received correctly.")
-#define awc_RID_Stats_RxWepErr 		awc_def_Stats_RID(0x000E,0x001C,"Stats_RxWepErr",	"Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)")
-#define awc_RID_Stats_RxWepOk 		awc_def_Stats_RID(0x0010,0x0020,"Stats_RxWepOk",	"Count of all WEP ICV checks that passed. (this value is  included in Stats_RxMacCrcOk)")
-#define awc_RID_Stats_RetryLong 	awc_def_Stats_RID(0x0012,0x0024,"Stats_RetryLongCount",	"of all long retries. (Does not include first attempt for a packet).")
-#define awc_RID_Stats_RetryShort 	awc_def_Stats_RID(0x0014,0x0028,"Stats_RetryShort",	"Count of all short retries. (Does not include first attempt for   a packet).")
-#define awc_RID_Stats_MaxRetries 	awc_def_Stats_RID(0x0016,0x002C,"Stats_MaxRetries",	"Count of number of packets that max-retried -- ie were  never ACK-d.")
-#define awc_RID_Stats_NoAck 		awc_def_Stats_RID(0x0018,0x0030,"Stats_NoAck",		"Count of number of times that ACK was not received.")
-#define awc_RID_Stats_NoCts 		awc_def_Stats_RID(0x001A,0x0034,"Stats_NoCts",		"Count of number of timer that CTS was not received.")
-#define awc_RID_Stats_RxAck 		awc_def_Stats_RID(0x001C,0x0038,"Stats_RxAck",		"Count of number of expected ACKs that were received.")
-#define awc_RID_Stats_RxCts 		awc_def_Stats_RID(0x001E,0x003C,"Stats_RxCts",		"Count of number of expected CTSs that were received.")
-#define awc_RID_Stats_TxAck 		awc_def_Stats_RID(0x0020,0x0040,"Stats_TxAck",		"Count of number of ACKs transmitted.")
-#define awc_RID_Stats_TxRts 		awc_def_Stats_RID(0x0022,0x0044,"Stats_TxRts",		"Count of number of RTSs transmitted.")
-#define awc_RID_Stats_TxCts 		awc_def_Stats_RID(0x0024,0x0048,"Stats_TxCts",		"Count of number of CTSs transmitted.")
-#define awc_RID_Stats_TxMc 		awc_def_Stats_RID(0x0026,0x004C,"Stats_TxMc",		" LMAC count of multicast packets sent (uses 802.11  Address1).")
-#define awc_RID_Stats_TxBc 		awc_def_Stats_RID(0x0028,0x0050,"Stats_TxBc",		" LMAC count of broadcast packets sent (uses 802.11")
-#define awc_RID_Stats_TxUcFrags 	awc_def_Stats_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC",	" count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).")
-#define awc_RID_Stats_TxUcPackets 	awc_def_Stats_RID(0x002C,0x0058,"Stats_TxUcPackets",	"LMAC count of unicast packets that were ACKd (uses   802.11 Address 1).")
-#define awc_RID_Stats_TxBeacon 		awc_def_Stats_RID(0x002E,0x005C,"Stats_TxBeacon",	" Count of beacon packets transmitted.")
-#define awc_RID_Stats_RxBeacon 		awc_def_Stats_RID(0x0030,0x0060,"Stats_RxBeacon",	" Count of beacon packets received matching our BSSID.")
-#define awc_RID_Stats_TxSinColl 	awc_def_Stats_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **")
-#define awc_RID_Stats_TxMulColl 	awc_def_Stats_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **")
-#define awc_RID_Stats_DefersNo 		awc_def_Stats_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **")
-#define awc_RID_Stats_DefersProt 	awc_def_Stats_RID(0x0038,0x0070,"Stats_DefersProt",	" Transmit frames deferred due to protocol.")
-#define awc_RID_Stats_DefersEngy 	awc_def_Stats_RID(0x003A,0x0074,"Stats_DefersEngy",	" Transmit frames deferred due to energy detect.")
-#define awc_RID_Stats_DupFram 		awc_def_Stats_RID(0x003C,0x0078,"Stats_DupFram",	"  Duplicate receive frames and fragments.")
-#define awc_RID_Stats_RxFragDisc 	awc_def_Stats_RID(0x003E,0x007C,"Stats_RxFragDisc",	" Received partial frames. (each tally could indicate the  discarding of one or more fragments)")
-#define awc_RID_Stats_TxAged 		awc_def_Stats_RID(0x0040,0x0080,"Stats_TxAged",		"   Transmit packets exceeding maximum transmit lifetime. **")
-#define awc_RID_Stats_RxAged 		awc_def_Stats_RID(0x0042,0x0084,"Stats_RxAgedReceive",	" packets exceeding maximum receive lifetime. **")
-#define awc_RID_Stats_LostSync_Max 	awc_def_Stats_RID(0x0044,0x0088,"Stats_LostSync_Max",	" Lost sync with our cell due to maximum retries occuring. Retry")
-#define awc_RID_Stats_LostSync_Mis 	awc_def_Stats_RID(0x0046,0x008C,"Stats_LostSync_Mis",	"Lost sync with our cell due to missing too many beacons. sedBeacons")
-#define awc_RID_Stats_LostSync_Arl 	awc_def_Stats_RID(0x0048,0x0090,"Stats_LostSync_Arl",	"Lost sync with our cell due to Average Retry Level being  Exceeded  exceeded.")
-#define awc_RID_Stats_LostSync_Dea 	awc_def_Stats_RID(0x004A,0x0094,"Stats_LostSync_Dea",	"Lost sync with our cell due to being deauthenticated.,thed")
-#define awc_RID_Stats_LostSync_Disa 	awc_def_Stats_RID(0x004C,0x0098,"Stats_LostSync_Disa",	" Lost sync with our cell due to being disassociated. ssoced")
-#define awc_RID_Stats_LostSync_Tsf 	awc_def_Stats_RID(0x004E,0x009C,"Stats_LostSync_Tsf",	"Lost sync with our cell due to excessive change in TSF  Timingtiming.")
-#define awc_RID_Stats_HostTxMc 		awc_def_Stats_RID(0x0050,0x00A0,"Stats_HostTxMc",	"Count of multicast packets sent by the host.")
-#define awc_RID_Stats_HostTxBc 		awc_def_Stats_RID(0x0052,0x00A4,"Stats_HostTxBc",	"Count of broadcast packets sent by the host.")
-#define awc_RID_Stats_HostTxUc 		awc_def_Stats_RID(0x0054,0x00A8,"Stats_HostTxUc",	"Count of unicast packets sent by the host.")
-#define awc_RID_Stats_HostTxFail 	awc_def_Stats_RID(0x0056,0x00AC,"Stats_HostTxFail",	"  Count of host transmitted packets which failed.")
-#define awc_RID_Stats_HostRxMc 		awc_def_Stats_RID(0x0058,0x00B0,"Stats_HostRxMc",	"Count of host received multicast packets.")
-#define awc_RID_Stats_HostRxBc 		awc_def_Stats_RID(0x005A,0x00B4,"Stats_HostRxBc",	"Count of host received broadcast packets.")
-#define awc_RID_Stats_HostRxUc 		awc_def_Stats_RID(0x005C,0x00B8,"Stats_HostRxUc",	"Count of host received unicast packets.")
-#define awc_RID_Stats_HostRxDiscar 	awc_def_Stats_RID(0x005E,0x00BC,"Stats_HostRxDiscar",	"Count of host received packets discarded due to:\n  Host not enabling receive.\n  Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.")
-#define awc_RID_Stats_HmacTxMc 		awc_def_Stats_RID(0x0060,0x00C0,"Stats_HmacTxMc",	"Count of internally generated multicast (DA) packets.")
-#define awc_RID_Stats_HmacTxBc 		awc_def_Stats_RID(0x0062,0x00C4,"Stats_HmacTxBc",	"Count of internally generated broadcast (DA) packets.")
-#define awc_RID_Stats_HmacTxUc 		awc_def_Stats_RID(0x0064,0x00C8,"Stats_HmacTxUc",	"Count of internally generated unicast (DA) packets.")
-#define awc_RID_Stats_HmacTxFail 	awc_def_Stats_RID(0x0066,0x00CC,"Stats_HmacTxFail",	"  Count of internally generated transmit packets that failed.")
-#define awc_RID_Stats_HmacRxMc 		awc_def_Stats_RID(0x0068,0x00D0,"Stats_HmacRxMc",	"Count of internally received multicast (DA) packets.")
-#define awc_RID_Stats_HmacRxBc 		awc_def_Stats_RID(0x006A,0x00D4,"Stats_HmacRxBc",	"Count of internally received broadcast (DA) packets.")
-#define awc_RID_Stats_HmacRxUc 		awc_def_Stats_RID(0x006C,0x00D8,"Stats_HmacRxUc",	"Count of internally received multicast (DA) packets.")
-#define awc_RID_Stats_HmacRxDisca 	awc_def_Stats_RID(0x006E,0x00DC,"Stats_HmacRxDisca",	" Count of internally received packets that were discarded  (usually because the destination address is not for the host).")
-#define awc_RID_Stats_HmacRxAcce 	awc_def_Stats_RID(0x0070,0x00E0,"Stats_HmacRxAcce",	"  Count of internally received packets that were accepted")
-#define awc_RID_Stats_SsidMismatch 	awc_def_Stats_RID(0x0072,0x00E4,"Stats_SsidMismatch",	" Count of SSID mismatches.")
-#define awc_RID_Stats_ApMismatch 	awc_def_Stats_RID(0x0074,0x00E8,"Stats_ApMismatch",	"  Count of specified AP mismatches.")
-#define awc_RID_Stats_RatesMismatc 	awc_def_Stats_RID(0x0076,0x00EC,"Stats_RatesMismatc",	" Count of rate mismatches.")
-#define awc_RID_Stats_AuthReject 	awc_def_Stats_RID(0x0078,0x00F0,"Stats_AuthReject",	"  Count of authentication rejections.")
-#define awc_RID_Stats_AuthTimeout 	awc_def_Stats_RID(0x007A,0x00F4,"Stats_AuthTimeout",	" Count of authentication timeouts.")
-#define awc_RID_Stats_AssocReject 	awc_def_Stats_RID(0x007C,0x00F8,"Stats_AssocReject",	" Count of association rejections.")
-#define awc_RID_Stats_AssocTimeout 	awc_def_Stats_RID(0x007E,0x00FC,"Stats_AssocTimeout",	" Count of association timeouts.")
-#define awc_RID_Stats_NewReason 	awc_def_Stats_RID(0x0080,0x0100,"Stats_NewReason",	"Count of reason/status codes of greater than 19.  (Values of 0 = successful are not counted)")
-#define awc_RID_Stats_AuthFail_1 	awc_def_Stats_RID(0x0082,0x0104,"Stats_AuthFail_1",	"Unspecified reason.")
-#define awc_RID_Stats_AuthFail_2 	awc_def_Stats_RID(0x0084,0x0108,"Stats_AuthFail_2",	"Previous authentication no longer valid.")
-#define awc_RID_Stats_AuthFail_3 	awc_def_Stats_RID(0x0086,0x010C,"Stats_AuthFail_3",	"Deauthenticated because sending station is leaving (has left) IBSS or ESS.")
-#define awc_RID_Stats_AuthFail_4 	awc_def_Stats_RID(0x0088,0x0110,"Stats_AuthFail_4",	"Disassociated due to inactivity")
-#define awc_RID_Stats_AuthFail_5 	awc_def_Stats_RID(0x008A,0x0114,"Stats_AuthFail_5",	"Disassociated because AP is unable to handle all currently  associated stations.")
-#define awc_RID_Stats_AuthFail_6 	awc_def_Stats_RID(0x008C,0x0118,"Stats_AuthFail_6",	"Class 2 Frame received from non-Authenticated station.")
-#define awc_RID_Stats_AuthFail_7 	awc_def_Stats_RID(0x008E,0x011C,"Stats_AuthFail_7",	"Class 3 Frame received from non-Associated station.")
-#define awc_RID_Stats_AuthFail_8 	awc_def_Stats_RID(0x0090,0x0120,"Stats_AuthFail_8",	"Disassociated because sending station is leaving (has left)")
-#define awc_RID_Stats_AuthFail_9 	awc_def_Stats_RID(0x0092,0x0124,"Stats_AuthFail_9",	"Station requesting (Re)Association is not Authenticated")
-#define awc_RID_Stats_AuthFail_10 	awc_def_Stats_RID(0x0094,0x0128,"Stats_AuthFail_10",	"Cannot support all requested capabilities in the Capability")
-#define awc_RID_Stats_AuthFail_11 	awc_def_Stats_RID(0x0096,0x012C,"Stats_AuthFail_11",	"Reassociation denied due to inability to confirm")
-#define awc_RID_Stats_AuthFail_12 	awc_def_Stats_RID(0x0098,0x0130,"Stats_AuthFail_12",	"Association denied due to reason outside the scope of the 802.11")
-#define awc_RID_Stats_AuthFail_13 	awc_def_Stats_RID(0x009A,0x0134,"Stats_AuthFail_13",	"Responding station does not support the specified Auth Alogorithm")
-#define awc_RID_Stats_AuthFail_14 	awc_def_Stats_RID(0x009C,0x0138,"Stats_AuthFail_14",	"Received an out of sequence Authentication Frame.")
-#define awc_RID_Stats_AuthFail_15 	awc_def_Stats_RID(0x009E,0x013C,"Stats_AuthFail_15",	"Authentication rejected due to challenge failure.")
-#define awc_RID_Stats_AuthFail_16 	awc_def_Stats_RID(0x00A0,0x0140,"Stats_AuthFail_16",	"Authentication rejected due to timeout waiting for next  frame in sequence.")
-#define awc_RID_Stats_AuthFail_17 	awc_def_Stats_RID(0x00A2,0x0144,"Stats_AuthFail_17",	"Association denied because AP is unable to handle  additional associated stations.")
-#define awc_RID_Stats_AuthFail_18 	awc_def_Stats_RID(0x00A4,0x0148,"Stats_AuthFail_18",	"Association denied due to requesting station not supportingall basic rates.")
-#define awc_RID_Stats_AuthFail_19 	awc_def_Stats_RID(0x00A6,0x014C,"Stats_AuthFail_19",	"Reserved")
-#define awc_RID_Stats_RxMan 		awc_def_Stats_RID(0x00A8,0x0150,"Stats_RxMan",		" Count of management packets received and handled.")
-#define awc_RID_Stats_TxMan 		awc_def_Stats_RID(0x00AA,0x0154,"Stats_TxMan",		" Count of management packets transmitted.")
-#define awc_RID_Stats_RxRefresh 	awc_def_Stats_RID(0x00AC,0x0158,"Stats_RxRefresh",	" Count of null data packets received.")
-#define awc_RID_Stats_TxRefresh 	awc_def_Stats_RID(0x00AE,0x015C,"Stats_TxRefresh",	" Count of null data packets transmitted.")
-#define awc_RID_Stats_RxPoll 		awc_def_Stats_RID(0x00B0,0x0160,"Stats_RxPoll",		"Count of PS-Poll packets received.")
-#define awc_RID_Stats_TxPoll 		awc_def_Stats_RID(0x00B2,0x0164,"Stats_TxPoll",		"Count of PS-Poll packets transmitted.")
-#define awc_RID_Stats_HostRetries 	awc_def_Stats_RID(0x00B4,0x0168,"Stats_HostRetries",	" Count of long and short retries used to transmit host packets  (does not include first attempt).")
-#define awc_RID_Stats_LostSync_HostReq 	awc_def_Stats_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.")
-#define awc_RID_Stats_HostTxBytes 	awc_def_Stats_RID(0x00B8,0x0170,"Stats_HostTxBytes",	" Count of bytes transferred from the host.")
-#define awc_RID_Stats_HostRxBytes 	awc_def_Stats_RID(0x00BA,0x0174,"Stats_HostRxBytes",	" Count of bytes transferred to the host.")
-#define awc_RID_Stats_ElapsedUsec 	awc_def_Stats_RID(0x00BC,0x0178,"Stats_ElapsedUsec",	" Total time since power up (or clear) in microseconds.")
-#define awc_RID_Stats_ElapsedSec 	awc_def_Stats_RID(0x00BE,0x017C,"Stats_ElapsedSec",	" Total time since power up (or clear) in seconds.")
-#define awc_RID_Stats_LostSyncBett 	awc_def_Stats_RID(0x00C0,0x0180,"Stats_LostSyncBett",	"Lost Sync to switch to a better access point")
-
-
-
-#define awc_RID_Stats_delta_RidLen 		awc_def_Stats_delta_RID(0x0000,0x0000,"RidLen",		"Length of the RID including the length field.")
-#define awc_RID_Stats_delta_RxOverrunErr 	awc_def_Stats_delta_RID(0x0002,0x0004,"Stats_RxOverrunErr",	"Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)")
-#define awc_RID_Stats_delta_RxPlcpCrcErr 	awc_def_Stats_delta_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr",	"PLCP header checksum errors (CRC16).")
-#define awc_RID_Stats_delta_RxPlcpFormat 	awc_def_Stats_delta_RID(0x0006,0x000C,"Stats_RxPlcpFormat",	"PLCP format errors.")
-#define awc_RID_Stats_delta_RxPlcpLength 	awc_def_Stats_delta_RID(0x0008,0x0010,"Stats_RxPlcpLength",	"PLCP length is incorrect.")
-#define awc_RID_Stats_delta_RxMacCrcErr 	awc_def_Stats_delta_RID(0x000A,0x0014,"Stats_RxMacCrcErr",	"Count of MAC CRC32 errors.")
-#define awc_RID_Stats_delta_RxMacCrcOk 		awc_def_Stats_delta_RID(0x000C,0x0018,"Stats_RxMacCrcOk",	"Count of MAC CRC32 received correctly.")
-#define awc_RID_Stats_delta_RxWepErr 		awc_def_Stats_delta_RID(0x000E,0x001C,"Stats_RxWepErr",	"Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)")
-#define awc_RID_Stats_delta_RxWepOk 		awc_def_Stats_delta_RID(0x0010,0x0020,"Stats_RxWepOk",	"Count of all WEP ICV checks that passed. (this value is  included in Stats_RxMacCrcOk)")
-#define awc_RID_Stats_delta_RetryLong 		awc_def_Stats_delta_RID(0x0012,0x0024,"Stats_RetryLongCount",	"of all long retries. (Does not include first attempt for a packet).")
-#define awc_RID_Stats_delta_RetryShort 		awc_def_Stats_delta_RID(0x0014,0x0028,"Stats_RetryShort",	"Count of all short retries. (Does not include first attempt for   a packet).")
-#define awc_RID_Stats_delta_MaxRetries 		awc_def_Stats_delta_RID(0x0016,0x002C,"Stats_MaxRetries",	"Count of number of packets that max-retried -- ie were  never ACKd.")
-#define awc_RID_Stats_delta_NoAck 		awc_def_Stats_delta_RID(0x0018,0x0030,"Stats_NoAck",		"Count of number of times that ACK was not received.")
-#define awc_RID_Stats_delta_NoCts 		awc_def_Stats_delta_RID(0x001A,0x0034,"Stats_NoCts",		"Count of number of timer that CTS was not received.")
-#define awc_RID_Stats_delta_RxAck 		awc_def_Stats_delta_RID(0x001C,0x0038,"Stats_RxAck",		"Count of number of expected ACKs that were received.")
-#define awc_RID_Stats_delta_RxCts 		awc_def_Stats_delta_RID(0x001E,0x003C,"Stats_RxCts",		"Count of number of expected CTSs that were received.")
-#define awc_RID_Stats_delta_TxAck 		awc_def_Stats_delta_RID(0x0020,0x0040,"Stats_TxAck",		"Count of number of ACKs transmitted.")
-#define awc_RID_Stats_delta_TxRts 		awc_def_Stats_delta_RID(0x0022,0x0044,"Stats_TxRts",		"Count of number of RTSs transmitted.")
-#define awc_RID_Stats_delta_TxCts 		awc_def_Stats_delta_RID(0x0024,0x0048,"Stats_TxCts",		"Count of number of CTSs transmitted.")
-#define awc_RID_Stats_delta_TxMc 		awc_def_Stats_delta_RID(0x0026,0x004C,"Stats_TxMc",		" LMAC count of multicast packets sent (uses 802.11  Address1).")
-#define awc_RID_Stats_delta_TxBc 		awc_def_Stats_delta_RID(0x0028,0x0050,"Stats_TxBc",		" LMAC count of broadcast packets sent (uses 802.11")
-#define awc_RID_Stats_delta_TxUcFrags 		awc_def_Stats_delta_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC",	" count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).")
-#define awc_RID_Stats_delta_TxUcPackets 	awc_def_Stats_delta_RID(0x002C,0x0058,"Stats_TxUcPackets",	"LMAC count of unicast packets that were ACKd (uses   802.11 Address 1).")
-#define awc_RID_Stats_delta_TxBeacon 		awc_def_Stats_delta_RID(0x002E,0x005C,"Stats_TxBeacon",	" Count of beacon packets transmitted.")
-#define awc_RID_Stats_delta_RxBeacon 		awc_def_Stats_delta_RID(0x0030,0x0060,"Stats_RxBeacon",	" Count of beacon packets received matching our BSSID.")
-#define awc_RID_Stats_delta_TxSinColl 		awc_def_Stats_delta_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **")
-#define awc_RID_Stats_delta_TxMulColl 		awc_def_Stats_delta_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **")
-#define awc_RID_Stats_delta_DefersNo 		awc_def_Stats_delta_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **")
-#define awc_RID_Stats_delta_DefersProt 		awc_def_Stats_delta_RID(0x0038,0x0070,"Stats_DefersProt",	" Transmit frames deferred due to protocol.")
-#define awc_RID_Stats_delta_DefersEngy 		awc_def_Stats_delta_RID(0x003A,0x0074,"Stats_DefersEngy",	" Transmit frames deferred due to energy detect.")
-#define awc_RID_Stats_delta_DupFram 		awc_def_Stats_delta_RID(0x003C,0x0078,"Stats_DupFram",	"  Duplicate receive frames and fragments.")
-#define awc_RID_Stats_delta_RxFragDisc 		awc_def_Stats_delta_RID(0x003E,0x007C,"Stats_RxFragDisc",	" Received partial frames. (each tally could indicate the  discarding of one or more fragments)")
-#define awc_RID_Stats_delta_TxAged 		awc_def_Stats_delta_RID(0x0040,0x0080,"Stats_TxAged",		"   Transmit packets exceeding maximum transmit lifetime. **")
-#define awc_RID_Stats_delta_RxAged 		awc_def_Stats_delta_RID(0x0042,0x0084,"Stats_RxAgedReceive",	" packets exceeding maximum receive lifetime. **")
-#define awc_RID_Stats_delta_LostSync_Max 	awc_def_Stats_delta_RID(0x0044,0x0088,"Stats_LostSync_Max",	" Lost sync with our cell due to maximum retries occuring. Retry")
-#define awc_RID_Stats_delta_LostSync_Mis 	awc_def_Stats_delta_RID(0x0046,0x008C,"Stats_LostSync_Mis",	"Lost sync with our cell due to missing too many beacons. sedBeacons")
-#define awc_RID_Stats_delta_LostSync_Arl 	awc_def_Stats_delta_RID(0x0048,0x0090,"Stats_LostSync_Arl",	"Lost sync with our cell due to Average Retry Level being  Exceeded  exceeded.")
-#define awc_RID_Stats_delta_LostSync_Dea 	awc_def_Stats_delta_RID(0x004A,0x0094,"Stats_LostSync_Dea",	"Lost sync with our cell due to being deauthenticated.,thed")
-#define awc_RID_Stats_delta_LostSync_Disa 	awc_def_Stats_delta_RID(0x004C,0x0098,"Stats_LostSync_Disa",	" Lost sync with our cell due to being disassociated. ssoced")
-#define awc_RID_Stats_delta_LostSync_Tsf 	awc_def_Stats_delta_RID(0x004E,0x009C,"Stats_LostSync_Tsf",	"Lost sync with our cell due to excessive change in TSF  Timingtiming.")
-#define awc_RID_Stats_delta_HostTxMc 		awc_def_Stats_delta_RID(0x0050,0x00A0,"Stats_HostTxMc",	"Count of multicast packets sent by the host.")
-#define awc_RID_Stats_delta_HostTxBc 		awc_def_Stats_delta_RID(0x0052,0x00A4,"Stats_HostTxBc",	"Count of broadcast packets sent by the host.")
-#define awc_RID_Stats_delta_HostTxUc 		awc_def_Stats_delta_RID(0x0054,0x00A8,"Stats_HostTxUc",	"Count of unicast packets sent by the host.")
-#define awc_RID_Stats_delta_HostTxFail 		awc_def_Stats_delta_RID(0x0056,0x00AC,"Stats_HostTxFail",	"  Count of host transmitted packets which failed.")
-#define awc_RID_Stats_delta_HostRxMc 		awc_def_Stats_delta_RID(0x0058,0x00B0,"Stats_HostRxMc",	"Count of host received multicast packets.")
-#define awc_RID_Stats_delta_HostRxBc 		awc_def_Stats_delta_RID(0x005A,0x00B4,"Stats_HostRxBc",	"Count of host received broadcast packets.")
-#define awc_RID_Stats_delta_HostRxUc 		awc_def_Stats_delta_RID(0x005C,0x00B8,"Stats_HostRxUc",	"Count of host received unicast packets.")
-#define awc_RID_Stats_delta_HostRxDiscar 	awc_def_Stats_delta_RID(0x005E,0x00BC,"Stats_HostRxDiscar",	"Count of host received packets discarded due to:\n  Host not enabling receive.\n  Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.")
-#define awc_RID_Stats_delta_HmacTxMc 		awc_def_Stats_delta_RID(0x0060,0x00C0,"Stats_HmacTxMc",	"Count of internally generated multicast (DA) packets.")
-#define awc_RID_Stats_delta_HmacTxBc 		awc_def_Stats_delta_RID(0x0062,0x00C4,"Stats_HmacTxBc",	"Count of internally generated broadcast (DA) packets.")
-#define awc_RID_Stats_delta_HmacTxUc 		awc_def_Stats_delta_RID(0x0064,0x00C8,"Stats_HmacTxUc",	"Count of internally generated unicast (DA) packets.")
-#define awc_RID_Stats_delta_HmacTxFail 		awc_def_Stats_delta_RID(0x0066,0x00CC,"Stats_HmacTxFail",	"  Count of internally generated transmit packets that failed.")
-#define awc_RID_Stats_delta_HmacRxMc 		awc_def_Stats_delta_RID(0x0068,0x00D0,"Stats_HmacRxMc",	"Count of internally received multicast (DA) packets.")
-#define awc_RID_Stats_delta_HmacRxBc 		awc_def_Stats_delta_RID(0x006A,0x00D4,"Stats_HmacRxBc",	"Count of internally received broadcast (DA) packets.")
-#define awc_RID_Stats_delta_HmacRxUc 		awc_def_Stats_delta_RID(0x006C,0x00D8,"Stats_HmacRxUc",	"Count of internally received multicast (DA) packets.")
-#define awc_RID_Stats_delta_HmacRxDisca 	awc_def_Stats_delta_RID(0x006E,0x00DC,"Stats_HmacRxDisca",	" Count of internally received packets that were discarded  (usually because the destination address is not for the host).")
-#define awc_RID_Stats_delta_HmacRxAcce 		awc_def_Stats_delta_RID(0x0070,0x00E0,"Stats_HmacRxAcce",	"  Count of internally received packets that were accepted")
-#define awc_RID_Stats_delta_SsidMismatch 	awc_def_Stats_delta_RID(0x0072,0x00E4,"Stats_SsidMismatch",	" Count of SSID mismatches.")
-#define awc_RID_Stats_delta_ApMismatch 		awc_def_Stats_delta_RID(0x0074,0x00E8,"Stats_ApMismatch",	"  Count of specified AP mismatches.")
-#define awc_RID_Stats_delta_RatesMismatc 	awc_def_Stats_delta_RID(0x0076,0x00EC,"Stats_RatesMismatc",	" Count of rate mismatches.")
-#define awc_RID_Stats_delta_AuthReject 		awc_def_Stats_delta_RID(0x0078,0x00F0,"Stats_AuthReject",	"  Count of authentication rejections.")
-#define awc_RID_Stats_delta_AuthTimeout 	awc_def_Stats_delta_RID(0x007A,0x00F4,"Stats_AuthTimeout",	" Count of authentication timeouts.")
-#define awc_RID_Stats_delta_AssocReject 	awc_def_Stats_delta_RID(0x007C,0x00F8,"Stats_AssocReject",	" Count of association rejections.")
-#define awc_RID_Stats_delta_AssocTimeout 	awc_def_Stats_delta_RID(0x007E,0x00FC,"Stats_AssocTimeout",	" Count of association timeouts.")
-#define awc_RID_Stats_delta_NewReason 		awc_def_Stats_delta_RID(0x0080,0x0100,"Stats_NewReason",	"Count of reason/status codes of greater than 19.  (Values of 0 = successful are not counted)")
-#define awc_RID_Stats_delta_AuthFail_1 		awc_def_Stats_delta_RID(0x0082,0x0104,"Stats_AuthFail_1",	"Unspecified reason.")
-#define awc_RID_Stats_delta_AuthFail_2 		awc_def_Stats_delta_RID(0x0084,0x0108,"Stats_AuthFail_2",	"Previous authentication no longer valid.")
-#define awc_RID_Stats_delta_AuthFail_3 		awc_def_Stats_delta_RID(0x0086,0x010C,"Stats_AuthFail_3",	"Deauthenticated because sending station is leaving (has left) IBSS or ESS.")
-#define awc_RID_Stats_delta_AuthFail_4 		awc_def_Stats_delta_RID(0x0088,0x0110,"Stats_AuthFail_4",	"Disassociated due to inactivity")
-#define awc_RID_Stats_delta_AuthFail_5 		awc_def_Stats_delta_RID(0x008A,0x0114,"Stats_AuthFail_5",	"Disassociated because AP is unable to handle all currently  associated stations.")
-#define awc_RID_Stats_delta_AuthFail_6 		awc_def_Stats_delta_RID(0x008C,0x0118,"Stats_AuthFail_6",	"Class 2 Frame received from non-Authenticated station.")
-#define awc_RID_Stats_delta_AuthFail_7 		awc_def_Stats_delta_RID(0x008E,0x011C,"Stats_AuthFail_7",	"Class 3 Frame received from non-Associated station.")
-#define awc_RID_Stats_delta_AuthFail_8 		awc_def_Stats_delta_RID(0x0090,0x0120,"Stats_AuthFail_8",	"Disassociated because sending station is leaving (has left)")
-#define awc_RID_Stats_delta_AuthFail_9 		awc_def_Stats_delta_RID(0x0092,0x0124,"Stats_AuthFail_9",	"Station requesting (Re)Association is not Authenticated")
-#define awc_RID_Stats_delta_AuthFail_10 	awc_def_Stats_delta_RID(0x0094,0x0128,"Stats_AuthFail_10",	"Cannot support all requested capabilities in the Capability")
-#define awc_RID_Stats_delta_AuthFail_11 	awc_def_Stats_delta_RID(0x0096,0x012C,"Stats_AuthFail_11",	"Reassociation denied due to inability to confirm")
-#define awc_RID_Stats_delta_AuthFail_12 	awc_def_Stats_delta_RID(0x0098,0x0130,"Stats_AuthFail_12",	"Association denied due to reason outside the scope of the 802.11")
-#define awc_RID_Stats_delta_AuthFail_13 	awc_def_Stats_delta_RID(0x009A,0x0134,"Stats_AuthFail_13",	"Responding station does not support the specified Auth Alogorithm")
-#define awc_RID_Stats_delta_AuthFail_14 	awc_def_Stats_delta_RID(0x009C,0x0138,"Stats_AuthFail_14",	"Received an out of sequence Authentication Frame.")
-#define awc_RID_Stats_delta_AuthFail_15 	awc_def_Stats_delta_RID(0x009E,0x013C,"Stats_AuthFail_15",	"Authentication rejected due to challenge failure.")
-#define awc_RID_Stats_delta_AuthFail_16 	awc_def_Stats_delta_RID(0x00A0,0x0140,"Stats_AuthFail_16",	"Authentication rejected due to timeout waiting for next  frame in sequence.")
-#define awc_RID_Stats_delta_AuthFail_17 	awc_def_Stats_delta_RID(0x00A2,0x0144,"Stats_AuthFail_17",	"Association denied because AP is unable to handle  additional associated stations.")
-#define awc_RID_Stats_delta_AuthFail_18 	awc_def_Stats_delta_RID(0x00A4,0x0148,"Stats_AuthFail_18",	"Association denied due to requesting station not supportingall basic rates.")
-#define awc_RID_Stats_delta_AuthFail_19 	awc_def_Stats_delta_RID(0x00A6,0x014C,"Stats_AuthFail_19",	"Reserved")
-#define awc_RID_Stats_delta_RxMan 		awc_def_Stats_delta_RID(0x00A8,0x0150,"Stats_RxMan",		" Count of management packets received and handled.")
-#define awc_RID_Stats_delta_TxMan 		awc_def_Stats_delta_RID(0x00AA,0x0154,"Stats_TxMan",		" Count of management packets transmitted.")
-#define awc_RID_Stats_delta_RxRefresh 		awc_def_Stats_delta_RID(0x00AC,0x0158,"Stats_RxRefresh",	" Count of null data packets received.")
-#define awc_RID_Stats_delta_TxRefresh 		awc_def_Stats_delta_RID(0x00AE,0x015C,"Stats_TxRefresh",	" Count of null data packets transmitted.")
-#define awc_RID_Stats_delta_RxPoll 		awc_def_Stats_delta_RID(0x00B0,0x0160,"Stats_RxPoll",		"Count of PS-Poll packets received.")
-#define awc_RID_Stats_delta_TxPoll 		awc_def_Stats_delta_RID(0x00B2,0x0164,"Stats_TxPoll",		"Count of PS-Poll packets transmitted.")
-#define awc_RID_Stats_delta_HostRetries 	awc_def_Stats_delta_RID(0x00B4,0x0168,"Stats_HostRetries",	" Count of long and short retries used to transmit host packets  (does not include first attempt).")
-#define awc_RID_Stats_delta_LostSync_HostReq 	awc_def_Stats_delta_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.")
-#define awc_RID_Stats_delta_HostTxBytes 	awc_def_Stats_delta_RID(0x00B8,0x0170,"Stats_HostTxBytes",	" Count of bytes transferred from the host.")
-#define awc_RID_Stats_delta_HostRxBytes 	awc_def_Stats_delta_RID(0x00BA,0x0174,"Stats_HostRxBytes",	" Count of bytes transferred to the host.")
-#define awc_RID_Stats_delta_ElapsedUsec 	awc_def_Stats_delta_RID(0x00BC,0x0178,"Stats_ElapsedUsec",	" Total time since power up (or clear) in microseconds.")
-#define awc_RID_Stats_delta_ElapsedSec 		awc_def_Stats_delta_RID(0x00BE,0x017C,"Stats_ElapsedSec",	" Total time since power up (or clear) in seconds.")
-#define awc_RID_Stats_delta_LostSyncBett 	awc_def_Stats_delta_RID(0x00C0,0x0180,"Stats_LostSyncBett",	"Lost Sync to switch to a better access point")
-
-
-
-#define awc_RID_Stats_clear_RidLen 		awc_def_Stats_clear_RID(0x0000,0x0000,"RidLen",		"Length of the RID including the length field.")
-#define awc_RID_Stats_clear_RxOverrunErr 	awc_def_Stats_clear_RID(0x0002,0x0004,"Stats_RxOverrunErr",	"Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)")
-#define awc_RID_Stats_clear_RxPlcpCrcErr 	awc_def_Stats_clear_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr",	"PLCP header checksum errors (CRC16).")
-#define awc_RID_Stats_clear_RxPlcpFormat 	awc_def_Stats_clear_RID(0x0006,0x000C,"Stats_RxPlcpFormat",	"PLCP format errors.")
-#define awc_RID_Stats_clear_RxPlcpLength 	awc_def_Stats_clear_RID(0x0008,0x0010,"Stats_RxPlcpLength",	"PLCP length is incorrect.")
-#define awc_RID_Stats_clear_RxMacCrcErr 	awc_def_Stats_clear_RID(0x000A,0x0014,"Stats_RxMacCrcErr",	"Count of MAC CRC32 errors.")
-#define awc_RID_Stats_clear_RxMacCrcOk 		awc_def_Stats_clear_RID(0x000C,0x0018,"Stats_RxMacCrcOk",	"Count of MAC CRC32 received correctly.")
-#define awc_RID_Stats_clear_RxWepErr 		awc_def_Stats_clear_RID(0x000E,0x001C,"Stats_RxWepErr",	"Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)")
-#define awc_RID_Stats_clear_RxWepOk 		awc_def_Stats_clear_RID(0x0010,0x0020,"Stats_RxWepOk",	"Count of all WEP ICV checks that passed. (this value is  included in Stats_RxMacCrcOk)")
-#define awc_RID_Stats_clear_RetryLong 		awc_def_Stats_clear_RID(0x0012,0x0024,"Stats_RetryLongCount",	"of all long retries. (Does not include first attempt for a packet).")
-#define awc_RID_Stats_clear_RetryShort 		awc_def_Stats_clear_RID(0x0014,0x0028,"Stats_RetryShort",	"Count of all short retries. (Does not include first attempt for   a packet).")
-#define awc_RID_Stats_clear_MaxRetries 		awc_def_Stats_clear_RID(0x0016,0x002C,"Stats_MaxRetries",	"Count of number of packets that max-retried -- ie were  never ACKd.")
-#define awc_RID_Stats_clear_NoAck 		awc_def_Stats_clear_RID(0x0018,0x0030,"Stats_NoAck",		"Count of number of times that ACK was not received.")
-#define awc_RID_Stats_clear_NoCts 		awc_def_Stats_clear_RID(0x001A,0x0034,"Stats_NoCts",		"Count of number of timer that CTS was not received.")
-#define awc_RID_Stats_clear_RxAck 		awc_def_Stats_clear_RID(0x001C,0x0038,"Stats_RxAck",		"Count of number of expected ACKs that were received.")
-#define awc_RID_Stats_clear_RxCts 		awc_def_Stats_clear_RID(0x001E,0x003C,"Stats_RxCts",		"Count of number of expected CTSs that were received.")
-#define awc_RID_Stats_clear_TxAck 		awc_def_Stats_clear_RID(0x0020,0x0040,"Stats_TxAck",		"Count of number of ACKs transmitted.")
-#define awc_RID_Stats_clear_TxRts 		awc_def_Stats_clear_RID(0x0022,0x0044,"Stats_TxRts",		"Count of number of RTSs transmitted.")
-#define awc_RID_Stats_clear_TxCts 		awc_def_Stats_clear_RID(0x0024,0x0048,"Stats_TxCts",		"Count of number of CTSs transmitted.")
-#define awc_RID_Stats_clear_TxMc 		awc_def_Stats_clear_RID(0x0026,0x004C,"Stats_TxMc",		" LMAC count of multicast packets sent (uses 802.11  Address1).")
-#define awc_RID_Stats_clear_TxBc 		awc_def_Stats_clear_RID(0x0028,0x0050,"Stats_TxBc",		" LMAC count of broadcast packets sent (uses 802.11")
-#define awc_RID_Stats_clear_TxUcFrags 		awc_def_Stats_clear_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC",	" count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).")
-#define awc_RID_Stats_clear_TxUcPackets 	awc_def_Stats_clear_RID(0x002C,0x0058,"Stats_TxUcPackets",	"LMAC count of unicast packets that were ACKd (uses   802.11 Address 1).")
-#define awc_RID_Stats_clear_TxBeacon 		awc_def_Stats_clear_RID(0x002E,0x005C,"Stats_TxBeacon",	" Count of beacon packets transmitted.")
-#define awc_RID_Stats_clear_RxBeacon 		awc_def_Stats_clear_RID(0x0030,0x0060,"Stats_RxBeacon",	" Count of beacon packets received matching our BSSID.")
-#define awc_RID_Stats_clear_TxSinColl 		awc_def_Stats_clear_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **")
-#define awc_RID_Stats_clear_TxMulColl 		awc_def_Stats_clear_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **")
-#define awc_RID_Stats_clear_DefersNo 		awc_def_Stats_clear_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **")
-#define awc_RID_Stats_clear_DefersProt 		awc_def_Stats_clear_RID(0x0038,0x0070,"Stats_DefersProt",	" Transmit frames deferred due to protocol.")
-#define awc_RID_Stats_clear_DefersEngy 		awc_def_Stats_clear_RID(0x003A,0x0074,"Stats_DefersEngy",	" Transmit frames deferred due to energy detect.")
-#define awc_RID_Stats_clear_DupFram 		awc_def_Stats_clear_RID(0x003C,0x0078,"Stats_DupFram",	"  Duplicate receive frames and fragments.")
-#define awc_RID_Stats_clear_RxFragDisc 		awc_def_Stats_clear_RID(0x003E,0x007C,"Stats_RxFragDisc",	" Received partial frames. (each tally could indicate the  discarding of one or more fragments)")
-#define awc_RID_Stats_clear_TxAged 		awc_def_Stats_clear_RID(0x0040,0x0080,"Stats_TxAged",		"   Transmit packets exceeding maximum transmit lifetime. **")
-#define awc_RID_Stats_clear_RxAged 		awc_def_Stats_clear_RID(0x0042,0x0084,"Stats_RxAgedReceive",	" packets exceeding maximum receive lifetime. **")
-#define awc_RID_Stats_clear_LostSync_Max 	awc_def_Stats_clear_RID(0x0044,0x0088,"Stats_LostSync_Max",	" Lost sync with our cell due to maximum retries occuring. Retry")
-#define awc_RID_Stats_clear_LostSync_Mis 	awc_def_Stats_clear_RID(0x0046,0x008C,"Stats_LostSync_Mis",	"Lost sync with our cell due to missing too many beacons. sedBeacons")
-#define awc_RID_Stats_clear_LostSync_Arl 	awc_def_Stats_clear_RID(0x0048,0x0090,"Stats_LostSync_Arl",	"Lost sync with our cell due to Average Retry Level being  Exceeded  exceeded.")
-#define awc_RID_Stats_clear_LostSync_Dea 	awc_def_Stats_clear_RID(0x004A,0x0094,"Stats_LostSync_Dea",	"Lost sync with our cell due to being deauthenticated.,thed")
-#define awc_RID_Stats_clear_LostSync_Disa 	awc_def_Stats_clear_RID(0x004C,0x0098,"Stats_LostSync_Disa",	" Lost sync with our cell due to being disassociated. ssoced")
-#define awc_RID_Stats_clear_LostSync_Tsf 	awc_def_Stats_clear_RID(0x004E,0x009C,"Stats_LostSync_Tsf",	"Lost sync with our cell due to excessive change in TSF  Timingtiming.")
-#define awc_RID_Stats_clear_HostTxMc 		awc_def_Stats_clear_RID(0x0050,0x00A0,"Stats_HostTxMc",	"Count of multicast packets sent by the host.")
-#define awc_RID_Stats_clear_HostTxBc 		awc_def_Stats_clear_RID(0x0052,0x00A4,"Stats_HostTxBc",	"Count of broadcast packets sent by the host.")
-#define awc_RID_Stats_clear_HostTxUc 		awc_def_Stats_clear_RID(0x0054,0x00A8,"Stats_HostTxUc",	"Count of unicast packets sent by the host.")
-#define awc_RID_Stats_clear_HostTxFail 		awc_def_Stats_clear_RID(0x0056,0x00AC,"Stats_HostTxFail",	"  Count of host transmitted packets which failed.")
-#define awc_RID_Stats_clear_HostRxMc 		awc_def_Stats_clear_RID(0x0058,0x00B0,"Stats_HostRxMc",	"Count of host received multicast packets.")
-#define awc_RID_Stats_clear_HostRxBc 		awc_def_Stats_clear_RID(0x005A,0x00B4,"Stats_HostRxBc",	"Count of host received broadcast packets.")
-#define awc_RID_Stats_clear_HostRxUc 		awc_def_Stats_clear_RID(0x005C,0x00B8,"Stats_HostRxUc",	"Count of host received unicast packets.")
-#define awc_RID_Stats_clear_HostRxDiscar 	awc_def_Stats_clear_RID(0x005E,0x00BC,"Stats_HostRxDiscar",	"Count of host received packets discarded due to:\n  Host not enabling receive.\n  Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.")
-#define awc_RID_Stats_clear_HmacTxMc 		awc_def_Stats_clear_RID(0x0060,0x00C0,"Stats_HmacTxMc",	"Count of internally generated multicast (DA) packets.")
-#define awc_RID_Stats_clear_HmacTxBc 		awc_def_Stats_clear_RID(0x0062,0x00C4,"Stats_HmacTxBc",	"Count of internally generated broadcast (DA) packets.")
-#define awc_RID_Stats_clear_HmacTxUc 		awc_def_Stats_clear_RID(0x0064,0x00C8,"Stats_HmacTxUc",	"Count of internally generated unicast (DA) packets.")
-#define awc_RID_Stats_clear_HmacTxFail 		awc_def_Stats_clear_RID(0x0066,0x00CC,"Stats_HmacTxFail",	"  Count of internally generated transmit packets that failed.")
-#define awc_RID_Stats_clear_HmacRxMc 		awc_def_Stats_clear_RID(0x0068,0x00D0,"Stats_HmacRxMc",	"Count of internally received multicast (DA) packets.")
-#define awc_RID_Stats_clear_HmacRxBc 		awc_def_Stats_clear_RID(0x006A,0x00D4,"Stats_HmacRxBc",	"Count of internally received broadcast (DA) packets.")
-#define awc_RID_Stats_clear_HmacRxUc 		awc_def_Stats_clear_RID(0x006C,0x00D8,"Stats_HmacRxUc",	"Count of internally received multicast (DA) packets.")
-#define awc_RID_Stats_clear_HmacRxDisca 	awc_def_Stats_clear_RID(0x006E,0x00DC,"Stats_HmacRxDisca",	" Count of internally received packets that were discarded  (usually because the destination address is not for the host).")
-#define awc_RID_Stats_clear_HmacRxAcce 		awc_def_Stats_clear_RID(0x0070,0x00E0,"Stats_HmacRxAcce",	"  Count of internally received packets that were accepted")
-#define awc_RID_Stats_clear_SsidMismatch 	awc_def_Stats_clear_RID(0x0072,0x00E4,"Stats_SsidMismatch",	" Count of SSID mismatches.")
-#define awc_RID_Stats_clear_ApMismatch 		awc_def_Stats_clear_RID(0x0074,0x00E8,"Stats_ApMismatch",	"  Count of specified AP mismatches.")
-#define awc_RID_Stats_clear_RatesMismatc 	awc_def_Stats_clear_RID(0x0076,0x00EC,"Stats_RatesMismatc",	" Count of rate mismatches.")
-#define awc_RID_Stats_clear_AuthReject 		awc_def_Stats_clear_RID(0x0078,0x00F0,"Stats_AuthReject",	"  Count of authentication rejections.")
-#define awc_RID_Stats_clear_AuthTimeout 	awc_def_Stats_clear_RID(0x007A,0x00F4,"Stats_AuthTimeout",	" Count of authentication timeouts.")
-#define awc_RID_Stats_clear_AssocReject 	awc_def_Stats_clear_RID(0x007C,0x00F8,"Stats_AssocReject",	" Count of association rejections.")
-#define awc_RID_Stats_clear_AssocTimeout 	awc_def_Stats_clear_RID(0x007E,0x00FC,"Stats_AssocTimeout",	" Count of association timeouts.")
-#define awc_RID_Stats_clear_NewReason 		awc_def_Stats_clear_RID(0x0080,0x0100,"Stats_NewReason",	"Count of reason/status codes of greater than 19.  (Values of 0 = successful are not counted)")
-#define awc_RID_Stats_clear_AuthFail_1 		awc_def_Stats_clear_RID(0x0082,0x0104,"Stats_AuthFail_1",	"Unspecified reason.")
-#define awc_RID_Stats_clear_AuthFail_2 		awc_def_Stats_clear_RID(0x0084,0x0108,"Stats_AuthFail_2",	"Previous authentication no longer valid.")
-#define awc_RID_Stats_clear_AuthFail_3 		awc_def_Stats_clear_RID(0x0086,0x010C,"Stats_AuthFail_3",	"Deauthenticated because sending station is leaving (has left) IBSS or ESS.")
-#define awc_RID_Stats_clear_AuthFail_4 		awc_def_Stats_clear_RID(0x0088,0x0110,"Stats_AuthFail_4",	"Disassociated due to inactivity")
-#define awc_RID_Stats_clear_AuthFail_5 		awc_def_Stats_clear_RID(0x008A,0x0114,"Stats_AuthFail_5",	"Disassociated because AP is unable to handle all currently  associated stations.")
-#define awc_RID_Stats_clear_AuthFail_6 		awc_def_Stats_clear_RID(0x008C,0x0118,"Stats_AuthFail_6",	"Class 2 Frame received from non-Authenticated station.")
-#define awc_RID_Stats_clear_AuthFail_7 		awc_def_Stats_clear_RID(0x008E,0x011C,"Stats_AuthFail_7",	"Class 3 Frame received from non-Associated station.")
-#define awc_RID_Stats_clear_AuthFail_8 		awc_def_Stats_clear_RID(0x0090,0x0120,"Stats_AuthFail_8",	"Disassociated because sending station is leaving (has left)")
-#define awc_RID_Stats_clear_AuthFail_9 		awc_def_Stats_clear_RID(0x0092,0x0124,"Stats_AuthFail_9",	"Station requesting (Re)Association is not Authenticated")
-#define awc_RID_Stats_clear_AuthFail_10 	awc_def_Stats_clear_RID(0x0094,0x0128,"Stats_AuthFail_10",	"Cannot support all requested capabilities in the Capability")
-#define awc_RID_Stats_clear_AuthFail_11 	awc_def_Stats_clear_RID(0x0096,0x012C,"Stats_AuthFail_11",	"Reassociation denied due to inability to confirm")
-#define awc_RID_Stats_clear_AuthFail_12 	awc_def_Stats_clear_RID(0x0098,0x0130,"Stats_AuthFail_12",	"Association denied due to reason outside the scope of the 802.11")
-#define awc_RID_Stats_clear_AuthFail_13 	awc_def_Stats_clear_RID(0x009A,0x0134,"Stats_AuthFail_13",	"Responding station does not support the specified Auth Alogorithm")
-#define awc_RID_Stats_clear_AuthFail_14 	awc_def_Stats_clear_RID(0x009C,0x0138,"Stats_AuthFail_14",	"Received an out of sequence Authentication Frame.")
-#define awc_RID_Stats_clear_AuthFail_15 	awc_def_Stats_clear_RID(0x009E,0x013C,"Stats_AuthFail_15",	"Authentication rejected due to challenge failure.")
-#define awc_RID_Stats_clear_AuthFail_16 	awc_def_Stats_clear_RID(0x00A0,0x0140,"Stats_AuthFail_16",	"Authentication rejected due to timeout waiting for next  frame in sequence.")
-#define awc_RID_Stats_clear_AuthFail_17 	awc_def_Stats_clear_RID(0x00A2,0x0144,"Stats_AuthFail_17",	"Association denied because AP is unable to handle  additional associated stations.")
-#define awc_RID_Stats_clear_AuthFail_18 	awc_def_Stats_clear_RID(0x00A4,0x0148,"Stats_AuthFail_18",	"Association denied due to requesting station not supportingall basic rates.")
-#define awc_RID_Stats_clear_AuthFail_19 	awc_def_Stats_clear_RID(0x00A6,0x014C,"Stats_AuthFail_19",	"Reserved")
-#define awc_RID_Stats_clear_RxMan 		awc_def_Stats_clear_RID(0x00A8,0x0150,"Stats_RxMan",		" Count of management packets received and handled.")
-#define awc_RID_Stats_clear_TxMan 		awc_def_Stats_clear_RID(0x00AA,0x0154,"Stats_TxMan",		" Count of management packets transmitted.")
-#define awc_RID_Stats_clear_RxRefresh 		awc_def_Stats_clear_RID(0x00AC,0x0158,"Stats_RxRefresh",	" Count of null data packets received.")
-#define awc_RID_Stats_clear_TxRefresh 		awc_def_Stats_clear_RID(0x00AE,0x015C,"Stats_TxRefresh",	" Count of null data packets transmitted.")
-#define awc_RID_Stats_clear_RxPoll 		awc_def_Stats_clear_RID(0x00B0,0x0160,"Stats_RxPoll",		"Count of PS-Poll packets received.")
-#define awc_RID_Stats_clear_TxPoll 		awc_def_Stats_clear_RID(0x00B2,0x0164,"Stats_TxPoll",		"Count of PS-Poll packets transmitted.")
-#define awc_RID_Stats_clear_HostRetries 	awc_def_Stats_clear_RID(0x00B4,0x0168,"Stats_HostRetries",	" Count of long and short retries used to transmit host packets  (does not include first attempt).")
-#define awc_RID_Stats_clear_LostSync_HostReq 	awc_def_Stats_clear_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.")
-#define awc_RID_Stats_clear_HostTxBytes 	awc_def_Stats_clear_RID(0x00B8,0x0170,"Stats_HostTxBytes",	" Count of bytes transferred from the host.")
-#define awc_RID_Stats_clear_HostRxBytes 	awc_def_Stats_clear_RID(0x00BA,0x0174,"Stats_HostRxBytes",	" Count of bytes transferred to the host.")
-#define awc_RID_Stats_clear_ElapsedUsec 	awc_def_Stats_clear_RID(0x00BC,0x0178,"Stats_ElapsedUsec",	" Total time since power up (or clear) in microseconds.")
-#define awc_RID_Stats_clear_ElapsedSec 		awc_def_Stats_clear_RID(0x00BE,0x017C,"Stats_ElapsedSec",	" Total time since power up (or clear) in seconds.")
-#define awc_RID_Stats_clear_LostSyncBett 	awc_def_Stats_clear_RID(0x00C0,0x0180,"Stats_LostSyncBett",	"Lost Sync to switch to a better access point")
-
-
-
-#define awc_RID_Stats16_RidLen 		awc_def_Stats16_RID(0x0000,0x0000,"RidLen",		"Length of the RID including the length field.")
-#define awc_RID_Stats16_RxOverrunErr 	awc_def_Stats16_RID(0x0002,0x0004,"Stats_RxOverrunErr",	"Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)")
-#define awc_RID_Stats16_RxPlcpCrcErr 	awc_def_Stats16_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr",	"PLCP header checksum errors (CRC16).")
-#define awc_RID_Stats16_RxPlcpFormat 	awc_def_Stats16_RID(0x0006,0x000C,"Stats_RxPlcpFormat",	"PLCP format errors.")
-#define awc_RID_Stats16_RxPlcpLength 	awc_def_Stats16_RID(0x0008,0x0010,"Stats_RxPlcpLength",	"PLCP length is incorrect.")
-#define awc_RID_Stats16_RxMacCrcErr 	awc_def_Stats16_RID(0x000A,0x0014,"Stats_RxMacCrcErr",	"Count of MAC CRC32 errors.")
-#define awc_RID_Stats16_RxMacCrcOk 	awc_def_Stats16_RID(0x000C,0x0018,"Stats_RxMacCrcOk",	"Count of MAC CRC32 received correctly.")
-#define awc_RID_Stats16_RxWepErr 	awc_def_Stats16_RID(0x000E,0x001C,"Stats_RxWepErr",	"Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)")
-#define awc_RID_Stats16_RxWepOk 	awc_def_Stats16_RID(0x0010,0x0020,"Stats_RxWepOk",	"Count of all WEP ICV checks that passed. (this value is  included in Stats_RxMacCrcOk)")
-#define awc_RID_Stats16_RetryLong 	awc_def_Stats16_RID(0x0012,0x0024,"Stats_RetryLongCount",	"of all long retries. (Does not include first attempt for a packet).")
-#define awc_RID_Stats16_RetryShort 	awc_def_Stats16_RID(0x0014,0x0028,"Stats_RetryShort",	"Count of all short retries. (Does not include first attempt for   a packet).")
-#define awc_RID_Stats16_MaxRetries 	awc_def_Stats16_RID(0x0016,0x002C,"Stats_MaxRetries",	"Count of number of packets that max-retried -- ie were  never ACKd.")
-#define awc_RID_Stats16_NoAck 		awc_def_Stats16_RID(0x0018,0x0030,"Stats_NoAck",		"Count of number of times that ACK was not received.")
-#define awc_RID_Stats16_NoCts 		awc_def_Stats16_RID(0x001A,0x0034,"Stats_NoCts",		"Count of number of timer that CTS was not received.")
-#define awc_RID_Stats16_RxAck 		awc_def_Stats16_RID(0x001C,0x0038,"Stats_RxAck",		"Count of number of expected ACKs that were received.")
-#define awc_RID_Stats16_RxCts 		awc_def_Stats16_RID(0x001E,0x003C,"Stats_RxCts",		"Count of number of expected CTSs that were received.")
-#define awc_RID_Stats16_TxAck 		awc_def_Stats16_RID(0x0020,0x0040,"Stats_TxAck",		"Count of number of ACKs transmitted.")
-#define awc_RID_Stats16_TxRts 		awc_def_Stats16_RID(0x0022,0x0044,"Stats_TxRts",		"Count of number of RTSs transmitted.")
-#define awc_RID_Stats16_TxCts 		awc_def_Stats16_RID(0x0024,0x0048,"Stats_TxCts",		"Count of number of CTSs transmitted.")
-#define awc_RID_Stats16_TxMc 		awc_def_Stats16_RID(0x0026,0x004C,"Stats_TxMc",		" LMAC count of multicast packets sent (uses 802.11  Address1).")
-#define awc_RID_Stats16_TxBc 		awc_def_Stats16_RID(0x0028,0x0050,"Stats_TxBc",		" LMAC count of broadcast packets sent (uses 802.11")
-#define awc_RID_Stats16_TxUcFrags 	awc_def_Stats16_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC",	" count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).")
-#define awc_RID_Stats16_TxUcPackets 	awc_def_Stats16_RID(0x002C,0x0058,"Stats_TxUcPackets",	"LMAC count of unicast packets that were ACKd (uses   802.11 Address 1).")
-#define awc_RID_Stats16_TxBeacon 	awc_def_Stats16_RID(0x002E,0x005C,"Stats_TxBeacon",	" Count of beacon packets transmitted.")
-#define awc_RID_Stats16_RxBeacon 	awc_def_Stats16_RID(0x0030,0x0060,"Stats_RxBeacon",	" Count of beacon packets received matching our BSSID.")
-#define awc_RID_Stats16_TxSinColl 	awc_def_Stats16_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **")
-#define awc_RID_Stats16_TxMulColl 	awc_def_Stats16_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **")
-#define awc_RID_Stats16_DefersNo 	awc_def_Stats16_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **")
-#define awc_RID_Stats16_DefersProt 	awc_def_Stats16_RID(0x0038,0x0070,"Stats_DefersProt",	" Transmit frames deferred due to protocol.")
-#define awc_RID_Stats16_DefersEngy 	awc_def_Stats16_RID(0x003A,0x0074,"Stats_DefersEngy",	" Transmit frames deferred due to energy detect.")
-#define awc_RID_Stats16_DupFram 	awc_def_Stats16_RID(0x003C,0x0078,"Stats_DupFram",	"  Duplicate receive frames and fragments.")
-#define awc_RID_Stats16_RxFragDisc 	awc_def_Stats16_RID(0x003E,0x007C,"Stats_RxFragDisc",	" Received partial frames. (each tally could indicate the  discarding of one or more fragments)")
-#define awc_RID_Stats16_TxAged 		awc_def_Stats16_RID(0x0040,0x0080,"Stats_TxAged",		"   Transmit packets exceeding maximum transmit lifetime. **")
-#define awc_RID_Stats16_RxAged 		awc_def_Stats16_RID(0x0042,0x0084,"Stats_RxAgedReceive",	" packets exceeding maximum receive lifetime. **")
-#define awc_RID_Stats16_LostSync_Max 	awc_def_Stats16_RID(0x0044,0x0088,"Stats_LostSync_Max",	" Lost sync with our cell due to maximum retries occuring. Retry")
-#define awc_RID_Stats16_LostSync_Mis 	awc_def_Stats16_RID(0x0046,0x008C,"Stats_LostSync_Mis",	"Lost sync with our cell due to missing too many beacons. sedBeacons")
-#define awc_RID_Stats16_LostSync_Arl 	awc_def_Stats16_RID(0x0048,0x0090,"Stats_LostSync_Arl",	"Lost sync with our cell due to Average Retry Level being  Exceeded  exceeded.")
-#define awc_RID_Stats16_LostSync_Dea 	awc_def_Stats16_RID(0x004A,0x0094,"Stats_LostSync_Dea",	"Lost sync with our cell due to being deauthenticated.,thed")
-#define awc_RID_Stats16_LostSync_Disa 	awc_def_Stats16_RID(0x004C,0x0098,"Stats_LostSync_Disa",	" Lost sync with our cell due to being disassociated. ssoced")
-#define awc_RID_Stats16_LostSync_Tsf 	awc_def_Stats16_RID(0x004E,0x009C,"Stats_LostSync_Tsf",	"Lost sync with our cell due to excessive change in TSF  Timingtiming.")
-#define awc_RID_Stats16_HostTxMc 	awc_def_Stats16_RID(0x0050,0x00A0,"Stats_HostTxMc",	"Count of multicast packets sent by the host.")
-#define awc_RID_Stats16_HostTxBc 	awc_def_Stats16_RID(0x0052,0x00A4,"Stats_HostTxBc",	"Count of broadcast packets sent by the host.")
-#define awc_RID_Stats16_HostTxUc 	awc_def_Stats16_RID(0x0054,0x00A8,"Stats_HostTxUc",	"Count of unicast packets sent by the host.")
-#define awc_RID_Stats16_HostTxFail 	awc_def_Stats16_RID(0x0056,0x00AC,"Stats_HostTxFail",	"  Count of host transmitted packets which failed.")
-#define awc_RID_Stats16_HostRxMc 	awc_def_Stats16_RID(0x0058,0x00B0,"Stats_HostRxMc",	"Count of host received multicast packets.")
-#define awc_RID_Stats16_HostRxBc 	awc_def_Stats16_RID(0x005A,0x00B4,"Stats_HostRxBc",	"Count of host received broadcast packets.")
-#define awc_RID_Stats16_HostRxUc 	awc_def_Stats16_RID(0x005C,0x00B8,"Stats_HostRxUc",	"Count of host received unicast packets.")
-#define awc_RID_Stats16_HostRxDiscar 	awc_def_Stats16_RID(0x005E,0x00BC,"Stats_HostRxDiscar",	"Count of host received packets discarded due to:\n  Host not enabling receive.\n  Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.")
-#define awc_RID_Stats16_HmacTxMc 	awc_def_Stats16_RID(0x0060,0x00C0,"Stats_HmacTxMc",	"Count of internally generated multicast (DA) packets.")
-#define awc_RID_Stats16_HmacTxBc 	awc_def_Stats16_RID(0x0062,0x00C4,"Stats_HmacTxBc",	"Count of internally generated broadcast (DA) packets.")
-#define awc_RID_Stats16_HmacTxUc 	awc_def_Stats16_RID(0x0064,0x00C8,"Stats_HmacTxUc",	"Count of internally generated unicast (DA) packets.")
-#define awc_RID_Stats16_HmacTxFail 	awc_def_Stats16_RID(0x0066,0x00CC,"Stats_HmacTxFail",	"  Count of internally generated transmit packets that failed.")
-#define awc_RID_Stats16_HmacRxMc 	awc_def_Stats16_RID(0x0068,0x00D0,"Stats_HmacRxMc",	"Count of internally received multicast (DA) packets.")
-#define awc_RID_Stats16_HmacRxBc 	awc_def_Stats16_RID(0x006A,0x00D4,"Stats_HmacRxBc",	"Count of internally received broadcast (DA) packets.")
-#define awc_RID_Stats16_HmacRxUc 	awc_def_Stats16_RID(0x006C,0x00D8,"Stats_HmacRxUc",	"Count of internally received multicast (DA) packets.")
-#define awc_RID_Stats16_HmacRxDisca 	awc_def_Stats16_RID(0x006E,0x00DC,"Stats_HmacRxDisca",	" Count of internally received packets that were discarded  (usually because the destination address is not for the host).")
-#define awc_RID_Stats16_HmacRxAcce 	awc_def_Stats16_RID(0x0070,0x00E0,"Stats_HmacRxAcce",	"  Count of internally received packets that were accepted")
-#define awc_RID_Stats16_SsidMismatch 	awc_def_Stats16_RID(0x0072,0x00E4,"Stats_SsidMismatch",	" Count of SSID mismatches.")
-#define awc_RID_Stats16_ApMismatch 	awc_def_Stats16_RID(0x0074,0x00E8,"Stats_ApMismatch",	"  Count of specified AP mismatches.")
-#define awc_RID_Stats16_RatesMismatc 	awc_def_Stats16_RID(0x0076,0x00EC,"Stats_RatesMismatc",	" Count of rate mismatches.")
-#define awc_RID_Stats16_AuthReject 	awc_def_Stats16_RID(0x0078,0x00F0,"Stats_AuthReject",	"  Count of authentication rejections.")
-#define awc_RID_Stats16_AuthTimeout 	awc_def_Stats16_RID(0x007A,0x00F4,"Stats_AuthTimeout",	" Count of authentication timeouts.")
-#define awc_RID_Stats16_AssocReject 	awc_def_Stats16_RID(0x007C,0x00F8,"Stats_AssocReject",	" Count of association rejections.")
-#define awc_RID_Stats16_AssocTimeout 	awc_def_Stats16_RID(0x007E,0x00FC,"Stats_AssocTimeout",	" Count of association timeouts.")
-#define awc_RID_Stats16_NewReason 	awc_def_Stats16_RID(0x0080,0x0100,"Stats_NewReason",	"Count of reason/status codes of greater than 19.  (Values of 0 = successful are not counted)")
-#define awc_RID_Stats16_AuthFail_1 	awc_def_Stats16_RID(0x0082,0x0104,"Stats_AuthFail_1",	"Unspecified reason.")
-#define awc_RID_Stats16_AuthFail_2 	awc_def_Stats16_RID(0x0084,0x0108,"Stats_AuthFail_2",	"Previous authentication no longer valid.")
-#define awc_RID_Stats16_AuthFail_3 	awc_def_Stats16_RID(0x0086,0x010C,"Stats_AuthFail_3",	"Deauthenticated because sending station is leaving (has left) IBSS or ESS.")
-#define awc_RID_Stats16_AuthFail_4 	awc_def_Stats16_RID(0x0088,0x0110,"Stats_AuthFail_4",	"Disassociated due to inactivity")
-#define awc_RID_Stats16_AuthFail_5 	awc_def_Stats16_RID(0x008A,0x0114,"Stats_AuthFail_5",	"Disassociated because AP is unable to handle all currently  associated stations.")
-#define awc_RID_Stats16_AuthFail_6 	awc_def_Stats16_RID(0x008C,0x0118,"Stats_AuthFail_6",	"Class 2 Frame received from non-Authenticated station.")
-#define awc_RID_Stats16_AuthFail_7 	awc_def_Stats16_RID(0x008E,0x011C,"Stats_AuthFail_7",	"Class 3 Frame received from non-Associated station.")
-#define awc_RID_Stats16_AuthFail_8 	awc_def_Stats16_RID(0x0090,0x0120,"Stats_AuthFail_8",	"Disassociated because sending station is leaving (has left)")
-#define awc_RID_Stats16_AuthFail_9 	awc_def_Stats16_RID(0x0092,0x0124,"Stats_AuthFail_9",	"Station requesting (Re)Association is not Authenticated")
-#define awc_RID_Stats16_AuthFail_10 	awc_def_Stats16_RID(0x0094,0x0128,"Stats_AuthFail_10",	"Cannot support all requested capabilities in the Capability")
-#define awc_RID_Stats16_AuthFail_11 	awc_def_Stats16_RID(0x0096,0x012C,"Stats_AuthFail_11",	"Reassociation denied due to inability to confirm")
-#define awc_RID_Stats16_AuthFail_12 	awc_def_Stats16_RID(0x0098,0x0130,"Stats_AuthFail_12",	"Association denied due to reason outside the scope of the 802.11")
-#define awc_RID_Stats16_AuthFail_13 	awc_def_Stats16_RID(0x009A,0x0134,"Stats_AuthFail_13",	"Responding station does not support the specified Auth Alogorithm")
-#define awc_RID_Stats16_AuthFail_14 	awc_def_Stats16_RID(0x009C,0x0138,"Stats_AuthFail_14",	"Received an out of sequence Authentication Frame.")
-#define awc_RID_Stats16_AuthFail_15 	awc_def_Stats16_RID(0x009E,0x013C,"Stats_AuthFail_15",	"Authentication rejected due to challenge failure.")
-#define awc_RID_Stats16_AuthFail_16 	awc_def_Stats16_RID(0x00A0,0x0140,"Stats_AuthFail_16",	"Authentication rejected due to timeout waiting for next  frame in sequence.")
-#define awc_RID_Stats16_AuthFail_17 	awc_def_Stats16_RID(0x00A2,0x0144,"Stats_AuthFail_17",	"Association denied because AP is unable to handle  additional associated stations.")
-#define awc_RID_Stats16_AuthFail_18 	awc_def_Stats16_RID(0x00A4,0x0148,"Stats_AuthFail_18",	"Association denied due to requesting station not supportingall basic rates.")
-#define awc_RID_Stats16_AuthFail_19 	awc_def_Stats16_RID(0x00A6,0x014C,"Stats_AuthFail_19",	"Reserved")
-#define awc_RID_Stats16_RxMan 		awc_def_Stats16_RID(0x00A8,0x0150,"Stats_RxMan",		" Count of management packets received and handled.")
-#define awc_RID_Stats16_TxMan 		awc_def_Stats16_RID(0x00AA,0x0154,"Stats_TxMan",		" Count of management packets transmitted.")
-#define awc_RID_Stats16_RxRefresh 	awc_def_Stats16_RID(0x00AC,0x0158,"Stats_RxRefresh",	" Count of null data packets received.")
-#define awc_RID_Stats16_TxRefresh 	awc_def_Stats16_RID(0x00AE,0x015C,"Stats_TxRefresh",	" Count of null data packets transmitted.")
-#define awc_RID_Stats16_RxPoll 		awc_def_Stats16_RID(0x00B0,0x0160,"Stats_RxPoll",		"Count of PS-Poll packets received.")
-#define awc_RID_Stats16_TxPoll 		awc_def_Stats16_RID(0x00B2,0x0164,"Stats_TxPoll",		"Count of PS-Poll packets transmitted.")
-#define awc_RID_Stats16_HostRetries 	awc_def_Stats16_RID(0x00B4,0x0168,"Stats_HostRetries",	" Count of long and short retries used to transmit host packets  (does not include first attempt).")
-#define awc_RID_Stats16_LostSync_HostReq awc_def_Stats16_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.")
-#define awc_RID_Stats16_HostTxBytes 	awc_def_Stats16_RID(0x00B8,0x0170,"Stats_HostTxBytes",	" Count of bytes transferred from the host.")
-#define awc_RID_Stats16_HostRxBytes 	awc_def_Stats16_RID(0x00BA,0x0174,"Stats_HostRxBytes",	" Count of bytes transferred to the host.")
-#define awc_RID_Stats16_ElapsedUsec 	awc_def_Stats16_RID(0x00BC,0x0178,"Stats_ElapsedUsec",	" Total time since power up (or clear) in microseconds.")
-#define awc_RID_Stats16_ElapsedSec 	awc_def_Stats16_RID(0x00BE,0x017C,"Stats_ElapsedSec",	" Total time since power up (or clear) in seconds.")
-#define awc_RID_Stats16_LostSyncBett 	awc_def_Stats16_RID(0x00C0,0x0180,"Stats_LostSyncBett",	"Lost Sync to switch to a better access point")
-
-
-
-#define awc_RID_Stats16_delta_RidLen 		awc_def_Stats16_delta_RID(0x0000,0x0000,"RidLen",		"Length of the RID including the length field.")
-#define awc_RID_Stats16_delta_RxOverrunErr 	awc_def_Stats16_delta_RID(0x0002,0x0004,"Stats_RxOverrunErr",	"Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)")
-#define awc_RID_Stats16_delta_RxPlcpCrcErr 	awc_def_Stats16_delta_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr",	"PLCP header checksum errors (CRC16).")
-#define awc_RID_Stats16_delta_RxPlcpFormat 	awc_def_Stats16_delta_RID(0x0006,0x000C,"Stats_RxPlcpFormat",	"PLCP format errors.")
-#define awc_RID_Stats16_delta_RxPlcpLength 	awc_def_Stats16_delta_RID(0x0008,0x0010,"Stats_RxPlcpLength",	"PLCP length is incorrect.")
-#define awc_RID_Stats16_delta_RxMacCrcErr 	awc_def_Stats16_delta_RID(0x000A,0x0014,"Stats_RxMacCrcErr",	"Count of MAC CRC32 errors.")
-#define awc_RID_Stats16_delta_RxMacCrcOk 	awc_def_Stats16_delta_RID(0x000C,0x0018,"Stats_RxMacCrcOk",	"Count of MAC CRC32 received correctly.")
-#define awc_RID_Stats16_delta_RxWepErr 		awc_def_Stats16_delta_RID(0x000E,0x001C,"Stats_RxWepErr",	"Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)")
-#define awc_RID_Stats16_delta_RxWepOk 		awc_def_Stats16_delta_RID(0x0010,0x0020,"Stats_RxWepOk",	"Count of all WEP ICV checks that passed. (this value is  included in Stats_RxMacCrcOk)")
-#define awc_RID_Stats16_delta_RetryLong 	awc_def_Stats16_delta_RID(0x0012,0x0024,"Stats_RetryLongCount",	"of all long retries. (Does not include first attempt for a packet).")
-#define awc_RID_Stats16_delta_RetryShort 	awc_def_Stats16_delta_RID(0x0014,0x0028,"Stats_RetryShort",	"Count of all short retries. (Does not include first attempt for   a packet).")
-#define awc_RID_Stats16_delta_MaxRetries 	awc_def_Stats16_delta_RID(0x0016,0x002C,"Stats_MaxRetries",	"Count of number of packets that max-retried -- ie were  never ACKd.")
-#define awc_RID_Stats16_delta_NoAck 		awc_def_Stats16_delta_RID(0x0018,0x0030,"Stats_NoAck",		"Count of number of times that ACK was not received.")
-#define awc_RID_Stats16_delta_NoCts 		awc_def_Stats16_delta_RID(0x001A,0x0034,"Stats_NoCts",		"Count of number of timer that CTS was not received.")
-#define awc_RID_Stats16_delta_RxAck 		awc_def_Stats16_delta_RID(0x001C,0x0038,"Stats_RxAck",		"Count of number of expected ACKs that were received.")
-#define awc_RID_Stats16_delta_RxCts 		awc_def_Stats16_delta_RID(0x001E,0x003C,"Stats_RxCts",		"Count of number of expected CTSs that were received.")
-#define awc_RID_Stats16_delta_TxAck 		awc_def_Stats16_delta_RID(0x0020,0x0040,"Stats_TxAck",		"Count of number of ACKs transmitted.")
-#define awc_RID_Stats16_delta_TxRts 		awc_def_Stats16_delta_RID(0x0022,0x0044,"Stats_TxRts",		"Count of number of RTSs transmitted.")
-#define awc_RID_Stats16_delta_TxCts 		awc_def_Stats16_delta_RID(0x0024,0x0048,"Stats_TxCts",		"Count of number of CTSs transmitted.")
-#define awc_RID_Stats16_delta_TxMc 		awc_def_Stats16_delta_RID(0x0026,0x004C,"Stats_TxMc",		" LMAC count of multicast packets sent (uses 802.11  Address1).")
-#define awc_RID_Stats16_delta_TxBc 		awc_def_Stats16_delta_RID(0x0028,0x0050,"Stats_TxBc",		" LMAC count of broadcast packets sent (uses 802.11")
-#define awc_RID_Stats16_delta_TxUcFrags 	awc_def_Stats16_delta_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC",	" count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).")
-#define awc_RID_Stats16_delta_TxUcPackets 	awc_def_Stats16_delta_RID(0x002C,0x0058,"Stats_TxUcPackets",	"LMAC count of unicast packets that were ACKd (uses   802.11 Address 1).")
-#define awc_RID_Stats16_delta_TxBeacon 		awc_def_Stats16_delta_RID(0x002E,0x005C,"Stats_TxBeacon",	" Count of beacon packets transmitted.")
-#define awc_RID_Stats16_delta_RxBeacon 		awc_def_Stats16_delta_RID(0x0030,0x0060,"Stats_RxBeacon",	" Count of beacon packets received matching our BSSID.")
-#define awc_RID_Stats16_delta_TxSinColl 	awc_def_Stats16_delta_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **")
-#define awc_RID_Stats16_delta_TxMulColl 	awc_def_Stats16_delta_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **")
-#define awc_RID_Stats16_delta_DefersNo 		awc_def_Stats16_delta_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **")
-#define awc_RID_Stats16_delta_DefersProt 	awc_def_Stats16_delta_RID(0x0038,0x0070,"Stats_DefersProt",	" Transmit frames deferred due to protocol.")
-#define awc_RID_Stats16_delta_DefersEngy 	awc_def_Stats16_delta_RID(0x003A,0x0074,"Stats_DefersEngy",	" Transmit frames deferred due to energy detect.")
-#define awc_RID_Stats16_delta_DupFram 		awc_def_Stats16_delta_RID(0x003C,0x0078,"Stats_DupFram",	"  Duplicate receive frames and fragments.")
-#define awc_RID_Stats16_delta_RxFragDisc 	awc_def_Stats16_delta_RID(0x003E,0x007C,"Stats_RxFragDisc",	" Received partial frames. (each tally could indicate the  discarding of one or more fragments)")
-#define awc_RID_Stats16_delta_TxAged 		awc_def_Stats16_delta_RID(0x0040,0x0080,"Stats_TxAged",		"   Transmit packets exceeding maximum transmit lifetime. **")
-#define awc_RID_Stats16_delta_RxAged 		awc_def_Stats16_delta_RID(0x0042,0x0084,"Stats_RxAgedReceive",	" packets exceeding maximum receive lifetime. **")
-#define awc_RID_Stats16_delta_LostSync_Max 	awc_def_Stats16_delta_RID(0x0044,0x0088,"Stats_LostSync_Max",	" Lost sync with our cell due to maximum retries occuring. Retry")
-#define awc_RID_Stats16_delta_LostSync_Mis 	awc_def_Stats16_delta_RID(0x0046,0x008C,"Stats_LostSync_Mis",	"Lost sync with our cell due to missing too many beacons. sedBeacons")
-#define awc_RID_Stats16_delta_LostSync_Arl 	awc_def_Stats16_delta_RID(0x0048,0x0090,"Stats_LostSync_Arl",	"Lost sync with our cell due to Average Retry Level being  Exceeded  exceeded.")
-#define awc_RID_Stats16_delta_LostSync_Dea 	awc_def_Stats16_delta_RID(0x004A,0x0094,"Stats_LostSync_Dea",	"Lost sync with our cell due to being deauthenticated.,thed")
-#define awc_RID_Stats16_delta_LostSync_Disa 	awc_def_Stats16_delta_RID(0x004C,0x0098,"Stats_LostSync_Disa",	" Lost sync with our cell due to being disassociated. ssoced")
-#define awc_RID_Stats16_delta_LostSync_Tsf 	awc_def_Stats16_delta_RID(0x004E,0x009C,"Stats_LostSync_Tsf",	"Lost sync with our cell due to excessive change in TSF  Timingtiming.")
-#define awc_RID_Stats16_delta_HostTxMc 		awc_def_Stats16_delta_RID(0x0050,0x00A0,"Stats_HostTxMc",	"Count of multicast packets sent by the host.")
-#define awc_RID_Stats16_delta_HostTxBc 		awc_def_Stats16_delta_RID(0x0052,0x00A4,"Stats_HostTxBc",	"Count of broadcast packets sent by the host.")
-#define awc_RID_Stats16_delta_HostTxUc 		awc_def_Stats16_delta_RID(0x0054,0x00A8,"Stats_HostTxUc",	"Count of unicast packets sent by the host.")
-#define awc_RID_Stats16_delta_HostTxFail 	awc_def_Stats16_delta_RID(0x0056,0x00AC,"Stats_HostTxFail",	"  Count of host transmitted packets which failed.")
-#define awc_RID_Stats16_delta_HostRxMc 		awc_def_Stats16_delta_RID(0x0058,0x00B0,"Stats_HostRxMc",	"Count of host received multicast packets.")
-#define awc_RID_Stats16_delta_HostRxBc 		awc_def_Stats16_delta_RID(0x005A,0x00B4,"Stats_HostRxBc",	"Count of host received broadcast packets.")
-#define awc_RID_Stats16_delta_HostRxUc 		awc_def_Stats16_delta_RID(0x005C,0x00B8,"Stats_HostRxUc",	"Count of host received unicast packets.")
-#define awc_RID_Stats16_delta_HostRxDiscar 	awc_def_Stats16_delta_RID(0x005E,0x00BC,"Stats_HostRxDiscar",	"Count of host received packets discarded due to:\n  Host not enabling receive.\n  Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.")
-#define awc_RID_Stats16_delta_HmacTxMc 		awc_def_Stats16_delta_RID(0x0060,0x00C0,"Stats_HmacTxMc",	"Count of internally generated multicast (DA) packets.")
-#define awc_RID_Stats16_delta_HmacTxBc 		awc_def_Stats16_delta_RID(0x0062,0x00C4,"Stats_HmacTxBc",	"Count of internally generated broadcast (DA) packets.")
-#define awc_RID_Stats16_delta_HmacTxUc 		awc_def_Stats16_delta_RID(0x0064,0x00C8,"Stats_HmacTxUc",	"Count of internally generated unicast (DA) packets.")
-#define awc_RID_Stats16_delta_HmacTxFail 	awc_def_Stats16_delta_RID(0x0066,0x00CC,"Stats_HmacTxFail",	"  Count of internally generated transmit packets that failed.")
-#define awc_RID_Stats16_delta_HmacRxMc 		awc_def_Stats16_delta_RID(0x0068,0x00D0,"Stats_HmacRxMc",	"Count of internally received multicast (DA) packets.")
-#define awc_RID_Stats16_delta_HmacRxBc 		awc_def_Stats16_delta_RID(0x006A,0x00D4,"Stats_HmacRxBc",	"Count of internally received broadcast (DA) packets.")
-#define awc_RID_Stats16_delta_HmacRxUc 		awc_def_Stats16_delta_RID(0x006C,0x00D8,"Stats_HmacRxUc",	"Count of internally received multicast (DA) packets.")
-#define awc_RID_Stats16_delta_HmacRxDisca 	awc_def_Stats16_delta_RID(0x006E,0x00DC,"Stats_HmacRxDisca",	" Count of internally received packets that were discarded  (usually because the destination address is not for the host).")
-#define awc_RID_Stats16_delta_HmacRxAcce 	awc_def_Stats16_delta_RID(0x0070,0x00E0,"Stats_HmacRxAcce",	"  Count of internally received packets that were accepted")
-#define awc_RID_Stats16_delta_SsidMismatch 	awc_def_Stats16_delta_RID(0x0072,0x00E4,"Stats_SsidMismatch",	" Count of SSID mismatches.")
-#define awc_RID_Stats16_delta_ApMismatch 	awc_def_Stats16_delta_RID(0x0074,0x00E8,"Stats_ApMismatch",	"  Count of specified AP mismatches.")
-#define awc_RID_Stats16_delta_RatesMismatc 	awc_def_Stats16_delta_RID(0x0076,0x00EC,"Stats_RatesMismatc",	" Count of rate mismatches.")
-#define awc_RID_Stats16_delta_AuthReject 	awc_def_Stats16_delta_RID(0x0078,0x00F0,"Stats_AuthReject",	"  Count of authentication rejections.")
-#define awc_RID_Stats16_delta_AuthTimeout 	awc_def_Stats16_delta_RID(0x007A,0x00F4,"Stats_AuthTimeout",	" Count of authentication timeouts.")
-#define awc_RID_Stats16_delta_AssocReject 	awc_def_Stats16_delta_RID(0x007C,0x00F8,"Stats_AssocReject",	" Count of association rejections.")
-#define awc_RID_Stats16_delta_AssocTimeout 	awc_def_Stats16_delta_RID(0x007E,0x00FC,"Stats_AssocTimeout",	" Count of association timeouts.")
-#define awc_RID_Stats16_delta_NewReason 	awc_def_Stats16_delta_RID(0x0080,0x0100,"Stats_NewReason",	"Count of reason/status codes of greater than 19.  (Values of 0 = successful are not counted)")
-#define awc_RID_Stats16_delta_AuthFail_1 	awc_def_Stats16_delta_RID(0x0082,0x0104,"Stats_AuthFail_1",	"Unspecified reason.")
-#define awc_RID_Stats16_delta_AuthFail_2 	awc_def_Stats16_delta_RID(0x0084,0x0108,"Stats_AuthFail_2",	"Previous authentication no longer valid.")
-#define awc_RID_Stats16_delta_AuthFail_3 	awc_def_Stats16_delta_RID(0x0086,0x010C,"Stats_AuthFail_3",	"Deauthenticated because sending station is leaving (has left) IBSS or ESS.")
-#define awc_RID_Stats16_delta_AuthFail_4 	awc_def_Stats16_delta_RID(0x0088,0x0110,"Stats_AuthFail_4",	"Disassociated due to inactivity")
-#define awc_RID_Stats16_delta_AuthFail_5 	awc_def_Stats16_delta_RID(0x008A,0x0114,"Stats_AuthFail_5",	"Disassociated because AP is unable to handle all currently  associated stations.")
-#define awc_RID_Stats16_delta_AuthFail_6 	awc_def_Stats16_delta_RID(0x008C,0x0118,"Stats_AuthFail_6",	"Class 2 Frame received from non-Authenticated station.")
-#define awc_RID_Stats16_delta_AuthFail_7 	awc_def_Stats16_delta_RID(0x008E,0x011C,"Stats_AuthFail_7",	"Class 3 Frame received from non-Associated station.")
-#define awc_RID_Stats16_delta_AuthFail_8 	awc_def_Stats16_delta_RID(0x0090,0x0120,"Stats_AuthFail_8",	"Disassociated because sending station is leaving (has left)")
-#define awc_RID_Stats16_delta_AuthFail_9 	awc_def_Stats16_delta_RID(0x0092,0x0124,"Stats_AuthFail_9",	"Station requesting (Re)Association is not Authenticated")
-#define awc_RID_Stats16_delta_AuthFail_10 	awc_def_Stats16_delta_RID(0x0094,0x0128,"Stats_AuthFail_10",	"Cannot support all requested capabilities in the Capability")
-#define awc_RID_Stats16_delta_AuthFail_11 	awc_def_Stats16_delta_RID(0x0096,0x012C,"Stats_AuthFail_11",	"Reassociation denied due to inability to confirm")
-#define awc_RID_Stats16_delta_AuthFail_12 	awc_def_Stats16_delta_RID(0x0098,0x0130,"Stats_AuthFail_12",	"Association denied due to reason outside the scope of the 802.11")
-#define awc_RID_Stats16_delta_AuthFail_13 	awc_def_Stats16_delta_RID(0x009A,0x0134,"Stats_AuthFail_13",	"Responding station does not support the specified Auth Alogorithm")
-#define awc_RID_Stats16_delta_AuthFail_14 	awc_def_Stats16_delta_RID(0x009C,0x0138,"Stats_AuthFail_14",	"Received an out of sequence Authentication Frame.")
-#define awc_RID_Stats16_delta_AuthFail_15 	awc_def_Stats16_delta_RID(0x009E,0x013C,"Stats_AuthFail_15",	"Authentication rejected due to challenge failure.")
-#define awc_RID_Stats16_delta_AuthFail_16 	awc_def_Stats16_delta_RID(0x00A0,0x0140,"Stats_AuthFail_16",	"Authentication rejected due to timeout waiting for next  frame in sequence.")
-#define awc_RID_Stats16_delta_AuthFail_17 	awc_def_Stats16_delta_RID(0x00A2,0x0144,"Stats_AuthFail_17",	"Association denied because AP is unable to handle  additional associated stations.")
-#define awc_RID_Stats16_delta_AuthFail_18 	awc_def_Stats16_delta_RID(0x00A4,0x0148,"Stats_AuthFail_18",	"Association denied due to requesting station not supportingall basic rates.")
-#define awc_RID_Stats16_delta_AuthFail_19 	awc_def_Stats16_delta_RID(0x00A6,0x014C,"Stats_AuthFail_19",	"Reserved")
-#define awc_RID_Stats16_delta_RxMan 		awc_def_Stats16_delta_RID(0x00A8,0x0150,"Stats_RxMan",		" Count of management packets received and handled.")
-#define awc_RID_Stats16_delta_TxMan 		awc_def_Stats16_delta_RID(0x00AA,0x0154,"Stats_TxMan",		" Count of management packets transmitted.")
-#define awc_RID_Stats16_delta_RxRefresh 	awc_def_Stats16_delta_RID(0x00AC,0x0158,"Stats_RxRefresh",	" Count of null data packets received.")
-#define awc_RID_Stats16_delta_TxRefresh 	awc_def_Stats16_delta_RID(0x00AE,0x015C,"Stats_TxRefresh",	" Count of null data packets transmitted.")
-#define awc_RID_Stats16_delta_RxPoll 		awc_def_Stats16_delta_RID(0x00B0,0x0160,"Stats_RxPoll",		"Count of PS-Poll packets received.")
-#define awc_RID_Stats16_delta_TxPoll 		awc_def_Stats16_delta_RID(0x00B2,0x0164,"Stats_TxPoll",		"Count of PS-Poll packets transmitted.")
-#define awc_RID_Stats16_delta_HostRetries 	awc_def_Stats16_delta_RID(0x00B4,0x0168,"Stats_HostRetries",	" Count of long and short retries used to transmit host packets  (does not include first attempt).")
-#define awc_RID_Stats16_delta_LostSync_HostReq 	awc_def_Stats16_delta_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.")
-#define awc_RID_Stats16_delta_HostTxBytes 	awc_def_Stats16_delta_RID(0x00B8,0x0170,"Stats_HostTxBytes",	" Count of bytes transferred from the host.")
-#define awc_RID_Stats16_delta_HostRxBytes 	awc_def_Stats16_delta_RID(0x00BA,0x0174,"Stats_HostRxBytes",	" Count of bytes transferred to the host.")
-#define awc_RID_Stats16_delta_ElapsedUsec 	awc_def_Stats16_delta_RID(0x00BC,0x0178,"Stats_ElapsedUsec",	" Total time since power up (or clear) in microseconds.")
-#define awc_RID_Stats16_delta_ElapsedSec 	awc_def_Stats16_delta_RID(0x00BE,0x017C,"Stats_ElapsedSec",	" Total time since power up (or clear) in seconds.")
-#define awc_RID_Stats16_delta_LostSyncBett 	awc_def_Stats16_delta_RID(0x00C0,0x0180,"Stats_LostSyncBett",	"Lost Sync to switch to a better access point")
-
-
-#define awc_RID_Stats16_clear_RidLen 		awc_def_Stats16_clear_RID(0x0000,0x0000,"RidLen",		"Length of the RID including the length field.")
-#define awc_RID_Stats16_clear_RxOverrunErr 	awc_def_Stats16_clear_RID(0x0002,0x0004,"Stats_RxOverrunErr",	"Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)")
-#define awc_RID_Stats16_clear_RxPlcpCrcErr 	awc_def_Stats16_clear_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr",	"PLCP header checksum errors (CRC16).")
-#define awc_RID_Stats16_clear_RxPlcpFormat 	awc_def_Stats16_clear_RID(0x0006,0x000C,"Stats_RxPlcpFormat",	"PLCP format errors.")
-#define awc_RID_Stats16_clear_RxPlcpLength 	awc_def_Stats16_clear_RID(0x0008,0x0010,"Stats_RxPlcpLength",	"PLCP length is incorrect.")
-#define awc_RID_Stats16_clear_RxMacCrcErr 	awc_def_Stats16_clear_RID(0x000A,0x0014,"Stats_RxMacCrcErr",	"Count of MAC CRC32 errors.")
-#define awc_RID_Stats16_clear_RxMacCrcOk 	awc_def_Stats16_clear_RID(0x000C,0x0018,"Stats_RxMacCrcOk",	"Count of MAC CRC32 received correctly.")
-#define awc_RID_Stats16_clear_RxWepErr 		awc_def_Stats16_clear_RID(0x000E,0x001C,"Stats_RxWepErr",	"Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)")
-#define awc_RID_Stats16_clear_RxWepOk 		awc_def_Stats16_clear_RID(0x0010,0x0020,"Stats_RxWepOk",	"Count of all WEP ICV checks that passed. (this value is  included in Stats_RxMacCrcOk)")
-#define awc_RID_Stats16_clear_RetryLong 	awc_def_Stats16_clear_RID(0x0012,0x0024,"Stats_RetryLongCount",	"of all long retries. (Does not include first attempt for a packet).")
-#define awc_RID_Stats16_clear_RetryShort 	awc_def_Stats16_clear_RID(0x0014,0x0028,"Stats_RetryShort",	"Count of all short retries. (Does not include first attempt for   a packet).")
-#define awc_RID_Stats16_clear_MaxRetries 	awc_def_Stats16_clear_RID(0x0016,0x002C,"Stats_MaxRetries",	"Count of number of packets that max-retried -- ie were  never ACKd.")
-#define awc_RID_Stats16_clear_NoAck 		awc_def_Stats16_clear_RID(0x0018,0x0030,"Stats_NoAck",		"Count of number of times that ACK was not received.")
-#define awc_RID_Stats16_clear_NoCts 		awc_def_Stats16_clear_RID(0x001A,0x0034,"Stats_NoCts",		"Count of number of timer that CTS was not received.")
-#define awc_RID_Stats16_clear_RxAck 		awc_def_Stats16_clear_RID(0x001C,0x0038,"Stats_RxAck",		"Count of number of expected ACKs that were received.")
-#define awc_RID_Stats16_clear_RxCts 		awc_def_Stats16_clear_RID(0x001E,0x003C,"Stats_RxCts",		"Count of number of expected CTSs that were received.")
-#define awc_RID_Stats16_clear_TxAck 		awc_def_Stats16_clear_RID(0x0020,0x0040,"Stats_TxAck",		"Count of number of ACKs transmitted.")
-#define awc_RID_Stats16_clear_TxRts 		awc_def_Stats16_clear_RID(0x0022,0x0044,"Stats_TxRts",		"Count of number of RTSs transmitted.")
-#define awc_RID_Stats16_clear_TxCts 		awc_def_Stats16_clear_RID(0x0024,0x0048,"Stats_TxCts",		"Count of number of CTSs transmitted.")
-#define awc_RID_Stats16_clear_TxMc 		awc_def_Stats16_clear_RID(0x0026,0x004C,"Stats_TxMc",		" LMAC count of multicast packets sent (uses 802.11  Address1).")
-#define awc_RID_Stats16_clear_TxBc 		awc_def_Stats16_clear_RID(0x0028,0x0050,"Stats_TxBc",		" LMAC count of broadcast packets sent (uses 802.11")
-#define awc_RID_Stats16_clear_TxUcFrags 	awc_def_Stats16_clear_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC",	" count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).")
-#define awc_RID_Stats16_clear_TxUcPackets 	awc_def_Stats16_clear_RID(0x002C,0x0058,"Stats_TxUcPackets",	"LMAC count of unicast packets that were ACKd (uses   802.11 Address 1).")
-#define awc_RID_Stats16_clear_TxBeacon 		awc_def_Stats16_clear_RID(0x002E,0x005C,"Stats_TxBeacon",	" Count of beacon packets transmitted.")
-#define awc_RID_Stats16_clear_RxBeacon 		awc_def_Stats16_clear_RID(0x0030,0x0060,"Stats_RxBeacon",	" Count of beacon packets received matching our BSSID.")
-#define awc_RID_Stats16_clear_TxSinColl 	awc_def_Stats16_clear_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **")
-#define awc_RID_Stats16_clear_TxMulColl 	awc_def_Stats16_clear_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **")
-#define awc_RID_Stats16_clear_DefersNo 		awc_def_Stats16_clear_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **")
-#define awc_RID_Stats16_clear_DefersProt 	awc_def_Stats16_clear_RID(0x0038,0x0070,"Stats_DefersProt",	" Transmit frames deferred due to protocol.")
-#define awc_RID_Stats16_clear_DefersEngy 	awc_def_Stats16_clear_RID(0x003A,0x0074,"Stats_DefersEngy",	" Transmit frames deferred due to energy detect.")
-#define awc_RID_Stats16_clear_DupFram 		awc_def_Stats16_clear_RID(0x003C,0x0078,"Stats_DupFram",	"  Duplicate receive frames and fragments.")
-#define awc_RID_Stats16_clear_RxFragDisc 	awc_def_Stats16_clear_RID(0x003E,0x007C,"Stats_RxFragDisc",	" Received partial frames. (each tally could indicate the  discarding of one or more fragments)")
-#define awc_RID_Stats16_clear_TxAged 		awc_def_Stats16_clear_RID(0x0040,0x0080,"Stats_TxAged",		"   Transmit packets exceeding maximum transmit lifetime. **")
-#define awc_RID_Stats16_clear_RxAged 		awc_def_Stats16_clear_RID(0x0042,0x0084,"Stats_RxAgedReceive",	" packets exceeding maximum receive lifetime. **")
-#define awc_RID_Stats16_clear_LostSync_Max 	awc_def_Stats16_clear_RID(0x0044,0x0088,"Stats_LostSync_Max",	" Lost sync with our cell due to maximum retries occuring. Retry")
-#define awc_RID_Stats16_clear_LostSync_Mis 	awc_def_Stats16_clear_RID(0x0046,0x008C,"Stats_LostSync_Mis",	"Lost sync with our cell due to missing too many beacons. sedBeacons")
-#define awc_RID_Stats16_clear_LostSync_Arl 	awc_def_Stats16_clear_RID(0x0048,0x0090,"Stats_LostSync_Arl",	"Lost sync with our cell due to Average Retry Level being  Exceeded  exceeded.")
-#define awc_RID_Stats16_clear_LostSync_Dea 	awc_def_Stats16_clear_RID(0x004A,0x0094,"Stats_LostSync_Dea",	"Lost sync with our cell due to being deauthenticated.,thed")
-#define awc_RID_Stats16_clear_LostSync_Disa 	awc_def_Stats16_clear_RID(0x004C,0x0098,"Stats_LostSync_Disa",	" Lost sync with our cell due to being disassociated. ssoced")
-#define awc_RID_Stats16_clear_LostSync_Tsf 	awc_def_Stats16_clear_RID(0x004E,0x009C,"Stats_LostSync_Tsf",	"Lost sync with our cell due to excessive change in TSF  Timingtiming.")
-#define awc_RID_Stats16_clear_HostTxMc 		awc_def_Stats16_clear_RID(0x0050,0x00A0,"Stats_HostTxMc",	"Count of multicast packets sent by the host.")
-#define awc_RID_Stats16_clear_HostTxBc 		awc_def_Stats16_clear_RID(0x0052,0x00A4,"Stats_HostTxBc",	"Count of broadcast packets sent by the host.")
-#define awc_RID_Stats16_clear_HostTxUc 		awc_def_Stats16_clear_RID(0x0054,0x00A8,"Stats_HostTxUc",	"Count of unicast packets sent by the host.")
-#define awc_RID_Stats16_clear_HostTxFail 	awc_def_Stats16_clear_RID(0x0056,0x00AC,"Stats_HostTxFail",	"  Count of host transmitted packets which failed.")
-#define awc_RID_Stats16_clear_HostRxMc 		awc_def_Stats16_clear_RID(0x0058,0x00B0,"Stats_HostRxMc",	"Count of host received multicast packets.")
-#define awc_RID_Stats16_clear_HostRxBc 		awc_def_Stats16_clear_RID(0x005A,0x00B4,"Stats_HostRxBc",	"Count of host received broadcast packets.")
-#define awc_RID_Stats16_clear_HostRxUc 		awc_def_Stats16_clear_RID(0x005C,0x00B8,"Stats_HostRxUc",	"Count of host received unicast packets.")
-#define awc_RID_Stats16_clear_HostRxDiscar 	awc_def_Stats16_clear_RID(0x005E,0x00BC,"Stats_HostRxDiscar",	"Count of host received packets discarded due to:\n  Host not enabling receive.\n  Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.")
-#define awc_RID_Stats16_clear_HmacTxMc 		awc_def_Stats16_clear_RID(0x0060,0x00C0,"Stats_HmacTxMc",	"Count of internally generated multicast (DA) packets.")
-#define awc_RID_Stats16_clear_HmacTxBc 		awc_def_Stats16_clear_RID(0x0062,0x00C4,"Stats_HmacTxBc",	"Count of internally generated broadcast (DA) packets.")
-#define awc_RID_Stats16_clear_HmacTxUc 		awc_def_Stats16_clear_RID(0x0064,0x00C8,"Stats_HmacTxUc",	"Count of internally generated unicast (DA) packets.")
-#define awc_RID_Stats16_clear_HmacTxFail 	awc_def_Stats16_clear_RID(0x0066,0x00CC,"Stats_HmacTxFail",	"  Count of internally generated transmit packets that failed.")
-#define awc_RID_Stats16_clear_HmacRxMc 		awc_def_Stats16_clear_RID(0x0068,0x00D0,"Stats_HmacRxMc",	"Count of internally received multicast (DA) packets.")
-#define awc_RID_Stats16_clear_HmacRxBc 		awc_def_Stats16_clear_RID(0x006A,0x00D4,"Stats_HmacRxBc",	"Count of internally received broadcast (DA) packets.")
-#define awc_RID_Stats16_clear_HmacRxUc 		awc_def_Stats16_clear_RID(0x006C,0x00D8,"Stats_HmacRxUc",	"Count of internally received multicast (DA) packets.")
-#define awc_RID_Stats16_clear_HmacRxDisca 	awc_def_Stats16_clear_RID(0x006E,0x00DC,"Stats_HmacRxDisca",	" Count of internally received packets that were discarded  (usually because the destination address is not for the host).")
-#define awc_RID_Stats16_clear_HmacRxAcce 	awc_def_Stats16_clear_RID(0x0070,0x00E0,"Stats_HmacRxAcce",	"  Count of internally received packets that were accepted")
-#define awc_RID_Stats16_clear_SsidMismatch 	awc_def_Stats16_clear_RID(0x0072,0x00E4,"Stats_SsidMismatch",	" Count of SSID mismatches.")
-#define awc_RID_Stats16_clear_ApMismatch 	awc_def_Stats16_clear_RID(0x0074,0x00E8,"Stats_ApMismatch",	"  Count of specified AP mismatches.")
-#define awc_RID_Stats16_clear_RatesMismatc 	awc_def_Stats16_clear_RID(0x0076,0x00EC,"Stats_RatesMismatc",	" Count of rate mismatches.")
-#define awc_RID_Stats16_clear_AuthReject 	awc_def_Stats16_clear_RID(0x0078,0x00F0,"Stats_AuthReject",	"  Count of authentication rejections.")
-#define awc_RID_Stats16_clear_AuthTimeout 	awc_def_Stats16_clear_RID(0x007A,0x00F4,"Stats_AuthTimeout",	" Count of authentication timeouts.")
-#define awc_RID_Stats16_clear_AssocReject 	awc_def_Stats16_clear_RID(0x007C,0x00F8,"Stats_AssocReject",	" Count of association rejections.")
-#define awc_RID_Stats16_clear_AssocTimeout 	awc_def_Stats16_clear_RID(0x007E,0x00FC,"Stats_AssocTimeout",	" Count of association timeouts.")
-#define awc_RID_Stats16_clear_NewReason 	awc_def_Stats16_clear_RID(0x0080,0x0100,"Stats_NewReason",	"Count of reason/status codes of greater than 19.  (Values of 0 = successful are not counted)")
-#define awc_RID_Stats16_clear_AuthFail_1 	awc_def_Stats16_clear_RID(0x0082,0x0104,"Stats_AuthFail_1",	"Unspecified reason.")
-#define awc_RID_Stats16_clear_AuthFail_2 	awc_def_Stats16_clear_RID(0x0084,0x0108,"Stats_AuthFail_2",	"Previous authentication no longer valid.")
-#define awc_RID_Stats16_clear_AuthFail_3 	awc_def_Stats16_clear_RID(0x0086,0x010C,"Stats_AuthFail_3",	"Deauthenticated because sending station is leaving (has left) IBSS or ESS.")
-#define awc_RID_Stats16_clear_AuthFail_4 	awc_def_Stats16_clear_RID(0x0088,0x0110,"Stats_AuthFail_4",	"Disassociated due to inactivity")
-#define awc_RID_Stats16_clear_AuthFail_5 	awc_def_Stats16_clear_RID(0x008A,0x0114,"Stats_AuthFail_5",	"Disassociated because AP is unable to handle all currently  associated stations.")
-#define awc_RID_Stats16_clear_AuthFail_6 	awc_def_Stats16_clear_RID(0x008C,0x0118,"Stats_AuthFail_6",	"Class 2 Frame received from non-Authenticated station.")
-#define awc_RID_Stats16_clear_AuthFail_7 	awc_def_Stats16_clear_RID(0x008E,0x011C,"Stats_AuthFail_7",	"Class 3 Frame received from non-Associated station.")
-#define awc_RID_Stats16_clear_AuthFail_8 	awc_def_Stats16_clear_RID(0x0090,0x0120,"Stats_AuthFail_8",	"Disassociated because sending station is leaving (has left) " )
-#define awc_RID_Stats16_clear_AuthFail_9 	awc_def_Stats16_clear_RID(0x0092,0x0124,"Stats_AuthFail_9",	"Station requesting (Re)Association is not Authenticated")
-#define awc_RID_Stats16_clear_AuthFail_10 	awc_def_Stats16_clear_RID(0x0094,0x0128,"Stats_AuthFail_10",	"Cannot support all requested capabilities in the Capability")
-#define awc_RID_Stats16_clear_AuthFail_11 	awc_def_Stats16_clear_RID(0x0096,0x012C,"Stats_AuthFail_11",	"Reassociation denied due to inability to confirm")
-#define awc_RID_Stats16_clear_AuthFail_12 	awc_def_Stats16_clear_RID(0x0098,0x0130,"Stats_AuthFail_12",	"Association denied due to reason outside the scope of the 802.11")
-#define awc_RID_Stats16_clear_AuthFail_13 	awc_def_Stats16_clear_RID(0x009A,0x0134,"Stats_AuthFail_13",	"Responding station does not support the specified Auth Alogorithm")
-#define awc_RID_Stats16_clear_AuthFail_14 	awc_def_Stats16_clear_RID(0x009C,0x0138,"Stats_AuthFail_14",	"Received an out of sequence Authentication Frame.")
-#define awc_RID_Stats16_clear_AuthFail_15 	awc_def_Stats16_clear_RID(0x009E,0x013C,"Stats_AuthFail_15",	"Authentication rejected due to challenge failure.")
-#define awc_RID_Stats16_clear_AuthFail_16 	awc_def_Stats16_clear_RID(0x00A0,0x0140,"Stats_AuthFail_16",	"Authentication rejected due to timeout waiting for next  frame in sequence.")
-#define awc_RID_Stats16_clear_AuthFail_17 	awc_def_Stats16_clear_RID(0x00A2,0x0144,"Stats_AuthFail_17",	"Association denied because AP is unable to handle  additional associated stations.")
-#define awc_RID_Stats16_clear_AuthFail_18 	awc_def_Stats16_clear_RID(0x00A4,0x0148,"Stats_AuthFail_18",	"Association denied due to requesting station not supportingall basic rates.")
-#define awc_RID_Stats16_clear_AuthFail_19 	awc_def_Stats16_clear_RID(0x00A6,0x014C,"Stats_AuthFail_19",	"Reserved")
-#define awc_RID_Stats16_clear_RxMan 		awc_def_Stats16_clear_RID(0x00A8,0x0150,"Stats_RxMan",		" Count of management packets received and handled.")
-#define awc_RID_Stats16_clear_TxMan 		awc_def_Stats16_clear_RID(0x00AA,0x0154,"Stats_TxMan",		" Count of management packets transmitted.")
-#define awc_RID_Stats16_clear_RxRefresh 	awc_def_Stats16_clear_RID(0x00AC,0x0158,"Stats_RxRefresh",	" Count of null data packets received.")
-#define awc_RID_Stats16_clear_TxRefresh 	awc_def_Stats16_clear_RID(0x00AE,0x015C,"Stats_TxRefresh",	" Count of null data packets transmitted.")
-#define awc_RID_Stats16_clear_RxPoll 		awc_def_Stats16_clear_RID(0x00B0,0x0160,"Stats_RxPoll",		"Count of PS-Poll packets received.")
-#define awc_RID_Stats16_clear_TxPoll 		awc_def_Stats16_clear_RID(0x00B2,0x0164,"Stats_TxPoll",		"Count of PS-Poll packets transmitted.")
-#define awc_RID_Stats16_clear_HostRetries 	awc_def_Stats16_clear_RID(0x00B4,0x0168,"Stats_HostRetries",	" Count of long and short retries used to transmit host packets  (does not include first attempt).")
-#define awc_RID_Stats16_clear_LostSync_HostReq 	awc_def_Stats16_clear_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.")
-#define awc_RID_Stats16_clear_HostTxBytes 	awc_def_Stats16_clear_RID(0x00B8,0x0170,"Stats_HostTxBytes",	" Count of bytes transferred from the host.")
-#define awc_RID_Stats16_clear_HostRxBytes 	awc_def_Stats16_clear_RID(0x00BA,0x0174,"Stats_HostRxBytes",	" Count of bytes transferred to the host.")
-#define awc_RID_Stats16_clear_ElapsedUsec 	awc_def_Stats16_clear_RID(0x00BC,0x0178,"Stats_ElapsedUsec",	" Total time since power up (or clear) in microseconds.")
-#define awc_RID_Stats16_clear_ElapsedSec 	awc_def_Stats16_clear_RID(0x00BE,0x017C,"Stats_ElapsedSec",	" Total time since power up (or clear) in seconds.")
-#define awc_RID_Stats16_clear_LostSyncBett 	awc_def_Stats16_clear_RID(0x00C0,0x0180,"Stats_LostSyncBett",	"Lost Sync to switch to a better access point")
-/*
-const struct aironet4500_rid_selector  aironet4500_RID_Select_General_Config	=(const struct aironet4500_rid_selector){ 0xFF10, 1,0,0, "General Configuration" }; //        See notes General Configuration        Many configuration items.
-const struct aironet4500_rid_selector  aironet4500_RID_Select_SSID_list		=(const struct aironet4500_rid_selector){ 0xFF11, 1,0,0, "Valid SSID list" }; //          See notes Valid SSID list              List of SSIDs which the station may associate to.
-const struct aironet4500_rid_selector  aironet4500_RID_Select_AP_list		=(const struct aironet4500_rid_selector){ 0xFF12, 1,0,0, "Valid AP list" }; //          See notes Valid AP list                List of APs which the station may associate to.
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Driver_name	=(const struct aironet4500_rid_selector){ 0xFF13, 1,0,0, "Driver name" }; //          See notes Driver name                  The name and version of the driver (for debugging)
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Encapsulation	=(const struct aironet4500_rid_selector){ 0xFF14, 1,0,0, "Ethernet Protocol" }; //          See notes Ethernet Protocol            Rules for encapsulating ethernet payloads onto 802.11.
-const struct aironet4500_rid_selector  aironet4500_RID_Select_WEP_volatile	=(const struct aironet4500_rid_selector){ 0xFF15, 1,0,0, "WEP key volatile" }; //          
-const struct aironet4500_rid_selector  aironet4500_RID_Select_WEP_nonvolatile	=(const struct aironet4500_rid_selector){ 0xFF16, 1,0,0, "WEP key non-volatile" }; //
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Modulation	=(const struct aironet4500_rid_selector){ 0xFF17, 1,0,0, "Modulation" }; //
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Active_Config	=(const struct aironet4500_rid_selector){ 0xFF20, 0,1,1, "Actual Configuration" }; //          Read only      Actual Configuration    This has the same format as the General Configuration.
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Capabilities	=(const struct aironet4500_rid_selector){ 0xFF00, 0,1,0, "Capabilities" }; //          Read Only      Capabilities            PC4500 Information
-const struct aironet4500_rid_selector  aironet4500_RID_Select_AP_Info		=(const struct aironet4500_rid_selector){ 0xFF01, 0,1,1, "AP Info" }; //          Read Only      AP Info                 Access Point Information
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Radio_Info	=(const struct aironet4500_rid_selector){ 0xFF02, 0,1,1, "Radio Info" }; //          Read Only      Radio Info              Radio Information -- note radio specific
-const struct aironet4500_rid_selector  aironet4500_RID_Select_Status		=(const struct aironet4500_rid_selector){ 0xFF50, 0,1,1, "Status" }; //          Read Only      Status                  PC4500 Current Status Information
-const struct aironet4500_rid_selector  aironet4500_RID_Select_16_stats		=(const struct aironet4500_rid_selector){ 0xFF60, 0,1,1, "Cumulative 16-bit Statistics" }; //          Read Only      16-bit Statistics       Cumulative 16-bit Statistics
-const struct aironet4500_rid_selector  aironet4500_RID_Select_16_stats_delta	=(const struct aironet4500_rid_selector){ 0xFF61, 0,1,1, "Delta 16-bit Statistics" }; //          Read Only      16-bit Statistics       Delta 16-bit Statistics (since last clear)
-const struct aironet4500_rid_selector  aironet4500_RID_Select_16_stats_clear	=(const struct aironet4500_rid_selector){ 0xFF62, 0,1,1, "Delta 16-bit Statistics and Clear" }; //          Read Only /    16-bit Statistics       Delta 16-bit Statistics and Clear
-const struct aironet4500_rid_selector  aironet4500_RID_Select_32_stats      	=(const struct aironet4500_rid_selector){ 0xFF68, 0,1,1, "Cumulative 32-bit Statistics" }; //          Read Only      32-bit Statistics       Cumulative 32-bit Statistics
-const struct aironet4500_rid_selector  aironet4500_RID_Select_32_stats_delta	=(const struct aironet4500_rid_selector){ 0xFF69, 0,1,1, "Delta 32-bit Statistics"  }; //          Read Only      32-bit Statistics       Delta 32-bit Statistics (since last clear)
-const struct aironet4500_rid_selector  aironet4500_RID_Select_32_stats_clear	=(const struct aironet4500_rid_selector){ 0xFF6A, 0,1,1, "Delta 32-bit Statistics and Clear" }; //          Read Only /    32-bit Statistics       Delta 32-bit Statistics and Clear
-*/
-
-struct aironet4500_RID awc_gen_RID[] ={
-	awc_RID_gen_RidLen,
-	awc_RID_gen_OperatingMode_adhoc,
-	awc_RID_gen_OperatingMode_Infrastructure,
-	awc_RID_gen_OperatingMode_AP,
-	awc_RID_gen_OperatingMode_AP_and_repeater,
-	awc_RID_gen_OperatingMode_No_payload_modify,
-	awc_RID_gen_OperatingMode_LLC_802_3_convert,
-	awc_RID_gen_OperatingMode_proprietary_ext,
-	awc_RID_gen_OperatingMode_no_proprietary_ext,
-	awc_RID_gen_OperatingMode_AP_ext,
-	awc_RID_gen_OperatingMode_no_AP_ext,
-	awc_RID_gen_ReceiveMode,
-	awc_RID_gen_ReceiveMode_BMA,
-	awc_RID_gen_ReceiveMode_BA,
-	awc_RID_gen_ReceiveMode_A,
-	awc_RID_gen_ReceiveMode_802_11_monitor,
-	awc_RID_gen_ReceiveMode_802_11_any_monitor,
-	awc_RID_gen_ReceiveMode_LAN_monitor,
-	awc_RID_gen_ReceiveMode_802_3_hdr_disable,
-	awc_RID_gen_ReceiveMode_802_3_hdr_enable,
-	awc_RID_gen_Fragmentation_threshold,
-	awc_RID_gen_RTS_threshold,
-	awc_RID_gen_Station_Mac_Id,
-	awc_RID_gen_Supported_rates,
-	awc_RID_gen_Basic_Rate,
-	awc_RID_gen_Rate_500kbps,
-	awc_RID_gen_Rate_1Mbps,
-	awc_RID_gen_Rate_2Mbps,
-	awc_RID_gen_Rate_4Mbps,
-	awc_RID_gen_Rate_5Mbps,
-	awc_RID_gen_Rate_10Mbps,
-	awc_RID_gen_Rate_11Mbps,
-	awc_RID_gen_BasicRate_500kbps,
-	awc_RID_gen_BasicRate_1Mbps,
-	awc_RID_gen_BasicRate_2Mbps,
-	awc_RID_gen_BasicRate_4Mbps,
-	awc_RID_gen_BasicRate_5Mbps,
-	awc_RID_gen_BasicRate_10Mbps,
-	awc_RID_gen_BasicRate_11Mbps,
-	awc_RID_gen_Long_retry_limit,
-	awc_RID_gen_Short_retry_limit,
-	awc_RID_gen_Tx_MSDU_lifetime,
-	awc_RID_gen_Rx_MSDU_lifetime,
-	awc_RID_gen_Stationary,
-	awc_RID_gen_BC_MC_Ordering,
-	awc_RID_gen_Device_type,
-	awc_RID_gen_Reserved_0x0026,
-	awc_RID_gen_ScanMode,
-	awc_RID_gen_ScanMode_Active,
-	awc_RID_gen_ScanMode_Passive,
-	awc_RID_gen_ScanMode_Aironet_ext,
-	awc_RID_gen_ProbeDelay,
-	awc_RID_gen_ProbeEnergyTimeout,
-	awc_RID_gen_ProbeResponseTimeout,
-	awc_RID_gen_BeaconListenTimeout,
-	awc_RID_gen_IbssJoinNetTimeout,
-	awc_RID_gen_AuthenticationTimeout,
-	awc_RID_gen_AuthenticationType,
-	awc_RID_gen_AuthenticationType_None,
-	awc_RID_gen_AuthenticationType_Open,
-	awc_RID_gen_AuthenticationType_Shared,
-	awc_RID_gen_AuthenticationType_Exclude_Open,
-	awc_RID_gen_AssociationTimeout,
-	awc_RID_gen_SpecifiedAPtimeout,
-	awc_RID_gen_OfflineScanInterval,
-	awc_RID_gen_OfflineScanDuration,
-	awc_RID_gen_LinkLossDelay,
-	awc_RID_gen_MaxBeaconLostTime,
-	awc_RID_gen_RefreshInterval,
-	awc_RID_gen_PowerSaveMode,
-	awc_RID_gen_PowerSaveMode_CAM,
-	awc_RID_gen_PowerSaveMode_PSP,
-	awc_RID_gen_PowerSaveMode_Fast_PSP,
-	awc_RID_gen_SleepForDTIMs,
-	awc_RID_gen_ListenInterval,
-	awc_RID_gen_FastListenInterval,
-	awc_RID_gen_ListenDecay,
-	awc_RID_gen_FastListenDelay,
-	awc_RID_gen_Reserved0x005C,
-	awc_RID_gen_BeaconPeriod,
-	awc_RID_gen_AtimDuration,
-	awc_RID_gen_Reserved0x0064,
-	awc_RID_gen_DSChannel,
-	awc_RID_gen_Reserved0x0068,
-	awc_RID_gen_DTIM_Period,
-	awc_RID_gen_Reserved0x0006C,
-	awc_RID_gen_RadioSpreadType,
-	awc_RID_gen_RadioSpreadType_FH,
-	awc_RID_gen_RadioSpreadType_DS,
-	awc_RID_gen_RadioSpreadType_LM,
-	awc_RID_gen_TX_antenna_Diversity,
-	awc_RID_gen_TX_antenna_Diversity_default,
-	awc_RID_gen_TX_antenna_Diversity_1,
-	awc_RID_gen_TX_antenna_Diversity_2,
-	awc_RID_gen_TX_antenna_Diversity_both,
-	awc_RID_gen_RX_antenna_Diversity,
-	awc_RID_gen_RX_antenna_Diversity_default,
-	awc_RID_gen_RX_antenna_Diversity_1,
-	awc_RID_gen_RX_antenna_Diversity_2,
-	awc_RID_gen_RX_antenna_Diversity_both,
-	awc_RID_gen_TransmitPower,
-	awc_RID_gen_RSSIthreshold,
-	awc_RID_gen_Modulation,
-	awc_RID_gen_Reserved0x0079,
-	awc_RID_gen_NodeName,
-	awc_RID_gen_ARLThreshold,
-	awc_RID_gen_ARLDecay,
-	awc_RID_gen_ARLDelay,
-	awc_RID_gen_Unused0x0096,
-	awc_RID_gen_MagicPacketAction,
-	awc_RID_gen_MagicPacketControl,
-	{0}
-};
-
-struct aironet4500_RID awc_act_RID[]={
-	awc_RID_act_RidLen,
-	awc_RID_act_OperatingMode_adhoc,
-	awc_RID_act_OperatingMode_Infrastructure,
-	awc_RID_act_OperatingMode_AP,
-	awc_RID_act_OperatingMode_AP_and_repeater,
-	awc_RID_act_OperatingMode_No_payload_modify,
-	awc_RID_act_OperatingMode_LLC_802_3_convert,
-	awc_RID_act_OperatingMode_proprietary_ext,
-	awc_RID_act_OperatingMode_no_proprietary_ext,
-	awc_RID_act_OperatingMode_AP_ext,
-	awc_RID_act_OperatingMode_no_AP_ext,
-	awc_RID_act_ReceiveMode,
-	awc_RID_act_ReceiveMode_BMA,
-	awc_RID_act_ReceiveMode_BA,
-	awc_RID_act_ReceiveMode_A,
-	awc_RID_act_ReceiveMode_802_11_monitor,
-	awc_RID_act_ReceiveMode_802_11_any_monitor,
-	awc_RID_act_ReceiveMode_LAN_monitor,
-	awc_RID_act_ReceiveMode_802_3_hdr_disable,
-	awc_RID_act_ReceiveMode_802_3_hdr_enable,
-	awc_RID_act_Fragmentation_threshold,
-	awc_RID_act_RTS_threshold,
-	awc_RID_act_Station_Mac_Id,
-	awc_RID_act_Supported_rates,
-	awc_RID_act_Basic_Rate,
-	awc_RID_act_Rate_500kbps,
-	awc_RID_act_Rate_1Mbps,
-	awc_RID_act_Rate_2Mbps,
-	awc_RID_act_Rate_4Mbps,
-	awc_RID_act_Rate_5Mbps,
-	awc_RID_act_Rate_10Mbps,
-	awc_RID_act_Rate_11Mbps,
-	awc_RID_act_BasicRate_500kbps,
-	awc_RID_act_BasicRate_1Mbps,
-	awc_RID_act_BasicRate_2Mbps,
-	awc_RID_act_BasicRate_4Mbps,
-	awc_RID_act_BasicRate_5Mbps,
-	awc_RID_act_BasicRate_10Mbps,
-	awc_RID_act_BasicRate_11Mbps,
-	awc_RID_act_Long_retry_limit,
-	awc_RID_act_Short_retry_limit,
-	awc_RID_act_Tx_MSDU_lifetime,
-	awc_RID_act_Rx_MSDU_lifetime,
-	awc_RID_act_Stationary,
-	awc_RID_act_BC_MC_Ordering,
-	awc_RID_act_Device_type,
-	awc_RID_act_Reserved_0x0026,
-	awc_RID_act_ScanMode,
-	awc_RID_act_ScanMode_Active,
-	awc_RID_act_ScanMode_Passive,
-	awc_RID_act_ScanMode_Aironet_ext,
-	awc_RID_act_ProbeDelay,
-	awc_RID_act_ProbeEnergyTimeout,
-	awc_RID_act_ProbeResponseTimeout,
-	awc_RID_act_BeaconListenTimeout,
-	awc_RID_act_IbssJoinNetTimeout,
-	awc_RID_act_AuthenticationTimeout,
-	awc_RID_act_AuthenticationType,
-	awc_RID_act_AuthenticationType_None,
-	awc_RID_act_AuthenticationType_Open,
-	awc_RID_act_AuthenticationType_Shared,
-	awc_RID_act_AuthenticationType_Exclude_Open,
-	awc_RID_act_AssociationTimeout,
-	awc_RID_act_SpecifiedAPtimeout,
-	awc_RID_act_OfflineScanInterval,
-	awc_RID_act_OfflineScanDuration,
-	awc_RID_act_LinkLossDelay,
-	awc_RID_act_MaxBeaconLostTime,
-	awc_RID_act_RefreshInterval,
-	awc_RID_act_PowerSaveMode,
-	awc_RID_act_PowerSaveMode_CAM,
-	awc_RID_act_PowerSaveMode_PSP,
-	awc_RID_act_PowerSaveMode_Fast_PSP,
-	awc_RID_act_SleepForDTIMs,
-	awc_RID_act_ListenInterval,
-	awc_RID_act_FastListenInterval,
-	awc_RID_act_ListenDecay,
-	awc_RID_act_FastListenDelay,
-	awc_RID_act_Reserved0x005C,
-	awc_RID_act_BeaconPeriod,
-	awc_RID_act_AtimDuration,
-	awc_RID_act_Reserved0x0064,
-	awc_RID_act_DSChannel,
-	awc_RID_act_Reserved0x0068,
-	awc_RID_act_DTIM_Period,
-	awc_RID_act_Reserved0x0006C,
-	awc_RID_act_RadioSpreadType,
-	awc_RID_act_RadioSpreadType_FH,
-	awc_RID_act_RadioSpreadType_DS,
-	awc_RID_act_RadioSpreadType_LM,
-	awc_RID_act_TX_antenna_Diversity,
-	awc_RID_act_TX_antenna_Diversity_default,
-	awc_RID_act_TX_antenna_Diversity_1,
-	awc_RID_act_TX_antenna_Diversity_2,
-	awc_RID_act_TX_antenna_Diversity_both,
-	awc_RID_act_RX_antenna_Diversity,
-	awc_RID_act_RX_antenna_Diversity_default,
-	awc_RID_act_RX_antenna_Diversity_1,
-	awc_RID_act_RX_antenna_Diversity_2,
-	awc_RID_act_RX_antenna_Diversity_both,
-	awc_RID_act_TransmitPower,
-	awc_RID_act_RSSIthreshold,
-	awc_RID_act_Modulation,
-	awc_RID_act_Reserved0x0079,
-	awc_RID_act_NodeName,
-	awc_RID_act_ARLThreshold,
-	awc_RID_act_ARLDecay,
-	awc_RID_act_ARLDelay,
-	awc_RID_act_Unused0x0096,
-	awc_RID_act_MagicPacketAction,
-	awc_RID_act_MagicPacketControl,
-	{0}
-};
-
-
-
-struct aironet4500_RID awc_SSID_RID[]={
-	awc_RID_SSID_RidLen,
-	awc_RID_SSID_Accept_any,
-	awc_RID_SSIDlen1,
-	awc_RID_SSID1,
-	awc_RID_SSIDlen2,
-	awc_RID_SSID2,
-	awc_RID_SSIDlen3,
-	awc_RID_SSID3,
-	awc_RID_SSID1hex,
-	awc_RID_SSID2hex,
-	awc_RID_SSID3hex,
-	{0}
-};
-
-
-struct aironet4500_RID awc_AP_List_RID[]={
-	awc_RID_AP_List_RidLen,
-	awc_RID_AP_List_SpecifiedAP1,
-	awc_RID_AP_List_SpecifiedAP2,
-	awc_RID_AP_List_SpecifiedAP3,
-	awc_RID_AP_List_SpecifiedAP4,
-	{0}
-};
-
-
-struct aironet4500_RID awc_Dname_RID[]={
-	awc_RID_Dname_RidLen,
-	awc_RID_Dname_DriverName,
-	{0}
-};
-
-
-
-
-struct aironet4500_RID awc_enc_RID[]={
-	awc_RID_Enc_RidLen,
-	awc_RID_Enc_EtherType1,
-	awc_RID_Enc_Action_RX_1,
-	awc_RID_Enc_Action_RX_1_RFC_1042,
-	awc_RID_Enc_Action_RX_1_802_11,
-	awc_RID_Enc_Action_TX_1,
-	awc_RID_Enc_Action_TX_1_RFC_1042,
-	awc_RID_Enc_Action_TX_1_802_11,
-	awc_RID_Enc_EtherType2,
-	awc_RID_Enc_Action_RX_2,
-	awc_RID_Enc_Action_RX_2_RFC_1042,
-	awc_RID_Enc_Action_RX_2_802_11,
-	awc_RID_Enc_Action_TX_2,
-	awc_RID_Enc_Action_TX_2_RFC_1042,
-	awc_RID_Enc_Action_TX_2_802_11,
-	awc_RID_Enc_EtherType3,
-	awc_RID_Enc_Action_RX_3,
-	awc_RID_Enc_Action_RX_3_RFC_1042,
-	awc_RID_Enc_Action_RX_3_802_11,
-	awc_RID_Enc_Action_TX_3_,
-	awc_RID_Enc_Action_TX_3_RFC_1042,
-	awc_RID_Enc_Action_TX_3_802_11,
-	awc_RID_Enc_EtherType4,
-	awc_RID_Enc_Action_RX_4,
-	awc_RID_Enc_Action_RX_4_RFC_1042,
-	awc_RID_Enc_Action_RX_4_802_11,
-	awc_RID_Enc_Action_TX_4,
-	awc_RID_Enc_Action_TX_4_RFC_1042,
-	awc_RID_Enc_Action_TX_4_802_11,
-	awc_RID_Enc_EtherType5,
-	awc_RID_Enc_Action_RX_5,
-	awc_RID_Enc_Action_RX_5_RFC_1042,
-	awc_RID_Enc_Action_RX_5_802_11,
-	awc_RID_Enc_Action_TX_5,
-	awc_RID_Enc_Action_TX_5_RFC_1042,
-	awc_RID_Enc_Action_TX_5_802_11,
-	awc_RID_Enc_EtherType6,
-	awc_RID_Enc_Action_RX_6,
-	awc_RID_Enc_Action_RX_6_RFC_1042,
-	awc_RID_Enc_Action_RX_6_802_11,
-	awc_RID_Enc_Action_TX_6,
-	awc_RID_Enc_Action_TX_6_RFC_1042,
-	awc_RID_Enc_Action_TX_6_802_11,
-	awc_RID_Enc_EtherType7,
-	awc_RID_Enc_Action_RX_7,
-	awc_RID_Enc_Action_RX_7_RFC_1042,
-	awc_RID_Enc_Action_RX_7_802_11,
-	awc_RID_Enc_Action_TX_7,
-	awc_RID_Enc_Action_TX_7_RFC_1042,
-	awc_RID_Enc_Action_TX_7_802_11,
-	awc_RID_Enc_EtherType8,
-	awc_RID_Enc_Action_RX_8,
-	awc_RID_Enc_Action_RX_8_RFC_1042,
-	awc_RID_Enc_Action_RX_8_802_11,
-	awc_RID_Enc_Action_TX_8,
-	awc_RID_Enc_Action_TX_8_RFC_1042,
-	awc_RID_Enc_Action_TX_8_802_11,
-	{0}
-};
-
-struct aironet4500_RID awc_WEPv_RID[]={
-	awc_RID_WEPv_RidLen,
-	awc_RID_WEPv_KeyIndex,
-	awc_RID_WEPv_Address,
-	awc_RID_WEPv_KeyLen,
-	awc_RID_WEPv_Key,
-	awc_RID_WEPv_KeyAscii,
-	{0}
-};
-
-struct aironet4500_RID awc_WEPnv_RID[]={
-	awc_RID_WEPnv_RidLen,
-	awc_RID_WEPnv_KeyIndex,
-	awc_RID_WEPnv_Address,
-	awc_RID_WEPnv_KeyLen,
-	awc_RID_WEPnv_Key,
-	awc_RID_WEPnv_KeyAscii,
-	{0}
-};
-
-struct aironet4500_RID awc_Modulation_RID[]={
-	awc_RID_Modulation_RidLen,
-	awc_RID_Modulation_Modulation,
-	{0}
-};
-
-
-
-struct aironet4500_RID awc_Cap_RID[]={
-	awc_RID_Cap_RidLen,
-	awc_RID_Cap_OUI,
-	awc_RID_Cap_ProductNum,
-	awc_RID_Cap_ManufacturerName,
-	awc_RID_Cap_ProductName,
-	awc_RID_Cap_ProductVersion,
-	awc_RID_Cap_FactoryAddress,
-	awc_RID_Cap_AironetAddress,
-	awc_RID_Cap_RadioSpreadType_DS,
-	awc_RID_Cap_RadioSpreadType_FH,
-	awc_RID_Cap_RadioSpreadType_Legacy,
-	awc_RID_Cap_RegDomain,
-	awc_RID_Cap_Callid,
-	awc_RID_Cap_SupportedRates,
-	awc_RID_Cap_RxDiversity,
-	awc_RID_Cap_TxDiversity,
-	awc_RID_Cap_TxPowerLevels,
-	awc_RID_Cap_HardwareVersion,
-	awc_RID_Cap_HardwareCapabilit,
-	awc_RID_Cap_TemperatureRange,
-	awc_RID_Cap_SoftwareVersion,
-	awc_RID_Cap_SoftwareVersion_major,
-	awc_RID_Cap_SoftwareVersion_minor,
-	awc_RID_Cap_SoftwareSubVersion,
-	awc_RID_Cap_InterfaceVersion,
-	awc_RID_Cap_SoftwareCapabilities,
-	awc_RID_Cap_BootBlockVersion,
-	{0}
-};
-
-
-struct aironet4500_RID awc_Status_RID[]={
-	awc_RID_Status_RidLen,
-	awc_RID_Status_MacAddress,
-	awc_RID_Status_OperationalMode,
-	awc_RID_Status_Configured,
-	awc_RID_Status_MAC_Enabled,
-	awc_RID_Status_Receive_Enabled,
-	awc_RID_Status_In_Sync,
-	awc_RID_Status_Associated,
-	awc_RID_Status_Error,
-	awc_RID_Status_ErrorCode,
-	awc_RID_Status_CurrentSignalQuality,
-	awc_RID_Status_SSIDlength,
-	awc_RID_Status_SSID,
-	awc_RID_Status_ApName,
-	awc_RID_Status_CurrentBssid,
-	awc_RID_Status_PreviousBssid1,
-	awc_RID_Status_PreviousBssid2,
-	awc_RID_Status_PreviousBssid3,
-	awc_RID_Status_BeaconPeriod,
-	awc_RID_Status_DtimPeriod,
-	awc_RID_Status_AtimDuration,
-	awc_RID_Status_HopPeriod,
-	awc_RID_Status_ChannelSet,
-	awc_RID_Status_Channel,
-	awc_RID_Status_HopsToBackbone,
-	awc_RID_Status_ApTotalLoad,
-	awc_RID_Status_OurGeneratedLoad,
-	awc_RID_Status_AccumulatedArl,
-	{0}
-};
-
-
-struct aironet4500_RID awc_AP_RID[]={
-	awc_RID_AP_16RidLen,
-	awc_RID_AP_TIM_addr,
-	awc_RID_AP_Airo_addr,
-	{0}
-};
-
-
-struct aironet4500_RID awc_Stats_RID[]={
-	awc_RID_Stats_RidLen,
-	awc_RID_Stats_RxOverrunErr,
-	awc_RID_Stats_RxPlcpCrcErr,
-	awc_RID_Stats_RxPlcpFormat,
-	awc_RID_Stats_RxPlcpLength,
-	awc_RID_Stats_RxMacCrcErr,
-	awc_RID_Stats_RxMacCrcOk,
-	awc_RID_Stats_RxWepErr,
-	awc_RID_Stats_RxWepOk,
-	awc_RID_Stats_RetryLong,
-	awc_RID_Stats_RetryShort,
-	awc_RID_Stats_MaxRetries,
-	awc_RID_Stats_NoAck,
-	awc_RID_Stats_NoCts,
-	awc_RID_Stats_RxAck,
-	awc_RID_Stats_RxCts,
-	awc_RID_Stats_TxAck,
-	awc_RID_Stats_TxRts,
-	awc_RID_Stats_TxCts,
-	awc_RID_Stats_TxMc,
-	awc_RID_Stats_TxBc,
-	awc_RID_Stats_TxUcFrags,
-	awc_RID_Stats_TxUcPackets,
-	awc_RID_Stats_TxBeacon,
-	awc_RID_Stats_RxBeacon,
-	awc_RID_Stats_TxSinColl,
-	awc_RID_Stats_TxMulColl,
-	awc_RID_Stats_DefersNo,
-	awc_RID_Stats_DefersProt,
-	awc_RID_Stats_DefersEngy,
-	awc_RID_Stats_DupFram,
-	awc_RID_Stats_RxFragDisc,
-	awc_RID_Stats_TxAged,
-	awc_RID_Stats_RxAged,
-	awc_RID_Stats_LostSync_Max,
-	awc_RID_Stats_LostSync_Mis,
-	awc_RID_Stats_LostSync_Arl,
-	awc_RID_Stats_LostSync_Dea,
-	awc_RID_Stats_LostSync_Disa,
-	awc_RID_Stats_LostSync_Tsf,
-	awc_RID_Stats_HostTxMc,
-	awc_RID_Stats_HostTxBc,
-	awc_RID_Stats_HostTxUc,
-	awc_RID_Stats_HostTxFail,
-	awc_RID_Stats_HostRxMc,
-	awc_RID_Stats_HostRxBc,
-	awc_RID_Stats_HostRxUc,
-	awc_RID_Stats_HostRxDiscar,
-	awc_RID_Stats_HmacTxMc,
-	awc_RID_Stats_HmacTxBc,
-	awc_RID_Stats_HmacTxUc,
-	awc_RID_Stats_HmacTxFail,
-	awc_RID_Stats_HmacRxMc,
-	awc_RID_Stats_HmacRxBc,
-	awc_RID_Stats_HmacRxUc,
-	awc_RID_Stats_HmacRxDisca,
-	awc_RID_Stats_HmacRxAcce,
-	awc_RID_Stats_SsidMismatch,
-	awc_RID_Stats_ApMismatch,
-	awc_RID_Stats_RatesMismatc,
-	awc_RID_Stats_AuthReject,
-	awc_RID_Stats_AuthTimeout,
-	awc_RID_Stats_AssocReject,
-	awc_RID_Stats_AssocTimeout,
-	awc_RID_Stats_NewReason,
-	awc_RID_Stats_AuthFail_1,
-	awc_RID_Stats_AuthFail_2,
-	awc_RID_Stats_AuthFail_3,
-	awc_RID_Stats_AuthFail_4,
-	awc_RID_Stats_AuthFail_5,
-	awc_RID_Stats_AuthFail_6,
-	awc_RID_Stats_AuthFail_7,
-	awc_RID_Stats_AuthFail_8,
-	awc_RID_Stats_AuthFail_9,
-	awc_RID_Stats_AuthFail_10,
-	awc_RID_Stats_AuthFail_11,
-	awc_RID_Stats_AuthFail_12,
-	awc_RID_Stats_AuthFail_13,
-	awc_RID_Stats_AuthFail_14,
-	awc_RID_Stats_AuthFail_15,
-	awc_RID_Stats_AuthFail_16,
-	awc_RID_Stats_AuthFail_17,
-	awc_RID_Stats_AuthFail_18,
-	awc_RID_Stats_AuthFail_19,
-	awc_RID_Stats_RxMan,
-	awc_RID_Stats_TxMan,
-	awc_RID_Stats_RxRefresh,
-	awc_RID_Stats_TxRefresh,
-	awc_RID_Stats_RxPoll,
-	awc_RID_Stats_TxPoll,
-	awc_RID_Stats_HostRetries,
-	awc_RID_Stats_LostSync_HostReq,
-	awc_RID_Stats_HostTxBytes,
-	awc_RID_Stats_HostRxBytes,
-	awc_RID_Stats_ElapsedUsec,
-	awc_RID_Stats_ElapsedSec,
-	awc_RID_Stats_LostSyncBett,
-	{0}
-};
-
-
-
-struct aironet4500_RID awc_Stats_delta_RID[]={
-	awc_RID_Stats_delta_RidLen,
-	awc_RID_Stats_delta_RxOverrunErr,
-	awc_RID_Stats_delta_RxPlcpCrcErr,
-	awc_RID_Stats_delta_RxPlcpFormat,
-	awc_RID_Stats_delta_RxPlcpLength,
-	awc_RID_Stats_delta_RxMacCrcErr,
-	awc_RID_Stats_delta_RxMacCrcOk,
-	awc_RID_Stats_delta_RxWepErr,
-	awc_RID_Stats_delta_RxWepOk,
-	awc_RID_Stats_delta_RetryLong,
-	awc_RID_Stats_delta_RetryShort,
-	awc_RID_Stats_delta_MaxRetries,
-	awc_RID_Stats_delta_NoAck,
-	awc_RID_Stats_delta_NoCts,
-	awc_RID_Stats_delta_RxAck,
-	awc_RID_Stats_delta_RxCts,
-	awc_RID_Stats_delta_TxAck,
-	awc_RID_Stats_delta_TxRts,
-	awc_RID_Stats_delta_TxCts,
-	awc_RID_Stats_delta_TxMc,
-	awc_RID_Stats_delta_TxBc,
-	awc_RID_Stats_delta_TxUcFrags,
-	awc_RID_Stats_delta_TxUcPackets,
-	awc_RID_Stats_delta_TxBeacon,
-	awc_RID_Stats_delta_RxBeacon,
-	awc_RID_Stats_delta_TxSinColl,
-	awc_RID_Stats_delta_TxMulColl,
-	awc_RID_Stats_delta_DefersNo,
-	awc_RID_Stats_delta_DefersProt,
-	awc_RID_Stats_delta_DefersEngy,
-	awc_RID_Stats_delta_DupFram,
-	awc_RID_Stats_delta_RxFragDisc,
-	awc_RID_Stats_delta_TxAged,
-	awc_RID_Stats_delta_RxAged,
-	awc_RID_Stats_delta_LostSync_Max,
-	awc_RID_Stats_delta_LostSync_Mis,
-	awc_RID_Stats_delta_LostSync_Arl,
-	awc_RID_Stats_delta_LostSync_Dea,
-	awc_RID_Stats_delta_LostSync_Disa,
-	awc_RID_Stats_delta_LostSync_Tsf,
-	awc_RID_Stats_delta_HostTxMc,
-	awc_RID_Stats_delta_HostTxBc,
-	awc_RID_Stats_delta_HostTxUc,
-	awc_RID_Stats_delta_HostTxFail,
-	awc_RID_Stats_delta_HostRxMc,
-	awc_RID_Stats_delta_HostRxBc,
-	awc_RID_Stats_delta_HostRxUc,
-	awc_RID_Stats_delta_HostRxDiscar,
-	awc_RID_Stats_delta_HmacTxMc,
-	awc_RID_Stats_delta_HmacTxBc,
-	awc_RID_Stats_delta_HmacTxUc,
-	awc_RID_Stats_delta_HmacTxFail,
-	awc_RID_Stats_delta_HmacRxMc,
-	awc_RID_Stats_delta_HmacRxBc,
-	awc_RID_Stats_delta_HmacRxUc,
-	awc_RID_Stats_delta_HmacRxDisca,
-	awc_RID_Stats_delta_HmacRxAcce,
-	awc_RID_Stats_delta_SsidMismatch,
-	awc_RID_Stats_delta_ApMismatch,
-	awc_RID_Stats_delta_RatesMismatc,
-	awc_RID_Stats_delta_AuthReject,
-	awc_RID_Stats_delta_AuthTimeout,
-	awc_RID_Stats_delta_AssocReject,
-	awc_RID_Stats_delta_AssocTimeout,
-	awc_RID_Stats_delta_NewReason,
-	awc_RID_Stats_delta_AuthFail_1,
-	awc_RID_Stats_delta_AuthFail_2,
-	awc_RID_Stats_delta_AuthFail_3,
-	awc_RID_Stats_delta_AuthFail_4,
-	awc_RID_Stats_delta_AuthFail_5,
-	awc_RID_Stats_delta_AuthFail_6,
-	awc_RID_Stats_delta_AuthFail_7,
-	awc_RID_Stats_delta_AuthFail_8,
-	awc_RID_Stats_delta_AuthFail_9,
-	awc_RID_Stats_delta_AuthFail_10,
-	awc_RID_Stats_delta_AuthFail_11,
-	awc_RID_Stats_delta_AuthFail_12,
-	awc_RID_Stats_delta_AuthFail_13,
-	awc_RID_Stats_delta_AuthFail_14,
-	awc_RID_Stats_delta_AuthFail_15,
-	awc_RID_Stats_delta_AuthFail_16,
-	awc_RID_Stats_delta_AuthFail_17,
-	awc_RID_Stats_delta_AuthFail_18,
-	awc_RID_Stats_delta_AuthFail_19,
-	awc_RID_Stats_delta_RxMan,
-	awc_RID_Stats_delta_TxMan,
-	awc_RID_Stats_delta_RxRefresh,
-	awc_RID_Stats_delta_TxRefresh,
-	awc_RID_Stats_delta_RxPoll,
-	awc_RID_Stats_delta_TxPoll,
-	awc_RID_Stats_delta_HostRetries,
-	awc_RID_Stats_delta_LostSync_HostReq,
-	awc_RID_Stats_delta_HostTxBytes,
-	awc_RID_Stats_delta_HostRxBytes,
-	awc_RID_Stats_delta_ElapsedUsec,
-	awc_RID_Stats_delta_ElapsedSec,
-	awc_RID_Stats_delta_LostSyncBett,
-	{0}
-};
-
-struct aironet4500_RID awc_Stats_clear_RID[]={
-	awc_RID_Stats_clear_RidLen,
-	awc_RID_Stats_clear_RxOverrunErr,
-	awc_RID_Stats_clear_RxPlcpCrcErr,
-	awc_RID_Stats_clear_RxPlcpFormat,
-	awc_RID_Stats_clear_RxPlcpLength,
-	awc_RID_Stats_clear_RxMacCrcErr,
-	awc_RID_Stats_clear_RxMacCrcOk,
-	awc_RID_Stats_clear_RxWepErr,
-	awc_RID_Stats_clear_RxWepOk,
-	awc_RID_Stats_clear_RetryLong,
-	awc_RID_Stats_clear_RetryShort,
-	awc_RID_Stats_clear_MaxRetries,
-	awc_RID_Stats_clear_NoAck,
-	awc_RID_Stats_clear_NoCts,
-	awc_RID_Stats_clear_RxAck,
-	awc_RID_Stats_clear_RxCts,
-	awc_RID_Stats_clear_TxAck,
-	awc_RID_Stats_clear_TxRts,
-	awc_RID_Stats_clear_TxCts,
-	awc_RID_Stats_clear_TxMc,
-	awc_RID_Stats_clear_TxBc,
-	awc_RID_Stats_clear_TxUcFrags,
-	awc_RID_Stats_clear_TxUcPackets,
-	awc_RID_Stats_clear_TxBeacon,
-	awc_RID_Stats_clear_RxBeacon,
-	awc_RID_Stats_clear_TxSinColl,
-	awc_RID_Stats_clear_TxMulColl,
-	awc_RID_Stats_clear_DefersNo,
-	awc_RID_Stats_clear_DefersProt,
-	awc_RID_Stats_clear_DefersEngy,
-	awc_RID_Stats_clear_DupFram,
-	awc_RID_Stats_clear_RxFragDisc,
-	awc_RID_Stats_clear_TxAged,
-	awc_RID_Stats_clear_RxAged,
-	awc_RID_Stats_clear_LostSync_Max,
-	awc_RID_Stats_clear_LostSync_Mis,
-	awc_RID_Stats_clear_LostSync_Arl,
-	awc_RID_Stats_clear_LostSync_Dea,
-	awc_RID_Stats_clear_LostSync_Disa,
-	awc_RID_Stats_clear_LostSync_Tsf,
-	awc_RID_Stats_clear_HostTxMc,
-	awc_RID_Stats_clear_HostTxBc,
-	awc_RID_Stats_clear_HostTxUc,
-	awc_RID_Stats_clear_HostTxFail,
-	awc_RID_Stats_clear_HostRxMc,
-	awc_RID_Stats_clear_HostRxBc,
-	awc_RID_Stats_clear_HostRxUc,
-	awc_RID_Stats_clear_HostRxDiscar,
-	awc_RID_Stats_clear_HmacTxMc,
-	awc_RID_Stats_clear_HmacTxBc,
-	awc_RID_Stats_clear_HmacTxUc,
-	awc_RID_Stats_clear_HmacTxFail,
-	awc_RID_Stats_clear_HmacRxMc,
-	awc_RID_Stats_clear_HmacRxBc,
-	awc_RID_Stats_clear_HmacRxUc,
-	awc_RID_Stats_clear_HmacRxDisca,
-	awc_RID_Stats_clear_HmacRxAcce,
-	awc_RID_Stats_clear_SsidMismatch,
-	awc_RID_Stats_clear_ApMismatch,
-	awc_RID_Stats_clear_RatesMismatc,
-	awc_RID_Stats_clear_AuthReject,
-	awc_RID_Stats_clear_AuthTimeout,
-	awc_RID_Stats_clear_AssocReject,
-	awc_RID_Stats_clear_AssocTimeout,
-	awc_RID_Stats_clear_NewReason,
-	awc_RID_Stats_clear_AuthFail_1,
-	awc_RID_Stats_clear_AuthFail_2,
-	awc_RID_Stats_clear_AuthFail_3,
-	awc_RID_Stats_clear_AuthFail_4,
-	awc_RID_Stats_clear_AuthFail_5,
-	awc_RID_Stats_clear_AuthFail_6,
-	awc_RID_Stats_clear_AuthFail_7,
-	awc_RID_Stats_clear_AuthFail_8,
-	awc_RID_Stats_clear_AuthFail_9,
-	awc_RID_Stats_clear_AuthFail_10,
-	awc_RID_Stats_clear_AuthFail_11,
-	awc_RID_Stats_clear_AuthFail_12,
-	awc_RID_Stats_clear_AuthFail_13,
-	awc_RID_Stats_clear_AuthFail_14,
-	awc_RID_Stats_clear_AuthFail_15,
-	awc_RID_Stats_clear_AuthFail_16,
-	awc_RID_Stats_clear_AuthFail_17,
-	awc_RID_Stats_clear_AuthFail_18,
-	awc_RID_Stats_clear_AuthFail_19,
-	awc_RID_Stats_clear_RxMan,
-	awc_RID_Stats_clear_TxMan,
-	awc_RID_Stats_clear_RxRefresh,
-	awc_RID_Stats_clear_TxRefresh,
-	awc_RID_Stats_clear_RxPoll,
-	awc_RID_Stats_clear_TxPoll,
-	awc_RID_Stats_clear_HostRetries,
-	awc_RID_Stats_clear_LostSync_HostReq,
-	awc_RID_Stats_clear_HostTxBytes,
-	awc_RID_Stats_clear_HostRxBytes,
-	awc_RID_Stats_clear_ElapsedUsec,
-	awc_RID_Stats_clear_ElapsedSec,
-	awc_RID_Stats_clear_LostSyncBett,
-	{0}
-};
-#ifdef AWC_USE_16BIT_STATS
-struct aironet4500_RID awc_Stats16_RID[]={
-	awc_RID_Stats16_RidLen,
-	awc_RID_Stats16_RxOverrunErr,
-	awc_RID_Stats16_RxPlcpCrcErr,
-	awc_RID_Stats16_RxPlcpFormat,
-	awc_RID_Stats16_RxPlcpLength,
-	awc_RID_Stats16_RxMacCrcErr,
-	awc_RID_Stats16_RxMacCrcOk,
-	awc_RID_Stats16_RxWepErr,
-	awc_RID_Stats16_RxWepOk,
-	awc_RID_Stats16_RetryLong,
-	awc_RID_Stats16_RetryShort,
-	awc_RID_Stats16_MaxRetries,
-	awc_RID_Stats16_NoAck,
-	awc_RID_Stats16_NoCts,
-	awc_RID_Stats16_RxAck,
-	awc_RID_Stats16_RxCts,
-	awc_RID_Stats16_TxAck,
-	awc_RID_Stats16_TxRts,
-	awc_RID_Stats16_TxCts,
-	awc_RID_Stats16_TxMc,
-	awc_RID_Stats16_TxBc,
-	awc_RID_Stats16_TxUcFrags,
-	awc_RID_Stats16_TxUcPackets,
-	awc_RID_Stats16_TxBeacon,
-	awc_RID_Stats16_RxBeacon,
-	awc_RID_Stats16_TxSinColl,
-	awc_RID_Stats16_TxMulColl,
-	awc_RID_Stats16_DefersNo,
-	awc_RID_Stats16_DefersProt,
-	awc_RID_Stats16_DefersEngy,
-	awc_RID_Stats16_DupFram,
-	awc_RID_Stats16_RxFragDisc,
-	awc_RID_Stats16_TxAged,
-	awc_RID_Stats16_RxAged,
-	awc_RID_Stats16_LostSync_Max,
-	awc_RID_Stats16_LostSync_Mis,
-	awc_RID_Stats16_LostSync_Arl,
-	awc_RID_Stats16_LostSync_Dea,
-	awc_RID_Stats16_LostSync_Disa,
-	awc_RID_Stats16_LostSync_Tsf,
-	awc_RID_Stats16_HostTxMc,
-	awc_RID_Stats16_HostTxBc,
-	awc_RID_Stats16_HostTxUc,
-	awc_RID_Stats16_HostTxFail,
-	awc_RID_Stats16_HostRxMc,
-	awc_RID_Stats16_HostRxBc,
-	awc_RID_Stats16_HostRxUc,
-	awc_RID_Stats16_HostRxDiscar,
-	awc_RID_Stats16_HmacTxMc,
-	awc_RID_Stats16_HmacTxBc,
-	awc_RID_Stats16_HmacTxUc,
-	awc_RID_Stats16_HmacTxFail,
-	awc_RID_Stats16_HmacRxMc,
-	awc_RID_Stats16_HmacRxBc,
-	awc_RID_Stats16_HmacRxUc,
-	awc_RID_Stats16_HmacRxDisca,
-	awc_RID_Stats16_HmacRxAcce,
-	awc_RID_Stats16_SsidMismatch,
-	awc_RID_Stats16_ApMismatch,
-	awc_RID_Stats16_RatesMismatc,
-	awc_RID_Stats16_AuthReject,
-	awc_RID_Stats16_AuthTimeout,
-	awc_RID_Stats16_AssocReject,
-	awc_RID_Stats16_AssocTimeout,
-	awc_RID_Stats16_NewReason,
-	awc_RID_Stats16_AuthFail_1,
-	awc_RID_Stats16_AuthFail_2,
-	awc_RID_Stats16_AuthFail_3,
-	awc_RID_Stats16_AuthFail_4,
-	awc_RID_Stats16_AuthFail_5,
-	awc_RID_Stats16_AuthFail_6,
-	awc_RID_Stats16_AuthFail_7,
-	awc_RID_Stats16_AuthFail_8,
-	awc_RID_Stats16_AuthFail_9,
-	awc_RID_Stats16_AuthFail_10,
-	awc_RID_Stats16_AuthFail_11,
-	awc_RID_Stats16_AuthFail_12,
-	awc_RID_Stats16_AuthFail_13,
-	awc_RID_Stats16_AuthFail_14,
-	awc_RID_Stats16_AuthFail_15,
-	awc_RID_Stats16_AuthFail_16,
-	awc_RID_Stats16_AuthFail_17,
-	awc_RID_Stats16_AuthFail_18,
-	awc_RID_Stats16_AuthFail_19,
-	awc_RID_Stats16_RxMan,
-	awc_RID_Stats16_TxMan,
-	awc_RID_Stats16_RxRefresh,
-	awc_RID_Stats16_TxRefresh,
-	awc_RID_Stats16_RxPoll,
-	awc_RID_Stats16_TxPoll,
-	awc_RID_Stats16_HostRetries,
-	awc_RID_Stats16_LostSync_HostReq,
-	awc_RID_Stats16_HostTxBytes,
-	awc_RID_Stats16_HostRxBytes,
-	awc_RID_Stats16_ElapsedUsec,
-	awc_RID_Stats16_ElapsedSec,
-	awc_RID_Stats16_LostSyncBett,
-	{0}
-};
-
-struct aironet4500_RID awc_Stats16_delta_RID[]={
-	awc_RID_Stats16_delta_RidLen,
-	awc_RID_Stats16_delta_RxOverrunErr,
-	awc_RID_Stats16_delta_RxPlcpCrcErr,
-	awc_RID_Stats16_delta_RxPlcpFormat,
-	awc_RID_Stats16_delta_RxPlcpLength,
-	awc_RID_Stats16_delta_RxMacCrcErr,
-	awc_RID_Stats16_delta_RxMacCrcOk,
-	awc_RID_Stats16_delta_RxWepErr,
-	awc_RID_Stats16_delta_RxWepOk,
-	awc_RID_Stats16_delta_RetryLong,
-	awc_RID_Stats16_delta_RetryShort,
-	awc_RID_Stats16_delta_MaxRetries,
-	awc_RID_Stats16_delta_NoAck,
-	awc_RID_Stats16_delta_NoCts,
-	awc_RID_Stats16_delta_RxAck,
-	awc_RID_Stats16_delta_RxCts,
-	awc_RID_Stats16_delta_TxAck,
-	awc_RID_Stats16_delta_TxRts,
-	awc_RID_Stats16_delta_TxCts,
-	awc_RID_Stats16_delta_TxMc,
-	awc_RID_Stats16_delta_TxBc,
-	awc_RID_Stats16_delta_TxUcFrags,
-	awc_RID_Stats16_delta_TxUcPackets,
-	awc_RID_Stats16_delta_TxBeacon,
-	awc_RID_Stats16_delta_RxBeacon,
-	awc_RID_Stats16_delta_TxSinColl,
-	awc_RID_Stats16_delta_TxMulColl,
-	awc_RID_Stats16_delta_DefersNo,
-	awc_RID_Stats16_delta_DefersProt,
-	awc_RID_Stats16_delta_DefersEngy,
-	awc_RID_Stats16_delta_DupFram,
-	awc_RID_Stats16_delta_RxFragDisc,
-	awc_RID_Stats16_delta_TxAged,
-	awc_RID_Stats16_delta_RxAged,
-	awc_RID_Stats16_delta_LostSync_Max,
-	awc_RID_Stats16_delta_LostSync_Mis,
-	awc_RID_Stats16_delta_LostSync_Arl,
-	awc_RID_Stats16_delta_LostSync_Dea,
-	awc_RID_Stats16_delta_LostSync_Disa,
-	awc_RID_Stats16_delta_LostSync_Tsf,
-	awc_RID_Stats16_delta_HostTxMc,
-	awc_RID_Stats16_delta_HostTxBc,
-	awc_RID_Stats16_delta_HostTxUc,
-	awc_RID_Stats16_delta_HostTxFail,
-	awc_RID_Stats16_delta_HostRxMc,
-	awc_RID_Stats16_delta_HostRxBc,
-	awc_RID_Stats16_delta_HostRxUc,
-	awc_RID_Stats16_delta_HostRxDiscar,
-	awc_RID_Stats16_delta_HmacTxMc,
-	awc_RID_Stats16_delta_HmacTxBc,
-	awc_RID_Stats16_delta_HmacTxUc,
-	awc_RID_Stats16_delta_HmacTxFail,
-	awc_RID_Stats16_delta_HmacRxMc,
-	awc_RID_Stats16_delta_HmacRxBc,
-	awc_RID_Stats16_delta_HmacRxUc,
-	awc_RID_Stats16_delta_HmacRxDisca,
-	awc_RID_Stats16_delta_HmacRxAcce,
-	awc_RID_Stats16_delta_SsidMismatch,
-	awc_RID_Stats16_delta_ApMismatch,
-	awc_RID_Stats16_delta_RatesMismatc,
-	awc_RID_Stats16_delta_AuthReject,
-	awc_RID_Stats16_delta_AuthTimeout,
-	awc_RID_Stats16_delta_AssocReject,
-	awc_RID_Stats16_delta_AssocTimeout,
-	awc_RID_Stats16_delta_NewReason,
-	awc_RID_Stats16_delta_AuthFail_1,
-	awc_RID_Stats16_delta_AuthFail_2,
-	awc_RID_Stats16_delta_AuthFail_3,
-	awc_RID_Stats16_delta_AuthFail_4,
-	awc_RID_Stats16_delta_AuthFail_5,
-	awc_RID_Stats16_delta_AuthFail_6,
-	awc_RID_Stats16_delta_AuthFail_7,
-	awc_RID_Stats16_delta_AuthFail_8,
-	awc_RID_Stats16_delta_AuthFail_9,
-	awc_RID_Stats16_delta_AuthFail_10,
-	awc_RID_Stats16_delta_AuthFail_11,
-	awc_RID_Stats16_delta_AuthFail_12,
-	awc_RID_Stats16_delta_AuthFail_13,
-	awc_RID_Stats16_delta_AuthFail_14,
-	awc_RID_Stats16_delta_AuthFail_15,
-	awc_RID_Stats16_delta_AuthFail_16,
-	awc_RID_Stats16_delta_AuthFail_17,
-	awc_RID_Stats16_delta_AuthFail_18,
-	awc_RID_Stats16_delta_AuthFail_19,
-	awc_RID_Stats16_delta_RxMan,
-	awc_RID_Stats16_delta_TxMan,
-	awc_RID_Stats16_delta_RxRefresh,
-	awc_RID_Stats16_delta_TxRefresh,
-	awc_RID_Stats16_delta_RxPoll,
-	awc_RID_Stats16_delta_TxPoll,
-	awc_RID_Stats16_delta_HostRetries,
-	awc_RID_Stats16_delta_LostSync_HostReq,
-	awc_RID_Stats16_delta_HostTxBytes,
-	awc_RID_Stats16_delta_HostRxBytes,
-	awc_RID_Stats16_delta_ElapsedUsec,
-	awc_RID_Stats16_delta_ElapsedSec,
-	awc_RID_Stats16_delta_LostSyncBett,
-	{0}
-};
-
-struct aironet4500_RID awc_Stats16_clear_RID[]={
-	awc_RID_Stats16_clear_RidLen,
-	awc_RID_Stats16_clear_RxOverrunErr,
-	awc_RID_Stats16_clear_RxPlcpCrcErr,
-	awc_RID_Stats16_clear_RxPlcpFormat,
-	awc_RID_Stats16_clear_RxPlcpLength,
-	awc_RID_Stats16_clear_RxMacCrcErr,
-	awc_RID_Stats16_clear_RxMacCrcOk,
-	awc_RID_Stats16_clear_RxWepErr,
-	awc_RID_Stats16_clear_RxWepOk,
-	awc_RID_Stats16_clear_RetryLong,
-	awc_RID_Stats16_clear_RetryShort,
-	awc_RID_Stats16_clear_MaxRetries,
-	awc_RID_Stats16_clear_NoAck,
-	awc_RID_Stats16_clear_NoCts,
-	awc_RID_Stats16_clear_RxAck,
-	awc_RID_Stats16_clear_RxCts,
-	awc_RID_Stats16_clear_TxAck,
-	awc_RID_Stats16_clear_TxRts,
-	awc_RID_Stats16_clear_TxCts,
-	awc_RID_Stats16_clear_TxMc,
-	awc_RID_Stats16_clear_TxBc,
-	awc_RID_Stats16_clear_TxUcFrags,
-	awc_RID_Stats16_clear_TxUcPackets,
-	awc_RID_Stats16_clear_TxBeacon,
-	awc_RID_Stats16_clear_RxBeacon,
-	awc_RID_Stats16_clear_TxSinColl,
-	awc_RID_Stats16_clear_TxMulColl,
-	awc_RID_Stats16_clear_DefersNo,
-	awc_RID_Stats16_clear_DefersProt,
-	awc_RID_Stats16_clear_DefersEngy,
-	awc_RID_Stats16_clear_DupFram,
-	awc_RID_Stats16_clear_RxFragDisc,
-	awc_RID_Stats16_clear_TxAged,
-	awc_RID_Stats16_clear_RxAged,
-	awc_RID_Stats16_clear_LostSync_Max,
-	awc_RID_Stats16_clear_LostSync_Mis,
-	awc_RID_Stats16_clear_LostSync_Arl,
-	awc_RID_Stats16_clear_LostSync_Dea,
-	awc_RID_Stats16_clear_LostSync_Disa,
-	awc_RID_Stats16_clear_LostSync_Tsf,
-	awc_RID_Stats16_clear_HostTxMc,
-	awc_RID_Stats16_clear_HostTxBc,
-	awc_RID_Stats16_clear_HostTxUc,
-	awc_RID_Stats16_clear_HostTxFail,
-	awc_RID_Stats16_clear_HostRxMc,
-	awc_RID_Stats16_clear_HostRxBc,
-	awc_RID_Stats16_clear_HostRxUc,
-	awc_RID_Stats16_clear_HostRxDiscar,
-	awc_RID_Stats16_clear_HmacTxMc,
-	awc_RID_Stats16_clear_HmacTxBc,
-	awc_RID_Stats16_clear_HmacTxUc,
-	awc_RID_Stats16_clear_HmacTxFail,
-	awc_RID_Stats16_clear_HmacRxMc,
-	awc_RID_Stats16_clear_HmacRxBc,
-	awc_RID_Stats16_clear_HmacRxUc,
-	awc_RID_Stats16_clear_HmacRxDisca,
-	awc_RID_Stats16_clear_HmacRxAcce,
-	awc_RID_Stats16_clear_SsidMismatch,
-	awc_RID_Stats16_clear_ApMismatch,
-	awc_RID_Stats16_clear_RatesMismatc,
-	awc_RID_Stats16_clear_AuthReject,
-	awc_RID_Stats16_clear_AuthTimeout,
-	awc_RID_Stats16_clear_AssocReject,
-	awc_RID_Stats16_clear_AssocTimeout,
-	awc_RID_Stats16_clear_NewReason,
-	awc_RID_Stats16_clear_AuthFail_1,
-	awc_RID_Stats16_clear_AuthFail_2,
-	awc_RID_Stats16_clear_AuthFail_3,
-	awc_RID_Stats16_clear_AuthFail_4,
-	awc_RID_Stats16_clear_AuthFail_5,
-	awc_RID_Stats16_clear_AuthFail_6,
-	awc_RID_Stats16_clear_AuthFail_7,
-	awc_RID_Stats16_clear_AuthFail_8,
-	awc_RID_Stats16_clear_AuthFail_9,
-	awc_RID_Stats16_clear_AuthFail_10,
-	awc_RID_Stats16_clear_AuthFail_11,
-	awc_RID_Stats16_clear_AuthFail_12,
-	awc_RID_Stats16_clear_AuthFail_13,
-	awc_RID_Stats16_clear_AuthFail_14,
-	awc_RID_Stats16_clear_AuthFail_15,
-	awc_RID_Stats16_clear_AuthFail_16,
-	awc_RID_Stats16_clear_AuthFail_17,
-	awc_RID_Stats16_clear_AuthFail_18,
-	awc_RID_Stats16_clear_AuthFail_19,
-	awc_RID_Stats16_clear_RxMan,
-	awc_RID_Stats16_clear_TxMan,
-	awc_RID_Stats16_clear_RxRefresh,
-	awc_RID_Stats16_clear_TxRefresh,
-	awc_RID_Stats16_clear_RxPoll,
-	awc_RID_Stats16_clear_TxPoll,
-	awc_RID_Stats16_clear_HostRetries,
-	awc_RID_Stats16_clear_LostSync_HostReq,
-	awc_RID_Stats16_clear_HostTxBytes,
-	awc_RID_Stats16_clear_HostRxBytes,
-	awc_RID_Stats16_clear_ElapsedUsec,
-	awc_RID_Stats16_clear_ElapsedSec,
-	awc_RID_Stats16_clear_LostSyncBett,
-	{0}
-};
-
-#endif
-
-struct awc_rid_dir awc_rids[]={
-	// following MUST be consistent with awc_rids_setup !!!
-   {&aironet4500_RID_Select_General_Config,sizeof(awc_gen_RID) / sizeof(struct aironet4500_RID)  ,awc_gen_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_SSID_list, sizeof(awc_SSID_RID) / sizeof(struct aironet4500_RID) , awc_SSID_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_AP_list, sizeof(awc_AP_List_RID) / sizeof(struct aironet4500_RID) , awc_AP_List_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_Driver_name, sizeof(awc_Dname_RID) / sizeof(struct aironet4500_RID) , awc_Dname_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_Encapsulation, sizeof(awc_enc_RID) / sizeof(struct aironet4500_RID) , awc_enc_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_Active_Config, sizeof(awc_act_RID) / sizeof(struct aironet4500_RID) , awc_act_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_Capabilities, sizeof(awc_Cap_RID) / sizeof(struct aironet4500_RID) , awc_Cap_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_Status, sizeof(awc_Status_RID) / sizeof(struct aironet4500_RID) , awc_Status_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_AP_Info, sizeof(awc_AP_RID) / sizeof(struct aironet4500_RID) , awc_AP_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_32_stats, sizeof(awc_Stats_RID) / sizeof(struct aironet4500_RID) , awc_Stats_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_32_stats_delta, sizeof(awc_Stats_delta_RID) / sizeof(struct aironet4500_RID) , awc_Stats_delta_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_32_stats_clear, sizeof(awc_Stats_clear_RID) / sizeof(struct aironet4500_RID) , awc_Stats_clear_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_WEP_volatile, sizeof(awc_WEPv_RID) / sizeof(struct aironet4500_RID) , awc_WEPv_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_WEP_nonvolatile, sizeof(awc_WEPnv_RID) / sizeof(struct aironet4500_RID) , awc_WEPnv_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_Modulation, sizeof(awc_Modulation_RID) / sizeof(struct aironet4500_RID) , awc_Modulation_RID , NULL, NULL,0 },
-
-#ifdef AWC_USE_16BIT_STATS
-   {&aironet4500_RID_Select_16_stats, sizeof(awc_Stats16_RID) / sizeof(struct aironet4500_RID) , awc_Stats16_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_16_stats_delta, sizeof(awc_Stats16_delta_RID) / sizeof(struct aironet4500_RID) , awc_Stats16_delta_RID , NULL, NULL,0 },
-   {&aironet4500_RID_Select_16_stats_clear, sizeof(awc_Stats16_clear_RID) / sizeof(struct aironet4500_RID) , awc_Stats16_clear_RID , NULL, NULL,0 },
-#else 
-   {NULL},{NULL},{NULL},
-#endif	
- 
-   {0} 
-
-
-};
-
-
-int awc_nof_rids = (sizeof(awc_rids) / sizeof(struct awc_rid_dir)) -1;
-
-
-int awc_rids_setup(struct net_device * dev){
-
-	struct awc_private * priv = (struct awc_private *) dev->priv;
-	int i=0;
-	while ( i < AWC_NOF_RIDS){
-		if (awc_rids[i].selector)
-			memcpy(&priv->rid_dir[i],&awc_rids[i],sizeof(priv->rid_dir[0]) );
-		else priv->rid_dir[i].selector = NULL;
-		i++;
-	}
-	for (i=0; i< AWC_NOF_RIDS && i < awc_nof_rids; i++){
-		priv->rid_dir[i].dev = dev;
-	};
-	
-	// following MUST be consistent with awc_rids !!!
- 	priv->rid_dir[0].buff = &priv->config; // card RID mirrors
-	priv->rid_dir[1].buff = &priv->SSIDs;
-	priv->rid_dir[2].buff = &priv->fixed_APs;
-     	priv->rid_dir[3].buff = &priv->driver_name;
-      	priv->rid_dir[4].buff = &priv->enc_trans;
-	priv->rid_dir[5].buff = &priv->general_config; //      	
-	priv->rid_dir[6].buff = &priv->capabilities;
- 	priv->rid_dir[7].buff = &priv->status;
-  	priv->rid_dir[8].buff = &priv->AP;
-   	priv->rid_dir[9].buff = &priv->statistics;
-    	priv->rid_dir[10].buff = &priv->statistics_delta;
-     	priv->rid_dir[11].buff = &priv->statistics_delta_clear;
-	priv->rid_dir[12].buff = &priv->wep_volatile;
-	priv->rid_dir[13].buff = &priv->wep_nonvolatile;
-	priv->rid_dir[14].buff = &priv->modulation;
-
-      	priv->rid_dir[15].buff = &priv->statistics16;
-	priv->rid_dir[16].buff = &priv->statistics16_delta;
- 	priv->rid_dir[17].buff = &priv->statistics16_delta_clear;
-                       	
- 	priv->rid_dir[0].bufflen = sizeof(priv->config); // card RID mirrors
-	priv->rid_dir[1].bufflen = sizeof(priv->SSIDs);
-	priv->rid_dir[2].bufflen = sizeof(priv->fixed_APs);
-     	priv->rid_dir[3].bufflen = sizeof(priv->driver_name);
-      	priv->rid_dir[4].bufflen = sizeof(priv->enc_trans);
-	priv->rid_dir[5].bufflen = sizeof(priv->general_config); //
-	priv->rid_dir[6].bufflen = sizeof(priv->capabilities);
- 	priv->rid_dir[7].bufflen = sizeof(priv->status);
-  	priv->rid_dir[8].bufflen = sizeof(priv->AP);
-   	priv->rid_dir[9].bufflen = sizeof(priv->statistics);
-    	priv->rid_dir[10].bufflen = sizeof(priv->statistics_delta);
-     	priv->rid_dir[11].bufflen = sizeof(priv->statistics_delta_clear);
-	priv->rid_dir[12].bufflen = sizeof(priv->wep_volatile);
-	priv->rid_dir[13].bufflen = sizeof(priv->wep_nonvolatile);
-	priv->rid_dir[14].bufflen = sizeof(priv->modulation);
-
-      	priv->rid_dir[15].bufflen = sizeof(priv->statistics16);
-	priv->rid_dir[16].bufflen = sizeof(priv->statistics16_delta);
- 	priv->rid_dir[17].bufflen = sizeof(priv->statistics16_delta_clear);
-
-	return 0;
-
-};
-
-
-
-
-
diff -Nru a/drivers/net/am79c961a.c b/drivers/net/am79c961a.c
--- a/drivers/net/am79c961a.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/net/am79c961a.c	Sun Feb 23 22:25:25 2003
@@ -150,7 +150,7 @@
 	}
 }
 #else
-#error Not compatable
+#error Not compatible
 #endif
 
 static int
diff -Nru a/drivers/net/arlan-proc.c b/drivers/net/arlan-proc.c
--- a/drivers/net/arlan-proc.c	Sun Feb 23 22:25:24 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1274 +0,0 @@
-#include <linux/config.h>
-#include "arlan.h"
-
-#include <linux/sysctl.h>
-
-#ifdef CONFIG_PROC_FS
-
-
-#include <linux/version.h>
-
-/* void enableReceive(struct net_device* dev);
-*/
-
-
-
-#define ARLAN_STR_SIZE 	0x2ff0
-#define DEV_ARLAN_INFO 	1
-#define DEV_ARLAN 	1
-#define SARLG(type,var) {\
-	pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n", #var, READSHMB(priva->card->var));	\
-	}
-
-#define SARLBN(type,var,nn) {\
-	pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x",#var);\
-	for (i=0; i < nn; i++ ) pos += sprintf(arlan_drive_info+pos, "%02x",READSHMB(priva->card->var[i]));\
-	pos += sprintf(arlan_drive_info+pos, "\n");	\
-	}
-
-#define SARLBNpln(type,var,nn) {\
-	for (i=0; i < nn; i++ ) pos += sprintf(arlan_drive_info+pos, "%02x",READSHMB(priva->card->var[i]));\
-	}
-
-#define SARLSTR(var,nn) {\
-	char tmpStr[400];\
-	int  tmpLn = nn;\
-	if (nn > 399 ) tmpLn = 399; \
-	memcpy(tmpStr,(char *) priva->conf->var,tmpLn);\
-	tmpStr[tmpLn] = 0; \
-	pos += sprintf(arlan_drive_info+pos, "%s\t=\t%s \n",#var,priva->conf->var);\
-	}
-
-#define SARLUC(var)  	SARLG(u_char, var)
-#define SARLUCN(var,nn) SARLBN(u_char,var, nn)
-#define SARLUS(var)	SARLG(u_short, var)
-#define SARLUSN(var,nn)	SARLBN(u_short,var, nn)
-#define SARLUI(var)	SARLG(u_int, var)
-
-#define SARLUSA(var) {\
-	u_short tmpVar;\
-	memcpy(&tmpVar, (short *) priva->conf->var,2); \
-	pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n",#var, tmpVar);\
-}
-
-#define SARLUIA(var) {\
-	u_int tmpVar;\
-	memcpy(&tmpVar, (int* )priva->conf->var,4); \
-	pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n",#var, tmpVar);\
-}
-
-
-static const char *arlan_diagnostic_info_string(struct net_device *dev)
-{
-
-	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
-	u_char diagnosticInfo;
-
-	READSHM(diagnosticInfo, arlan->diagnosticInfo, u_char);
-
-	switch (diagnosticInfo)
-	{
-		case 0xFF:
-			return "Diagnostic info is OK";
-		case 0xFE:
-			return "ERROR EPROM Checksum error ";
-		case 0xFD:
-			return "ERROR Local Ram Test Failed ";
-		case 0xFC:
-			return "ERROR SCC failure ";
-		case 0xFB:
-			return "ERROR BackBone failure ";
-		case 0xFA:
-			return "ERROR tranceiver not found ";
-		case 0xF9:
-			return "ERROR no more address space ";
-		case 0xF8:
-			return "ERROR Checksum error  ";
-		case 0xF7:
-			return "ERROR Missing SS Code";
-		case 0xF6:
-			return "ERROR Invalid config format";
-		case 0xF5:
-			return "ERROR Reserved errorcode F5";
-		case 0xF4:
-			return "ERROR Invalid spreading code/channel number";
-		case 0xF3:
-			return "ERROR Load Code Error";
-		case 0xF2:
-			return "ERROR Reserver errorcode F2 ";
-		case 0xF1:
-			return "ERROR Invalid command receivec by LAN card ";
-		case 0xF0:
-			return "ERROR Invalid parameter found in command ";
-		case 0xEF:
-			return "ERROR On-chip timer failure ";
-		case 0xEE:
-			return "ERROR T410 timer failure ";
-		case 0xED:
-			return "ERROR Too Many TxEnable commands ";
-		case 0xEC:
-			return "ERROR EEPROM error on radio module ";
-		default:
-			return "ERROR unknown Diagnostic info reply code ";
-	  }
-};
-
-static const char *arlan_hardware_type_string(struct net_device *dev)
-{
-	u_char hardwareType;
-	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
-
-	READSHM(hardwareType, arlan->hardwareType, u_char);
-	switch (hardwareType)
-	{
-		case 0x00:
-			return "type A450";
-		case 0x01:
-			return "type A650 ";
-		case 0x04:
-			return "type TMA coproc";
-		case 0x0D:
-			return "type A650E ";
-		case 0x18:
-			return "type TMA coproc Australian";
-		case 0x19:
-			return "type A650A ";
-		case 0x26:
-			return "type TMA coproc European";
-		case 0x2E:
-			return "type A655 ";
-		case 0x2F:
-			return "type A655A ";
-		case 0x30:
-			return "type A655E ";
-		case 0x0B:
-			return "type A670 ";
-		case 0x0C:
-			return "type A670E ";
-		case 0x2D:
-			return "type A670A ";
-		case 0x0F:
-			return "type A411T";
-		case 0x16:
-			return "type A411TA";
-		case 0x1B:
-			return "type A440T";
-		case 0x1C:
-			return "type A412T";
-		case 0x1E:
-			return "type A412TA";
-		case 0x22:
-			return "type A411TE";
-		case 0x24:
-			return "type A412TE";
-		case 0x27:
-			return "type A671T ";
-		case 0x29:
-			return "type A671TA ";
-		case 0x2B:
-			return "type A671TE ";
-		case 0x31:
-			return "type A415T ";
-		case 0x33:
-			return "type A415TA ";
-		case 0x35:
-			return "type A415TE ";
-		case 0x37:
-			return "type A672";
-		case 0x39:
-			return "type A672A ";
-		case 0x3B:
-			return "type A672T";
-		case 0x6B:
-			return "type IC2200";
-		default:
-			return "type A672T";
-	}
-}
-#ifdef ARLAN_DEBUGGING
-static void arlan_print_diagnostic_info(struct net_device *dev)
-{
-	int i;
-	u_char diagnosticInfo;
-	u_short diagnosticOffset;
-	u_char hardwareType;
-	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
-
-	//  ARLAN_DEBUG_ENTRY("arlan_print_diagnostic_info");
-
-	if (READSHMB(arlan->configuredStatusFlag) == 0)
-		printk("Arlan: Card NOT configured\n");
-	else
-		printk("Arlan: Card is configured\n");
-
-	READSHM(diagnosticInfo, arlan->diagnosticInfo, u_char);
-	READSHM(diagnosticOffset, arlan->diagnosticOffset, u_short);
-
-	printk(KERN_INFO "%s\n", arlan_diagnostic_info_string(dev));
-
-	if (diagnosticInfo != 0xff)
-		printk("%s arlan: Diagnostic Offset %d \n", dev->name, diagnosticOffset);
-
-	printk("arlan: LAN CODE ID = ");
-	for (i = 0; i < 6; i++)
-		DEBUGSHM(1, "%03d:", arlan->lanCardNodeId[i], u_char);
-	printk("\n");
-
-	printk("arlan: Arlan BroadCast address  = ");
-	for (i = 0; i < 6; i++)
-		DEBUGSHM(1, "%03d:", arlan->broadcastAddress[i], u_char);
-	printk("\n");
-
-	READSHM(hardwareType, arlan->hardwareType, u_char);
-	printk(KERN_INFO "%s\n", arlan_hardware_type_string(dev));
-
-
-	DEBUGSHM(1, "arlan: channelNumber=%d\n", arlan->channelNumber, u_char);
-	DEBUGSHM(1, "arlan: channelSet=%d\n", arlan->channelSet, u_char);
-	DEBUGSHM(1, "arlan: spreadingCode=%d\n", arlan->spreadingCode, u_char);
-	DEBUGSHM(1, "arlan: radioNodeId=%d\n", arlan->radioNodeId, u_short);
-	DEBUGSHM(1, "arlan: SID	=%d\n", arlan->SID, u_short);
-	DEBUGSHM(1, "arlan: rxOffset=%d\n", arlan->rxOffset, u_short);
-
-	DEBUGSHM(1, "arlan: registration mode is %d\n", arlan->registrationMode, u_char);
-
-	printk("arlan: name= ");
-	IFDEBUG(1)
-	
-	for (i = 0; i < 16; i++)
-	{
-		char c;
-		READSHM(c, arlan->name[i], char);
-		if (c)
-			printk("%c", c);
-	}
-	printk("\n");
-
-//   ARLAN_DEBUG_EXIT("arlan_print_diagnostic_info");
-
-}
-
-
-/******************************		TEST 	MEMORY	**************/
-
-static int arlan_hw_test_memory(struct net_device *dev)
-{
-	u_char *ptr;
-	int i;
-	int memlen = sizeof(struct arlan_shmem) - 0xF;	/* avoid control register */
-	volatile char *arlan_mem = (char *) (dev->mem_start);
-	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
-	char pattern;
-
-	ptr = NULL;
-
-	/* hold card in reset state */
-	setHardwareReset(dev);
-
-	/* test memory */
-	pattern = 0;
-	for (i = 0; i < memlen; i++)
-		WRITESHM(arlan_mem[i], ((u_char) pattern++), u_char);
-
-	pattern = 0;
-	for (i = 0; i < memlen; i++)
-	{
-		char res;
-		READSHM(res, arlan_mem[i], char);
-		if (res != pattern++)
-		{
-			printk(KERN_ERR "Arlan driver memory test 1 failed \n");
-			return -1;
-		}
-	}
-
-	pattern = 0;
-	for (i = 0; i < memlen; i++)
-		WRITESHM(arlan_mem[i], ~(pattern++), char);
-
-	pattern = 0;
-	for (i = 0; i < memlen; i++)
-	{
-		char res;
-		READSHM(res, arlan_mem[i], char);
-		if (res != ~(pattern++))
-		{
-			printk(KERN_ERR "Arlan driver memory test 2 failed \n");
-			return -1;
-		}
-	}
-
-	/* zero memory */
-	for (i = 0; i < memlen; i++)
-		WRITESHM(arlan_mem[i], 0x00, char);
-
-	IFDEBUG(1) printk(KERN_INFO "Arlan: memory tests ok\n");
-
-	/* set reset flag and then release reset */
-	WRITESHM(arlan->resetFlag, 0xff, u_char);
-
-	clearChannelAttention(dev);
-	clearHardwareReset(dev);
-
-	/* wait for reset flag to become zero, we'll wait for two seconds */
-	if (arlan_command(dev, ARLAN_COMMAND_LONG_WAIT_NOW))
-	{
-		printk(KERN_ERR "%s arlan: failed to come back from memory test\n", dev->name);
-		return -1;
-	}
-	return 0;
-}
-
-static int arlan_setup_card_by_book(struct net_device *dev)
-{
-	u_char irqLevel, configuredStatusFlag;
-	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
-
-//	ARLAN_DEBUG_ENTRY("arlan_setup_card");
-
-	READSHM(configuredStatusFlag, arlan->configuredStatusFlag, u_char);
-
-	IFDEBUG(10)
-	if (configuredStatusFlag != 0)
-		IFDEBUG(10) printk("arlan: CARD IS CONFIGURED\n");
-	else
-		IFDEBUG(10) printk("arlan: card is NOT configured\n");
-
-	if (testMemory || (READSHMB(arlan->diagnosticInfo) != 0xff))
-		if (arlan_hw_test_memory(dev))
-			return -1;
-
-	DEBUGSHM(4, "arlan configuredStatus = %d \n", arlan->configuredStatusFlag, u_char);
-	DEBUGSHM(4, "arlan driver diagnostic: 0x%2x\n", arlan->diagnosticInfo, u_char);
-
-	/* issue nop command - no interrupt */
-	arlan_command(dev, ARLAN_COMMAND_NOOP);
-	if (arlan_command(dev, ARLAN_COMMAND_WAIT_NOW) != 0)
-		return -1;
-
-	IFDEBUG(50) printk("1st Noop successfully executed !!\n");
-
-	/* try to turn on the arlan interrupts */
-	clearClearInterrupt(dev);
-	setClearInterrupt(dev);
-	setInterruptEnable(dev);
-
-	/* issue nop command - with interrupt */
-
-	arlan_command(dev, ARLAN_COMMAND_NOOPINT);
-	if (arlan_command(dev, ARLAN_COMMAND_WAIT_NOW) != 0)
-		return -1;
-
-
-	IFDEBUG(50) printk("2nd Noop successfully executed !!\n");
-
-	READSHM(irqLevel, arlan->irqLevel, u_char)
-	
-	if (irqLevel != dev->irq)
-	{
-		IFDEBUG(1) printk(KERN_WARNING "arlan dip switches set irq to %d\n", irqLevel);
-		printk(KERN_WARNING "device driver irq set to %d - does not match\n", dev->irq);
-		dev->irq = irqLevel;
-	}
-	else
-		IFDEBUG(2) printk("irq level is OK\n");
-
-
-	IFDEBUG(3) arlan_print_diagnostic_info(dev);
-
-	arlan_command(dev, ARLAN_COMMAND_CONF);
-
-	READSHM(configuredStatusFlag, arlan->configuredStatusFlag, u_char);
-	if (configuredStatusFlag == 0)
-	{
-		printk(KERN_WARNING "arlan configure failed\n");
-		return -1;
-	}
-	arlan_command(dev, ARLAN_COMMAND_LONG_WAIT_NOW);
-	arlan_command(dev, ARLAN_COMMAND_RX);
-	arlan_command(dev, ARLAN_COMMAND_LONG_WAIT_NOW);
-	printk(KERN_NOTICE "%s: arlan driver version %s loaded\n",
-	       dev->name, arlan_version);
-
-//	ARLAN_DEBUG_EXIT("arlan_setup_card");
-
-	return 0;		/* no errors */
-}
-#endif
-
-#ifdef ARLAN_PROC_INTERFACE
-#ifdef ARLAN_PROC_SHM_DUMP
-
-static char arlan_drive_info[ARLAN_STR_SIZE] = "A655\n\0";
-
-static int arlan_sysctl_info(ctl_table * ctl, int write, struct file *filp,
-		      void *buffer, size_t * lenp)
-{
-	int i;
-	int retv, pos, devnum;
-	struct arlan_private *priva = NULL;
-	struct net_device *dev;
-	pos = 0;
-	if (write)
-	{
-		printk("wrirte: ");
-		for (i = 0; i < 100; i++)
-			printk("adi %x \n", arlan_drive_info[i]);
-	}
-	if (ctl->procname == NULL || arlan_drive_info == NULL)
-	{
-		printk(KERN_WARNING " procname is NULL in sysctl_table or arlan_drive_info is NULL \n at arlan module\n ");
-		return -1;
-	}
-	devnum = ctl->procname[5] - '0';
-	if (devnum < 0 || devnum > MAX_ARLANS - 1)
-	{
-		printk(KERN_WARNING "too strange devnum in procfs parse\n ");
-		return -1;
-	}
-	else if (arlan_device[devnum] == NULL)
-	{
-		if (ctl->procname)
-			pos += sprintf(arlan_drive_info + pos, "\t%s\n\n", ctl->procname);
-		pos += sprintf(arlan_drive_info + pos, "No device found here \n");
-		goto final;
-	}
-	else
-		priva = arlan_device[devnum]->priv;
-
-	if (priva == NULL)
-	{
-		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
-		return -1;
-	}
-	dev = arlan_device[devnum];
-
-	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
-
-	pos = sprintf(arlan_drive_info, "Arlan  info \n");
-	/* Header Signature */
-	SARLSTR(textRegion, 48);
-	SARLUC(resetFlag);
-	pos += sprintf(arlan_drive_info + pos, "diagnosticInfo\t=\t%s \n", arlan_diagnostic_info_string(dev));
-	SARLUC(diagnosticInfo);
-	SARLUS(diagnosticOffset);
-	SARLUCN(_1, 12);
-	SARLUCN(lanCardNodeId, 6);
-	SARLUCN(broadcastAddress, 6);
-	pos += sprintf(arlan_drive_info + pos, "hardwareType =\t  %s \n", arlan_hardware_type_string(dev));
-	SARLUC(hardwareType);
-	SARLUC(majorHardwareVersion);
-	SARLUC(minorHardwareVersion);
-	SARLUC(radioModule);
-	SARLUC(defaultChannelSet);
-	SARLUCN(_2, 47);
-
-	/* Control/Status Block - 0x0080 */
-	SARLUC(interruptInProgress);
-	SARLUC(cntrlRegImage);
-
-	SARLUCN(_3, 14);
-	SARLUC(commandByte);
-	SARLUCN(commandParameter, 15);
-
-	/* Receive Status - 0x00a0 */
-	SARLUC(rxStatus);
-	SARLUC(rxFrmType);
-	SARLUS(rxOffset);
-	SARLUS(rxLength);
-	SARLUCN(rxSrc, 6);
-	SARLUC(rxBroadcastFlag);
-	SARLUC(rxQuality);
-	SARLUC(scrambled);
-	SARLUCN(_4, 1);
-
-	/* Transmit Status - 0x00b0 */
-	SARLUC(txStatus);
-	SARLUC(txAckQuality);
-	SARLUC(numRetries);
-	SARLUCN(_5, 14);
-	SARLUCN(registeredRouter, 6);
-	SARLUCN(backboneRouter, 6);
-	SARLUC(registrationStatus);
-	SARLUC(configuredStatusFlag);
-	SARLUCN(_6, 1);
-	SARLUCN(ultimateDestAddress, 6);
-	SARLUCN(immedDestAddress, 6);
-	SARLUCN(immedSrcAddress, 6);
-	SARLUS(rxSequenceNumber);
-	SARLUC(assignedLocaltalkAddress);
-	SARLUCN(_7, 27);
-
-	/* System Parameter Block */
-
-	/* - Driver Parameters (Novell Specific) */
-
-	SARLUS(txTimeout);
-	SARLUS(transportTime);
-	SARLUCN(_8, 4);
-
-	/* - Configuration Parameters */
-	SARLUC(irqLevel);
-	SARLUC(spreadingCode);
-	SARLUC(channelSet);
-	SARLUC(channelNumber);
-	SARLUS(radioNodeId);
-	SARLUCN(_9, 2);
-	SARLUC(scramblingDisable);
-	SARLUC(radioType);
-	SARLUS(routerId);
-	SARLUCN(_10, 9);
-	SARLUC(txAttenuation);
-	SARLUIA(systemId);
-	SARLUS(globalChecksum);
-	SARLUCN(_11, 4);
-	SARLUS(maxDatagramSize);
-	SARLUS(maxFrameSize);
-	SARLUC(maxRetries);
-	SARLUC(receiveMode);
-	SARLUC(priority);
-	SARLUC(rootOrRepeater);
-	SARLUCN(specifiedRouter, 6);
-	SARLUS(fastPollPeriod);
-	SARLUC(pollDecay);
-	SARLUSA(fastPollDelay);
-	SARLUC(arlThreshold);
-	SARLUC(arlDecay);
-	SARLUCN(_12, 1);
-	SARLUS(specRouterTimeout);
-	SARLUCN(_13, 5);
-
-	/* Scrambled Area */
-	SARLUIA(SID);
-	SARLUCN(encryptionKey, 12);
-	SARLUIA(_14);
-	SARLUSA(waitTime);
-	SARLUSA(lParameter);
-	SARLUCN(_15, 3);
-	SARLUS(headerSize);
-	SARLUS(sectionChecksum);
-
-	SARLUC(registrationMode);
-	SARLUC(registrationFill);
-	SARLUS(pollPeriod);
-	SARLUS(refreshPeriod);
-	SARLSTR(name, 16);
-	SARLUCN(NID, 6);
-	SARLUC(localTalkAddress);
-	SARLUC(codeFormat);
-	SARLUC(numChannels);
-	SARLUC(channel1);
-	SARLUC(channel2);
-	SARLUC(channel3);
-	SARLUC(channel4);
-	SARLUCN(SSCode, 59);
-
-/*      SARLUCN( _16, 0x140);
- */
-	/* Statistics Block - 0x0300 */
-	SARLUC(hostcpuLock);
-	SARLUC(lancpuLock);
-	SARLUCN(resetTime, 18);
-	SARLUIA(numDatagramsTransmitted);
-	SARLUIA(numReTransmissions);
-	SARLUIA(numFramesDiscarded);
-	SARLUIA(numDatagramsReceived);
-	SARLUIA(numDuplicateReceivedFrames);
-	SARLUIA(numDatagramsDiscarded);
-	SARLUS(maxNumReTransmitDatagram);
-	SARLUS(maxNumReTransmitFrames);
-	SARLUS(maxNumConsecutiveDuplicateFrames);
-	/* misaligned here so we have to go to characters */
-	SARLUIA(numBytesTransmitted);
-	SARLUIA(numBytesReceived);
-	SARLUIA(numCRCErrors);
-	SARLUIA(numLengthErrors);
-	SARLUIA(numAbortErrors);
-	SARLUIA(numTXUnderruns);
-	SARLUIA(numRXOverruns);
-	SARLUIA(numHoldOffs);
-	SARLUIA(numFramesTransmitted);
-	SARLUIA(numFramesReceived);
-	SARLUIA(numReceiveFramesLost);
-	SARLUIA(numRXBufferOverflows);
-	SARLUIA(numFramesDiscardedAddrMismatch);
-	SARLUIA(numFramesDiscardedSIDMismatch);
-	SARLUIA(numPollsTransmistted);
-	SARLUIA(numPollAcknowledges);
-	SARLUIA(numStatusTimeouts);
-	SARLUIA(numNACKReceived);
-	SARLUS(auxCmd);
-	SARLUCN(dumpPtr, 4);
-	SARLUC(dumpVal);
-	SARLUC(wireTest);
-	
-	/* next 4 seems too long for procfs, over single page ?
-	SARLUCN( _17, 0x86);
-	SARLUCN( txBuffer, 0x800);
-	SARLUCN( rxBuffer,  0x800); 
-	SARLUCN( _18, 0x0bff);
-	 */
-
-	pos += sprintf(arlan_drive_info + pos, "rxRing\t=\t0x");
-	for (i = 0; i < 0x50; i++)
-		pos += sprintf(arlan_drive_info + pos, "%02x", ((char *) priva->conf)[priva->conf->rxOffset + i]);
-	pos += sprintf(arlan_drive_info + pos, "\n");
-
-	SARLUC(configStatus);
-	SARLUC(_22);
-	SARLUC(progIOCtrl);
-	SARLUC(shareMBase);
-	SARLUC(controlRegister);
-
-	pos += sprintf(arlan_drive_info + pos, " total %d chars\n", pos);
-	if (ctl)
-		if (ctl->procname)
-			pos += sprintf(arlan_drive_info + pos, " driver name : %s\n", ctl->procname);
-final:
-	*lenp = pos;
-
-	if (!write)
-		retv = proc_dostring(ctl, write, filp, buffer, lenp);
-	else
-	{
-		*lenp = 0;
-		return -1;
-	}
-	return retv;
-}
-
-
-static int arlan_sysctl_info161719(ctl_table * ctl, int write, struct file *filp,
-			    void *buffer, size_t * lenp)
-{
-	int i;
-	int retv, pos, devnum;
-	struct arlan_private *priva = NULL;
-
-	pos = 0;
-	devnum = ctl->procname[5] - '0';
-	if (arlan_device[devnum] == NULL)
-	{
-		pos += sprintf(arlan_drive_info + pos, "No device found here \n");
-		goto final;
-	}
-	else
-		priva = arlan_device[devnum]->priv;
-	if (priva == NULL)
-	{
-		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
-		return -1;
-	}
-	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
-	SARLUCN(_16, 0xC0);
-	SARLUCN(_17, 0x6A);
-	SARLUCN(_18, 14);
-	SARLUCN(_19, 0x86);
-	SARLUCN(_21, 0x3fd);
-
-final:
-	*lenp = pos;
-	retv = proc_dostring(ctl, write, filp, buffer, lenp);
-	return retv;
-}
-
-static int arlan_sysctl_infotxRing(ctl_table * ctl, int write, struct file *filp,
-			    void *buffer, size_t * lenp)
-{
-	int i;
-	int retv, pos, devnum;
-	struct arlan_private *priva = NULL;
-
-	pos = 0;
-	devnum = ctl->procname[5] - '0';
-	if (arlan_device[devnum] == NULL)
-	{
-		  pos += sprintf(arlan_drive_info + pos, "No device found here \n");
-		  goto final;
-	}
-	else
-		priva = arlan_device[devnum]->priv;
-	if (priva == NULL)
-	{
-		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
-		return -1;
-	}
-	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
-	SARLBNpln(u_char, txBuffer, 0x800);
-final:
-	*lenp = pos;
-	retv = proc_dostring(ctl, write, filp, buffer, lenp);
-	return retv;
-}
-
-static int arlan_sysctl_inforxRing(ctl_table * ctl, int write, struct file *filp,
-			    void *buffer, size_t * lenp)
-{
-	int i;
-	int retv, pos, devnum;
-	struct arlan_private *priva = NULL;
-
-	pos = 0;
-	devnum = ctl->procname[5] - '0';
-	if (arlan_device[devnum] == NULL)
-	{
-		  pos += sprintf(arlan_drive_info + pos, "No device found here \n");
-		  goto final;
-	} else
-		priva = arlan_device[devnum]->priv;
-	if (priva == NULL)
-	{
-		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
-		return -1;
-	}
-	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
-	SARLBNpln(u_char, rxBuffer, 0x800);
-final:
-	*lenp = pos;
-	retv = proc_dostring(ctl, write, filp, buffer, lenp);
-	return retv;
-}
-
-static int arlan_sysctl_info18(ctl_table * ctl, int write, struct file *filp,
-			void *buffer, size_t * lenp)
-{
-	int i;
-	int retv, pos, devnum;
-	struct arlan_private *priva = NULL;
-
-	pos = 0;
-	devnum = ctl->procname[5] - '0';
-	if (arlan_device[devnum] == NULL)
-	{
-		pos += sprintf(arlan_drive_info + pos, "No device found here \n");
-		goto final;
-	}
-	else
-		priva = arlan_device[devnum]->priv;
-	if (priva == NULL)
-	{
-		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
-		return -1;
-	}
-	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
-	SARLBNpln(u_char, _18, 0x800);
-
-final:
-	*lenp = pos;
-	retv = proc_dostring(ctl, write, filp, buffer, lenp);
-	return retv;
-}
-
-
-#endif				/* #ifdef ARLAN_PROC_SHM_DUMP */
-
-
-static char conf_reset_result[200];
-
-static int arlan_configure(ctl_table * ctl, int write, struct file *filp,
-		    void *buffer, size_t * lenp)
-{
-	int pos = 0;
-	int devnum = ctl->procname[6] - '0';
-	struct arlan_private *priv;
-
-	if (devnum < 0 || devnum > MAX_ARLANS - 1)
-	{
-		  printk(KERN_WARNING "too strange devnum in procfs parse\n ");
-		  return -1;
-	}
-	else if (arlan_device[devnum] != NULL)
-	{
-		  priv = arlan_device[devnum]->priv;
-
-		  arlan_command(arlan_device[devnum], ARLAN_COMMAND_CLEAN_AND_CONF);
-	}
-	else
-		return -1;
-
-	*lenp = pos;
-	return proc_dostring(ctl, write, filp, buffer, lenp);
-}
-
-static int arlan_sysctl_reset(ctl_table * ctl, int write, struct file *filp,
-		       void *buffer, size_t * lenp)
-{
-	int pos = 0;
-	int devnum = ctl->procname[5] - '0';
-	struct arlan_private *priv;
-
-	if (devnum < 0 || devnum > MAX_ARLANS - 1)
-	{
-		  printk(KERN_WARNING "too strange devnum in procfs parse\n ");
-		  return -1;
-	}
-	else if (arlan_device[devnum] != NULL)
-	{
-		priv = arlan_device[devnum]->priv;
-		arlan_command(arlan_device[devnum], ARLAN_COMMAND_CLEAN_AND_RESET);
-
-	} else
-		return -1;
-	*lenp = pos + 3;
-	return proc_dostring(ctl, write, filp, buffer, lenp);
-}
-
-
-/* Place files in /proc/sys/dev/arlan */
-#define CTBLN(num,card,nam) \
-        { .ctl_name = num,\
-          .procname = #nam,\
-          .data = &(arlan_conf[card].nam),\
-          .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec}
-#ifdef ARLAN_DEBUGGING
-
-#define ARLAN_PROC_DEBUG_ENTRIES \
-        { .ctl_name = 48, .procname = "entry_exit_debug",\
-          .data = &arlan_entry_and_exit_debug,\
-          .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec},\
-	{ .ctl_name = 49, .procname = "debug", .data = &arlan_debug,\
-          .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec},
-#else 
-#define ARLAN_PROC_DEBUG_ENTRIES
-#endif
-
-#define ARLAN_SYSCTL_TABLE_TOTAL(cardNo)\
-	CTBLN(1,cardNo,spreadingCode),\
-	CTBLN(2,cardNo, channelNumber),\
-	CTBLN(3,cardNo, scramblingDisable),\
-	CTBLN(4,cardNo, txAttenuation),\
-	CTBLN(5,cardNo, systemId), \
-	CTBLN(6,cardNo, maxDatagramSize),\
-	CTBLN(7,cardNo, maxFrameSize),\
-	CTBLN(8,cardNo, maxRetries),\
-	CTBLN(9,cardNo, receiveMode),\
-	CTBLN(10,cardNo, priority),\
-	CTBLN(11,cardNo, rootOrRepeater),\
-	CTBLN(12,cardNo, SID),\
-	CTBLN(13,cardNo, registrationMode),\
-	CTBLN(14,cardNo, registrationFill),\
-	CTBLN(15,cardNo, localTalkAddress),\
-	CTBLN(16,cardNo, codeFormat),\
-	CTBLN(17,cardNo, numChannels),\
-	CTBLN(18,cardNo, channel1),\
-	CTBLN(19,cardNo, channel2),\
-	CTBLN(20,cardNo, channel3),\
-	CTBLN(21,cardNo, channel4),\
-	CTBLN(22,cardNo, txClear),\
-	CTBLN(23,cardNo, txRetries),\
-	CTBLN(24,cardNo, txRouting),\
-	CTBLN(25,cardNo, txScrambled),\
-	CTBLN(26,cardNo, rxParameter),\
-	CTBLN(27,cardNo, txTimeoutMs),\
-	CTBLN(28,cardNo, waitCardTimeout),\
-	CTBLN(29,cardNo, channelSet), \
-	{.ctl_name = 30, .procname = "name",\
-	 .data = arlan_conf[cardNo].siteName,\
-	 .maxlen = 16, .mode = 0600, .proc_handler = &proc_dostring},\
-	CTBLN(31,cardNo,waitTime),\
-	CTBLN(32,cardNo,lParameter),\
-	CTBLN(33,cardNo,_15),\
-	CTBLN(34,cardNo,headerSize),\
-	CTBLN(35,cardNo,async),\
-	CTBLN(36,cardNo,tx_delay_ms),\
-	CTBLN(37,cardNo,retries),\
-	CTBLN(38,cardNo,ReTransmitPacketMaxSize),\
-	CTBLN(39,cardNo,waitReTransmitPacketMaxSize),\
-	CTBLN(40,cardNo,fastReTransCount),\
-	CTBLN(41,cardNo,driverRetransmissions),\
-	CTBLN(42,cardNo,txAckTimeoutMs),\
-	CTBLN(43,cardNo,registrationInterrupts),\
-	CTBLN(44,cardNo,hardwareType),\
-	CTBLN(45,cardNo,radioType),\
-	CTBLN(46,cardNo,writeEEPROM),\
-	CTBLN(47,cardNo,writeRadioType),\
-	ARLAN_PROC_DEBUG_ENTRIES\
-	CTBLN(50,cardNo,in_speed),\
-	CTBLN(51,cardNo,out_speed),\
-	CTBLN(52,cardNo,in_speed10),\
-	CTBLN(53,cardNo,out_speed10),\
-	CTBLN(54,cardNo,in_speed_max),\
-	CTBLN(55,cardNo,out_speed_max),\
-	CTBLN(56,cardNo,measure_rate),\
-	CTBLN(57,cardNo,pre_Command_Wait),\
-	CTBLN(58,cardNo,rx_tweak1),\
-	CTBLN(59,cardNo,rx_tweak2),\
-	CTBLN(60,cardNo,tx_queue_len),\
-
-
-
-static ctl_table arlan_conf_table0[] =
-{
-	ARLAN_SYSCTL_TABLE_TOTAL(0)
-
-#ifdef ARLAN_PROC_SHM_DUMP
-	{
-		.ctl_name	= 150,
-		.procname	= "arlan0-txRing",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_infotxRing,
-	},
-	{
-		.ctl_name	= 151,
-		.procname	= "arlan0-rxRing",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_inforxRing,
-	},
-	{
-		.ctl_name	= 152,
-		.procname	= "arlan0-18",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_info18,
-	},
-	{
-		.ctl_name	= 153,
-		.procname	= "arlan0-ring",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_info161719,
-	},
-	{
-		.ctl_name	= 154,
-		.procname	= "arlan0-shm-cpy",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_info,
-	},
-#endif
-	{
-		.ctl_name	= 155,
-		.procname	= "config0",
-		.data		= &conf_reset_result,
-		.maxlen		= 100,
-		.mode		= 0400,
-		.proc_handler	= &arlan_configure
-	},
-	{
-		.ctl_name	= 156,
-		.procname	= "reset0",
-		.data		= &conf_reset_result,
-		.maxlen		= 100,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_reset,
-	},
-	{ .ctl_name = 0 }
-};
-
-static ctl_table arlan_conf_table1[] =
-{
-
-	ARLAN_SYSCTL_TABLE_TOTAL(1)
-
-#ifdef ARLAN_PROC_SHM_DUMP
-	{
-		.ctl_name	= 150,
-		.procname	= "arlan1-txRing",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_infotxRing,
-	},
-	{
-		.ctl_name	= 151,
-		.procname	= "arlan1-rxRing",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_inforxRing,
-	},
-	{
-		.ctl_name	= 152,
-		.procname	= "arlan1-18",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_info18,
-	},
-	{
-		.ctl_name	= 153,
-		.procname	= "arlan1-ring",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_info161719,
-	},
-	{
-		.ctl_name	= 154,
-		.procname	= "arlan1-shm-cpy",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_info,
-	},
-#endif
-	{
-		.ctl_name	= 155,
-		.procname	= "config1",
-		.data		= &conf_reset_result,
-		.maxlen		= 100,
-		.mode		= 0400,
-		.proc_handler	= &arlan_configure,
-	},
-	{
-		.ctl_name	= 156,
-		.procname	= "reset1",
-		.data		= &conf_reset_result,
-		.maxlen		= 100,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_reset,
-	},
-	{ .ctl_name = 0 }
-};
-
-static ctl_table arlan_conf_table2[] =
-{
-
-	ARLAN_SYSCTL_TABLE_TOTAL(2)
-
-#ifdef ARLAN_PROC_SHM_DUMP
-	{
-		.ctl_name	= 150,
-		.procname	= "arlan2-txRing",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_infotxRing,
-	},
-	{
-		.ctl_name	= 151,
-		.procname	= "arlan2-rxRing",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_inforxRing,
-	},
-	{
-		.ctl_name	= 152,
-		.procname	= "arlan2-18",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_info18,
-	},
-	{
-		.ctl_name	= 153,
-		.procname	= "arlan2-ring",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_info161719,
-	},
-	{
-		.ctl_name	= 154,
-		.procname	= "arlan2-shm-cpy",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_info,
-	},
-#endif
-	{
-		.ctl_name	= 155,
-		.procname	= "config2",
-		.data		= &conf_reset_result,
-		.maxlen		= 100,
-		.mode		= 0400,
-		.proc_handler	= &arlan_configure,
-	},
-	{
-		.ctl_name	= 156,
-		.procname	= "reset2",
-		.data		= &conf_reset_result,
-		.maxlen		= 100,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_reset,
-	},
-	{ .ctl_name = 0 }
-};
-
-static ctl_table arlan_conf_table3[] =
-{
-
-	ARLAN_SYSCTL_TABLE_TOTAL(3)
-
-#ifdef ARLAN_PROC_SHM_DUMP
-	{
-		.ctl_name	= 150,
-		.procname	= "arlan3-txRing",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_infotxRing,
-	},
-	{
-		.ctl_name	= 151,
-		.procname	= "arlan3-rxRing",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_inforxRing,
-	},
-	{
-		.ctl_name	= 152,
-		.procname	= "arlan3-18",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_info18,
-	},
-	{
-		.ctl_name	= 153,
-		.procname	= "arlan3-ring",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_info161719,
-	},
-	{
-		.ctl_name	= 154,
-		.procname	= "arlan3-shm-cpy",
-		.data		= &arlan_drive_info,
-		.maxlen		= ARLAN_STR_SIZE,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_info,
-	},
-#endif
-	{
-		.ctl_name	= 155,
-		.procname	= "config3",
-		.data		= &conf_reset_result,
-		.maxlen		= 100,
-		.mode		= 0400,
-		.proc_handler	= &arlan_configure,
-	},
-	{
-		.ctl_name	= 156,
-		.procname	= "reset3",
-		.data		= &conf_reset_result,
-		.maxlen		= 100,
-		.mode		= 0400,
-		.proc_handler	= &arlan_sysctl_reset,
-	},
-	{ .ctl_name = 0 }
-};
-
-
-
-static ctl_table arlan_table[] =
-{
-	{
-		.ctl_name	= 0,
-		.procname	= "arlan0",
-		.maxlen		= 0,
-		.mode		= 0600,
-		.child		= arlan_conf_table0,
-	},
-	{
-		.ctl_name	= 0,
-		.procname	= "arlan1",
-		.maxlen		= 0,
-		.mode		= 0600,
-		.child		= arlan_conf_table1,
-	},
-	{
-		.ctl_name	= 0,
-		.procname	= "arlan2",
-		.maxlen		= 0,
-		.mode		= 0600,
-		.child		= arlan_conf_table2,
-	},
-	{
-		.ctl_name	= 0,
-		.procname	= "arlan3",
-		.maxlen		= 0,
-		.mode		= 0600,
-		.child		= arlan_conf_table3,
-	},
-	{ .ctl_name = 0 }
-};
-
-#else
-
-static ctl_table arlan_table[MAX_ARLANS + 1] =
-{
-	{ .ctl_name = 0 }
-};
-#endif
-#else
-
-static ctl_table arlan_table[MAX_ARLANS + 1] =
-{
-	{ .ctl_name = 0 }
-};
-#endif
-
-
-// static int mmtu = 1234;
-
-static ctl_table arlan_root_table[] =
-{
-	{
-		.ctl_name	= 254,
-		.procname	= "arlan",
-		.maxlen		= 0,
-		.mode		= 0555,
-		.child		= arlan_table,
-	},
-	{ .ctl_name = 0 }
-};
-
-/* Make sure that /proc/sys/dev is there */
-//static ctl_table arlan_device_root_table[] =
-//{
-//	{CTL_DEV, "dev", NULL, 0, 0555, arlan_root_table},
-//	{0}
-//};
-
-
-
-static struct ctl_table_header *arlan_device_sysctl_header;
-
-int init_arlan_proc(void)
-{
-
-	int i = 0;
-	if (arlan_device_sysctl_header)
-		return 0;
-	for (i = 0; i < MAX_ARLANS && arlan_device[i]; i++)
-		arlan_table[i].ctl_name = i + 1;
-	arlan_device_sysctl_header = register_sysctl_table(arlan_root_table, 0);
-	if (!arlan_device_sysctl_header)
-		return -1;
-
-	return 0;
-
-};
-
-
-
-#ifdef MODULE
-
-int init_module(void)
-{
-
-	return init_arlan_proc();
-};
-
-void cleanup_module(void)
-{
-	unregister_sysctl_table(arlan_device_sysctl_header);
-	arlan_device_sysctl_header = NULL;
-
-	return;
-};
-
-#endif				// MODULE
-MODULE_LICENSE("GPL");
diff -Nru a/drivers/net/arlan.c b/drivers/net/arlan.c
--- a/drivers/net/arlan.c	Sun Feb 23 22:25:25 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,2077 +0,0 @@
-/*
- *  Copyright (C) 1997 Cullen Jennings
- *  Copyright (C) 1998 Elmer Joandiu, elmer@ylenurme.ee
- *  GNU General Public License applies
- * This module provides support for the Arlan 655 card made by Aironet
- */
-
-#include <linux/config.h>
-#include "arlan.h"
-
-#if BITS_PER_LONG != 32
-#  error FIXME: this driver requires a 32-bit platform
-#endif
-
-static const char *arlan_version = "C.Jennigs 97 & Elmer.Joandi@ut.ee  Oct'98, http://www.ylenurme.ee/~elmer/655/";
-
-struct net_device *arlan_device[MAX_ARLANS];
-int last_arlan;
-
-static int SID = SIDUNKNOWN;
-static int radioNodeId = radioNodeIdUNKNOWN;
-static char encryptionKey[12] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
-static char *siteName = siteNameUNKNOWN;
-static int mem = memUNKNOWN;
-int arlan_debug = debugUNKNOWN;
-static int probe = probeUNKNOWN;
-static int numDevices = numDevicesUNKNOWN;
-static int spreadingCode = spreadingCodeUNKNOWN;
-static int channelNumber = channelNumberUNKNOWN;
-static int channelSet = channelSetUNKNOWN;
-static int systemId = systemIdUNKNOWN;
-static int registrationMode = registrationModeUNKNOWN;
-static int keyStart;
-static int tx_delay_ms;
-static int retries = 5;
-static int async = 1;
-static int tx_queue_len = 1;
-static int arlan_EEPROM_bad;
-
-#ifdef ARLAN_DEBUGGING
-
-static int arlan_entry_debug;
-static int arlan_exit_debug;
-static int testMemory = testMemoryUNKNOWN;
-static int irq = irqUNKNOWN;
-static int txScrambled = 1;
-static int mdebug;
-#endif
-
-#if LINUX_VERSION_CODE > 0x20100
-MODULE_PARM(irq, "i");
-MODULE_PARM(mem, "i");
-MODULE_PARM(probe, "i");
-MODULE_PARM(arlan_debug, "i");
-MODULE_PARM(numDevices, "i");
-MODULE_PARM(testMemory, "i");
-MODULE_PARM(spreadingCode, "i");
-MODULE_PARM(channelNumber, "i");
-MODULE_PARM(channelSet, "i");
-MODULE_PARM(systemId, "i");
-MODULE_PARM(registrationMode, "i");
-MODULE_PARM(radioNodeId, "i");
-MODULE_PARM(SID, "i");
-MODULE_PARM(txScrambled, "i");
-MODULE_PARM(keyStart, "i");
-MODULE_PARM(mdebug, "i");
-MODULE_PARM(tx_delay_ms, "i");
-MODULE_PARM(retries, "i");
-MODULE_PARM(async, "i");
-MODULE_PARM(tx_queue_len, "i");
-MODULE_PARM(arlan_entry_debug, "i");
-MODULE_PARM(arlan_exit_debug, "i");
-MODULE_PARM(arlan_entry_and_exit_debug, "i");
-MODULE_PARM(arlan_EEPROM_bad, "i");
-MODULE_PARM_DESC(irq, "(unused)");
-MODULE_PARM_DESC(mem, "Arlan memory address for single device probing");
-MODULE_PARM_DESC(probe, "Arlan probe at initialization (0-1)");
-MODULE_PARM_DESC(arlan_debug, "Arlan debug enable (0-1)");
-MODULE_PARM_DESC(numDevices, "Number of Arlan devices; ignored if >1");
-MODULE_PARM_DESC(testMemory, "(unused)");
-MODULE_PARM_DESC(mdebug, "Arlan multicast debugging (0-1)");
-MODULE_PARM_DESC(retries, "Arlan maximum packet retransmisions");
-#ifdef ARLAN_ENTRY_EXIT_DEBUGGING
-MODULE_PARM_DESC(arlan_entry_debug, "Arlan driver function entry debugging");
-MODULE_PARM_DESC(arlan_exit_debug, "Arlan driver function exit debugging");
-MODULE_PARM_DESC(arlan_entry_and_exit_debug, "Arlan driver function entry and exit debugging");
-#else
-MODULE_PARM_DESC(arlan_entry_debug, "(ignored)");
-MODULE_PARM_DESC(arlan_exit_debug, "(ignored)");
-MODULE_PARM_DESC(arlan_entry_and_exit_debug, "(ignored)");
-#endif
-
-EXPORT_SYMBOL(arlan_device);
-EXPORT_SYMBOL(arlan_conf);
-EXPORT_SYMBOL(last_arlan);
-
-
-//        #warning kernel 2.1.110 tested
-#define myATOMIC_INIT(a,b) atomic_set(&(a),b)
-
-#else
-#define test_and_set_bit	set_bit
-#if LINUX_VERSION_CODE != 0x20024
- //        #warning kernel  2.0.36  tested
-#endif
-#define myATOMIC_INIT(a,b) a = b;
-
-#endif
-
-struct arlan_conf_stru arlan_conf[MAX_ARLANS];
-static int arlans_found;
-
-static  int 	arlan_probe_here(struct net_device *dev, int ioaddr);
-static  int 	arlan_open(struct net_device *dev);
-static  int 	arlan_tx(struct sk_buff *skb, struct net_device *dev);
-static  void 	arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-static  int 	arlan_close(struct net_device *dev);
-static  struct net_device_stats *
-		arlan_statistics		(struct net_device *dev);
-static  void 	arlan_set_multicast		(struct net_device *dev);
-static  int 	arlan_hw_tx			(struct net_device* dev, char *buf, int length );
-static  int	arlan_hw_config			(struct net_device * dev);
-static  void 	arlan_tx_done_interrupt		(struct net_device * dev, int status);
-static  void	arlan_rx_interrupt		(struct net_device * dev, u_char rxStatus, u_short, u_short);
-static  void	arlan_process_interrupt		(struct net_device * dev);
-static	void	arlan_tx_timeout		(struct net_device *dev);
-int	arlan_command(struct net_device * dev, int command);
-
-EXPORT_SYMBOL(arlan_command);
-
-static inline long long arlan_time(void)
-{
-	struct timeval timev;
-	do_gettimeofday(&timev);
-	return ((long long) timev.tv_sec * 1000000 + timev.tv_usec);
-};
-
-#ifdef ARLAN_ENTRY_EXIT_DEBUGGING
-#define ARLAN_DEBUG_ENTRY(name) \
-	{\
-	struct timeval timev;\
-	do_gettimeofday(&timev);\
-		if (arlan_entry_debug || arlan_entry_and_exit_debug)\
-			printk("--->>>" name " %ld " "\n",((long int) timev.tv_sec * 1000000 + timev.tv_usec));\
-	}
-#define ARLAN_DEBUG_EXIT(name) \
-	{\
-	struct timeval timev;\
-	do_gettimeofday(&timev);\
-		if (arlan_exit_debug || arlan_entry_and_exit_debug)\
-			printk("<<<---" name " %ld " "\n",((long int) timev.tv_sec * 1000000 + timev.tv_usec) );\
-	}
-#else
-#define ARLAN_DEBUG_ENTRY(name)
-#define ARLAN_DEBUG_EXIT(name)
-#endif
-
-
-#define arlan_interrupt_ack(dev)\
-        clearClearInterrupt(dev);\
-        setClearInterrupt(dev);
-
-
-#define ARLAN_COMMAND_LOCK(dev) \
-	if (atomic_dec_and_test(&((struct arlan_private * )dev->priv)->card_users))\
-   		arlan_wait_command_complete_short(dev,__LINE__);
-#define ARLAN_COMMAND_UNLOCK(dev) \
-	atomic_inc(&((struct arlan_private * )dev->priv)->card_users);
-
-
-#define ARLAN_COMMAND_INC(dev) \
- 	{((struct arlan_private *) dev->priv)->under_command++;}
-#define ARLAN_COMMAND_ZERO(dev) \
- 	{((struct arlan_private *) dev->priv)->under_command =0;}
-#define ARLAN_UNDER_COMMAND(dev)\
-	(((struct arlan_private *) dev->priv)->under_command)
-
-#define ARLAN_COMMAND_START(dev) ARLAN_COMMAND_INC(dev)
-#define ARLAN_COMMAND_END(dev) ARLAN_COMMAND_ZERO(dev)
-#define ARLAN_TOGGLE_START(dev)\
- 	{((struct arlan_private *) dev->priv)->under_toggle++;}
-#define ARLAN_TOGGLE_END(dev)\
- 	{((struct arlan_private *) dev->priv)->under_toggle=0;}
-#define ARLAN_UNDER_TOGGLE(dev)\
- 	(((struct arlan_private *) dev->priv)->under_toggle)
-
-
-
-static inline int arlan_drop_tx(struct net_device *dev)
-{
-	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
-
-	priv->stats.tx_errors++;
-	if (priv->Conf->tx_delay_ms)
-	{
-		priv->tx_done_delayed = jiffies + priv->Conf->tx_delay_ms * HZ / 1000 + 1;
-	}
-	else
-	{
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_TX;
-		TXHEAD(dev).offset = 0;
-		TXTAIL(dev).offset = 0;
-		priv->txLast = 0;
-		priv->txOffset = 0;
-		priv->bad = 0;
-		if (!priv->under_reset && !priv->under_config)
-			netif_wake_queue (dev);
-	}
-	return 1;
-};
-
-
-int arlan_command(struct net_device *dev, int command_p)
-{
-
-	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
-	struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf;
-	struct arlan_private *priv = (struct arlan_private *) dev->priv;
-	int udelayed = 0;
-	int i = 0;
-	long long time_mks = arlan_time();
-
-	ARLAN_DEBUG_ENTRY("arlan_command");
-
-	if (priv->card_polling_interval)
-		priv->card_polling_interval = 1;
-
-	if (arlan_debug & ARLAN_DEBUG_CHAIN_LOCKS)
-		printk(KERN_DEBUG "arlan_command, %lx lock %lx  commandByte %x waiting %x incoming %x \n",
-		jiffies, priv->command_lock, READSHMB(arlan->commandByte),
-		       priv->waiting_command_mask, command_p);
-
-	priv->waiting_command_mask |= command_p;
-
-	if (priv->waiting_command_mask & ARLAN_COMMAND_RESET)
-		if (jiffies - priv->lastReset < 5 * HZ)
-			priv->waiting_command_mask &= ~ARLAN_COMMAND_RESET;
-
-	if (priv->waiting_command_mask & ARLAN_COMMAND_INT_ACK)
-	{
-		arlan_interrupt_ack(dev);
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_INT_ACK;
-	}
-	if (priv->waiting_command_mask & ARLAN_COMMAND_INT_ENABLE)
-	{
-		setInterruptEnable(dev);
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_INT_ENABLE;
-	}
-
-	/* Card access serializing lock */
-
-	if (test_and_set_bit(0, (void *) &priv->command_lock))
-	{
-		if (arlan_debug & ARLAN_DEBUG_CHAIN_LOCKS)
-			printk(KERN_DEBUG "arlan_command: entered when command locked \n");
-		goto command_busy_end;
-	}
-	/* Check cards status and waiting */
-
-	if (priv->waiting_command_mask & (ARLAN_COMMAND_LONG_WAIT_NOW | ARLAN_COMMAND_WAIT_NOW))
-	{
-		while (priv->waiting_command_mask & (ARLAN_COMMAND_LONG_WAIT_NOW | ARLAN_COMMAND_WAIT_NOW))
-		{
-			if (READSHMB(arlan->resetFlag) ||
-				READSHMB(arlan->commandByte))	/* || 
-								   (readControlRegister(dev) & ARLAN_ACCESS))
-								 */
-				udelay(40);
-			else
-				priv->waiting_command_mask &= ~(ARLAN_COMMAND_LONG_WAIT_NOW | ARLAN_COMMAND_WAIT_NOW);
-
-			udelayed++;
-
-			if (priv->waiting_command_mask & ARLAN_COMMAND_LONG_WAIT_NOW)
-			{
-				if (udelayed * 40 > 1000000)
-				{
-					printk(KERN_ERR "%s long wait too long \n", dev->name);
-					priv->waiting_command_mask |= ARLAN_COMMAND_RESET;
-					break;
-				}
-			}
-			else if (priv->waiting_command_mask & ARLAN_COMMAND_WAIT_NOW)
-			{
-				if (udelayed * 40 > 1000)
-				{
-					printk(KERN_ERR "%s short wait too long \n", dev->name);
-					goto bad_end;
-				}
-			}
-		}
-	}
-	else
-	{
-		i = 0;
-		while ((READSHMB(arlan->resetFlag) ||
-			READSHMB(arlan->commandByte)) &&
-			conf->pre_Command_Wait > (i++) * 10)
-			udelay(10);
-
-
-		if ((READSHMB(arlan->resetFlag) ||
-			READSHMB(arlan->commandByte)) &&
-			!(priv->waiting_command_mask & ARLAN_COMMAND_RESET))
-		{
-			goto card_busy_end;
-		}
-	}
-	if (priv->waiting_command_mask & ARLAN_COMMAND_RESET)
-		priv->under_reset = 1;
-	if (priv->waiting_command_mask & ARLAN_COMMAND_CONF)
-		priv->under_config = 1;
-
-	/* Issuing command */
-	arlan_lock_card_access(dev);
-	if (priv->waiting_command_mask & ARLAN_COMMAND_POWERUP)
-	{
-	//     if (readControlRegister(dev) & (ARLAN_ACCESS && ARLAN_POWER))
-		setPowerOn(dev);
-		arlan_interrupt_lancpu(dev);
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_POWERUP;
-		priv->waiting_command_mask |= ARLAN_COMMAND_RESET;
-		priv->card_polling_interval = HZ / 10;
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_ACTIVATE)
-	{
-		WRITESHMB(arlan->commandByte, ARLAN_COM_ACTIVATE);
-		arlan_interrupt_lancpu(dev);
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_ACTIVATE;
-		priv->card_polling_interval = HZ / 10;
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_RX_ABORT)
-	{
-		if (priv->rx_command_given)
-		{
-			WRITESHMB(arlan->commandByte, ARLAN_COM_RX_ABORT);
-			arlan_interrupt_lancpu(dev);
-			priv->rx_command_given = 0;
-		}
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_RX_ABORT;
-		priv->card_polling_interval = 1;
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_TX_ABORT)
-	{
-		if (priv->tx_command_given)
-		{
-			WRITESHMB(arlan->commandByte, ARLAN_COM_TX_ABORT);
-			arlan_interrupt_lancpu(dev);
-			priv->tx_command_given = 0;
-		}
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_TX_ABORT;
-		priv->card_polling_interval = 1;
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_RESET)
-	{
-		priv->under_reset=1;
-		netif_stop_queue (dev);
-
-		arlan_drop_tx(dev);
-		if (priv->tx_command_given || priv->rx_command_given)
-		{
-			printk(KERN_ERR "%s: Reset under tx or rx command \n", dev->name);
-		};
-		netif_stop_queue (dev);
-		if (arlan_debug & ARLAN_DEBUG_RESET)
-			printk(KERN_ERR "%s: Doing chip reset\n", dev->name);
-		priv->lastReset = jiffies;
-		WRITESHM(arlan->commandByte, 0, u_char);
-		/* hold card in reset state */
-		setHardwareReset(dev);
-		/* set reset flag and then release reset */
-		WRITESHM(arlan->resetFlag, 0xff, u_char);
-		clearChannelAttention(dev);
-		clearHardwareReset(dev);
-		priv->numResets++;
-		priv->card_polling_interval = HZ / 4;
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_RESET;
-		priv->waiting_command_mask |= ARLAN_COMMAND_INT_RACK;
-//		priv->waiting_command_mask |= ARLAN_COMMAND_INT_RENABLE; 
-//		priv->waiting_command_mask |= ARLAN_COMMAND_RX;
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_INT_RACK)
-	{
-		clearHardwareReset(dev);
-		clearClearInterrupt(dev);
-		setClearInterrupt(dev);
-		setInterruptEnable(dev);
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_INT_RACK;
-		priv->waiting_command_mask |= ARLAN_COMMAND_CONF;
-		priv->under_config = 1;
-		priv->under_reset = 0;
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_INT_RENABLE)
-	{
-		setInterruptEnable(dev);
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_INT_RENABLE;
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_CONF)
-	{
-		if (priv->tx_command_given || priv->rx_command_given)
-		{
-			printk(KERN_ERR "%s: Reset under tx or rx command \n", dev->name);
-		}
-		arlan_drop_tx(dev);
-		setInterruptEnable(dev);
-		arlan_hw_config(dev);
-		arlan_interrupt_lancpu(dev);
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_CONF;
-		priv->card_polling_interval = HZ / 10;
-//		priv->waiting_command_mask |= ARLAN_COMMAND_INT_RACK;   
-//		priv->waiting_command_mask |= ARLAN_COMMAND_INT_ENABLE; 
-		priv->waiting_command_mask |= ARLAN_COMMAND_CONF_WAIT;
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_CONF_WAIT)
-	{
-		if (READSHMB(arlan->configuredStatusFlag) != 0 &&
-			READSHMB(arlan->diagnosticInfo) == 0xff)
-		{
-			priv->waiting_command_mask &= ~ARLAN_COMMAND_CONF_WAIT;
-			priv->waiting_command_mask |= ARLAN_COMMAND_RX;
-			priv->waiting_command_mask |= ARLAN_COMMAND_TBUSY_CLEAR;
-			priv->card_polling_interval = HZ / 10;
-			priv->tx_command_given = 0;
-			priv->under_config = 0;
-		}
-		else
-		{
-			priv->card_polling_interval = 1;
-			if (arlan_debug & ARLAN_DEBUG_TIMING)
-				printk(KERN_ERR "configure delayed \n");
-		}
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_RX)
-	{
-		if (!registrationBad(dev))
-		{
-			setInterruptEnable(dev);
-			memset_io((void *) arlan->commandParameter, 0, 0xf);
-			WRITESHMB(arlan->commandByte, ARLAN_COM_INT | ARLAN_COM_RX_ENABLE);
-			WRITESHMB(arlan->commandParameter[0], conf->rxParameter);
-			arlan_interrupt_lancpu(dev);
-			priv->rx_command_given = 0; // mnjah, bad
-			priv->last_rx_time = arlan_time();
-			priv->waiting_command_mask &= ~ARLAN_COMMAND_RX;
-			priv->card_polling_interval = 1;
-		}
-		else
-			priv->card_polling_interval = 2;
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_TBUSY_CLEAR)
-	{
-		if ( !registrationBad(dev) &&
-		     (netif_queue_stopped(dev) || !netif_running(dev)) )
-			{
-				priv->waiting_command_mask &= ~ARLAN_COMMAND_TBUSY_CLEAR;
-				netif_wake_queue (dev);
-			};
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_TX)
-	{
-		if (!test_and_set_bit(0, (void *) &priv->tx_command_given))
-		{
-			if ((time_mks - priv->last_tx_time > conf->rx_tweak1) ||
-				(time_mks - priv->last_rx_int_ack_time < conf->rx_tweak2))
-			{
-				setInterruptEnable(dev);
-				memset_io((void *) arlan->commandParameter, 0, 0xf);
-				WRITESHMB(arlan->commandByte, ARLAN_COM_TX_ENABLE | ARLAN_COM_INT);
-				memcpy_toio((void *) arlan->commandParameter, &TXLAST(dev), 14);
-//				for ( i=1 ; i < 15 ; i++) printk("%02x:",READSHMB(arlan->commandParameter[i]));
-				priv->last_command_was_rx = 0;
-				priv->tx_last_sent = jiffies;
-				arlan_interrupt_lancpu(dev);
-				priv->last_tx_time = arlan_time();
-				priv->tx_command_given = 1;
-				priv->waiting_command_mask &= ~ARLAN_COMMAND_TX;
-				priv->card_polling_interval = 1;
-			}
-			else
-			{
-				priv->tx_command_given = 0;
-				priv->card_polling_interval = 1;
-			}
-		} 
-		else if (arlan_debug & ARLAN_DEBUG_CHAIN_LOCKS)
-			printk(KERN_ERR "tx command when tx chain locked \n");
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_NOOPINT)
-	{
-		{
-			WRITESHMB(arlan->commandByte, ARLAN_COM_NOP | ARLAN_COM_INT);
-		}
-		arlan_interrupt_lancpu(dev);
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_NOOPINT;
-		priv->card_polling_interval = HZ / 3;
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_NOOP)
-	{
-		WRITESHMB(arlan->commandByte, ARLAN_COM_NOP);
-		arlan_interrupt_lancpu(dev);
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_NOOP;
-		priv->card_polling_interval = HZ / 3;
-	}
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_SLOW_POLL)
-	{
-		WRITESHMB(arlan->commandByte, ARLAN_COM_GOTO_SLOW_POLL);
-		arlan_interrupt_lancpu(dev);
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_SLOW_POLL;
-		priv->card_polling_interval = HZ / 3;
-	} 
-	else if (priv->waiting_command_mask & ARLAN_COMMAND_POWERDOWN)
-	{
-		setPowerOff(dev);
-		if (arlan_debug & ARLAN_DEBUG_CARD_STATE)
-			printk(KERN_WARNING "%s: Arlan Going Standby\n", dev->name);
-		priv->waiting_command_mask &= ~ARLAN_COMMAND_POWERDOWN;
-		priv->card_polling_interval = 3 * HZ;
-	}
-	arlan_unlock_card_access(dev);
-	for (i = 0; READSHMB(arlan->commandByte) && i < 20; i++)
-		udelay(10);
-	if (READSHMB(arlan->commandByte))
-		if (arlan_debug & ARLAN_DEBUG_CARD_STATE)
-			printk(KERN_ERR "card busy leaving command %x \n", priv->waiting_command_mask);
-
-	priv->command_lock = 0;
-	ARLAN_DEBUG_EXIT("arlan_command");
-	priv->last_command_buff_free_time = jiffies;
-	return 0;
-
-card_busy_end:
-	if (jiffies - priv->last_command_buff_free_time > HZ)
-		priv->waiting_command_mask |= ARLAN_COMMAND_CLEAN_AND_RESET;
-
-	if (arlan_debug & ARLAN_DEBUG_CARD_STATE)
-		printk(KERN_ERR "%s arlan_command card busy end \n", dev->name);
-	priv->command_lock = 0;
-	ARLAN_DEBUG_EXIT("arlan_command");
-	return 1;
-
-bad_end:
-	printk(KERN_ERR "%s arlan_command bad end \n", dev->name);
-
-	priv->command_lock = 0;
-	ARLAN_DEBUG_EXIT("arlan_command");
-
-	return -1;
-
-command_busy_end:
-	if (arlan_debug & ARLAN_DEBUG_CARD_STATE)
-		printk(KERN_ERR "%s arlan_command command busy end \n", dev->name);
-	ARLAN_DEBUG_EXIT("arlan_command");
-	return 2;
-
-};
-
-static inline void arlan_command_process(struct net_device *dev)
-{
-	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
-
-	int times = 0;
-	while (priv->waiting_command_mask && times < 8)
-	{
-		if (priv->waiting_command_mask)
-		{
-			if (arlan_command(dev, 0))
-				break;
-			times++;
-		}
-		/* if long command, we wont repeat trying */ ;
-		if (priv->card_polling_interval > 1)
-			break;
-		times++;
-	}
-}
-
-
-static inline void arlan_retransmit_now(struct net_device *dev)
-{
-	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
-
-
-	ARLAN_DEBUG_ENTRY("arlan_retransmit_now");
-	if (TXLAST(dev).offset == 0)
-	{
-		if (TXHEAD(dev).offset)
-		{
-			priv->txLast = 0;
-			IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk(KERN_DEBUG "TX buff switch to head \n");
-
-		}
-		else if (TXTAIL(dev).offset)
-		{
-			IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk(KERN_DEBUG "TX buff switch to tail \n");
-			priv->txLast = 1;
-		}
-		else
-			IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk(KERN_ERR "ReTransmit buff empty");
-		priv->txOffset = 0;
-		netif_wake_queue (dev);
-		return;
-
-	}
-	arlan_command(dev, ARLAN_COMMAND_TX);
-
-	priv->nof_tx++;
-
-	priv->Conf->driverRetransmissions++;
-	priv->retransmissions++;
-
-	IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk("Retransmit %d bytes \n", TXLAST(dev).length);
-
-	ARLAN_DEBUG_EXIT("arlan_retransmit_now");
-}
-
-
-
-static void arlan_registration_timer(unsigned long data)
-{
-	struct net_device *dev = (struct net_device *) data;
-	struct arlan_private *priv = (struct arlan_private *) dev->priv;
-
-	int lostTime = ((int) (jiffies - priv->registrationLastSeen)) * 1000 / HZ;
-	int bh_mark_needed = 0;
-	int next_tick = 1;
-
-
-	priv->timer_chain_active = 1;
-
-
-	if (registrationBad(dev))
-	{
-		//debug=100;
-		priv->registrationLostCount++;
-		if (lostTime > 7000 && lostTime < 7200)
-		{
-			printk(KERN_NOTICE "%s registration Lost \n", dev->name);
-		}
-		if (lostTime / priv->reRegisterExp > 2000)
-			arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_CONF);
-		if (lostTime / (priv->reRegisterExp) > 3500)
-			arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET);
-		if (priv->reRegisterExp < 400)
-			priv->reRegisterExp += 2;
-		if (lostTime > 7200)
-		{
-			next_tick = HZ;
-			arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET);
-		}
-	}
-	else
-	{
-		if (priv->Conf->registrationMode && lostTime > 10000 &&
-			priv->registrationLostCount)
-		{
-			printk(KERN_NOTICE "%s registration is back after %d milliseconds\n", dev->name,
-				((int) (jiffies - priv->registrationLastSeen) * 1000) / HZ);
-		}
-		priv->registrationLastSeen = jiffies;
-		priv->registrationLostCount = 0;
-		priv->reRegisterExp = 1;
-		if (!netif_running(dev) )
-			netif_wake_queue(dev);
-		if (priv->tx_last_sent > priv->tx_last_cleared &&
-			jiffies - priv->tx_last_sent > 5*HZ ){
-			arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET);		
-			priv->tx_last_cleared = jiffies;
-		};
-	}
-
-
-	if (!registrationBad(dev) && priv->ReTransmitRequested)
-	{
-		IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
-			printk(KERN_ERR "Retransmit from timer \n");
-		priv->ReTransmitRequested = 0;
-		arlan_retransmit_now(dev);
-	}
-	if (!registrationBad(dev) &&
-		time_after(jiffies, priv->tx_done_delayed) &&
-		priv->tx_done_delayed != 0)
-	{
-		TXLAST(dev).offset = 0;
-		if (priv->txLast)
-			priv->txLast = 0;
-		else if (TXTAIL(dev).offset)
-			priv->txLast = 1;
-		if (TXLAST(dev).offset)
-		{
-			arlan_retransmit_now(dev);
-			dev->trans_start = jiffies;
-		}
-		if (!(TXHEAD(dev).offset && TXTAIL(dev).offset))
-		{
-			priv->txOffset = 0;
-			netif_wake_queue (dev);
-		}
-		priv->tx_done_delayed = 0;
-		bh_mark_needed = 1;
-	}
-	if (bh_mark_needed)
-	{
-		priv->txOffset = 0;
-		netif_wake_queue (dev);
-	}
-	arlan_process_interrupt(dev);
-
-	if (next_tick < priv->card_polling_interval)
-		next_tick = priv->card_polling_interval;
-
-	priv->timer_chain_active = 0;
-	priv->timer.expires = jiffies + next_tick;
-
-	add_timer(&priv->timer);
-}
-
-
-#ifdef ARLAN_DEBUGGING
-
-static void arlan_print_registers(struct net_device *dev, int line)
-{
-	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
-
-	u_char hostcpuLock, lancpuLock, controlRegister, cntrlRegImage,
-		txStatus, rxStatus, interruptInProgress, commandByte;
-
-
-	ARLAN_DEBUG_ENTRY("arlan_print_registers");
-	READSHM(interruptInProgress, arlan->interruptInProgress, u_char);
-	READSHM(hostcpuLock, arlan->hostcpuLock, u_char);
-	READSHM(lancpuLock, arlan->lancpuLock, u_char);
-	READSHM(controlRegister, arlan->controlRegister, u_char);
-	READSHM(cntrlRegImage, arlan->cntrlRegImage, u_char);
-	READSHM(txStatus, arlan->txStatus, u_char);
-	READSHM(rxStatus, arlan->rxStatus, u_char);
-	READSHM(commandByte, arlan->commandByte, u_char);
-
-	printk(KERN_WARNING "line %04d IP %02x HL %02x LL %02x CB %02x CR %02x CRI %02x TX %02x RX %02x\n",
-		line, interruptInProgress, hostcpuLock, lancpuLock, commandByte,
-		controlRegister, cntrlRegImage, txStatus, rxStatus);
-
-	ARLAN_DEBUG_EXIT("arlan_print_registers");
-}
-#endif
-
-
-static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
-{
-	int i;
-
-	struct arlan_private *priv = (struct arlan_private *) dev->priv;
-	volatile struct arlan_shmem *arlan = priv->card;
-	struct arlan_conf_stru *conf = priv->Conf;
-
-	int tailStarts = 0x800;
-	int headEnds = 0x0;
-
-
-	ARLAN_DEBUG_ENTRY("arlan_hw_tx");
-	if (TXHEAD(dev).offset)
-		headEnds = (((TXHEAD(dev).offset + TXHEAD(dev).length - (((int) arlan->txBuffer) - ((int) arlan))) / 64) + 1) * 64;
-	if (TXTAIL(dev).offset)
-		tailStarts = 0x800 - (((TXTAIL(dev).offset - (((int) arlan->txBuffer) - ((int) arlan))) / 64) + 2) * 64;
-
-
-	if (!TXHEAD(dev).offset && length < tailStarts)
-	{
-		IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
-			printk(KERN_ERR "TXHEAD insert, tailStart %d\n", tailStarts);
-
-		TXHEAD(dev).offset =
-			(((int) arlan->txBuffer) - ((int) arlan));
-		TXHEAD(dev).length = length - ARLAN_FAKE_HDR_LEN;
-		for (i = 0; i < 6; i++)
-			TXHEAD(dev).dest[i] = buf[i];
-		TXHEAD(dev).clear = conf->txClear;
-		TXHEAD(dev).retries = conf->txRetries;	/* 0 is use default */
-		TXHEAD(dev).routing = conf->txRouting;
-		TXHEAD(dev).scrambled = conf->txScrambled;
-		memcpy_toio(((char *) arlan + TXHEAD(dev).offset), buf + ARLAN_FAKE_HDR_LEN, TXHEAD(dev).length);
-	}
-	else if (!TXTAIL(dev).offset && length < (0x800 - headEnds))
-	{
-		IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
-			printk(KERN_ERR "TXTAIL insert, headEnd %d\n", headEnds);
-
-		TXTAIL(dev).offset =
-			(((int) arlan->txBuffer) - ((int) arlan)) + 0x800 - (length / 64 + 2) * 64;
-		TXTAIL(dev).length = length - ARLAN_FAKE_HDR_LEN;
-		for (i = 0; i < 6; i++)
-			TXTAIL(dev).dest[i] = buf[i];
-		TXTAIL(dev).clear = conf->txClear;
-		TXTAIL(dev).retries = conf->txRetries;
-		TXTAIL(dev).routing = conf->txRouting;
-		TXTAIL(dev).scrambled = conf->txScrambled;
-		memcpy_toio(((char *) arlan + TXTAIL(dev).offset), buf + ARLAN_FAKE_HDR_LEN, TXTAIL(dev).length);
-	}
-	else
-	{
-		netif_stop_queue (dev);
-		return -1;
-		IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
-			printk(KERN_ERR "TX TAIL & HEAD full, return, tailStart %d headEnd %d\n", tailStarts, headEnds);
-	}
-	priv->out_bytes += length;
-	priv->out_bytes10 += length;
-	if (conf->measure_rate < 1)
-		conf->measure_rate = 1;
-	if (jiffies - priv->out_time > conf->measure_rate * HZ)
-	{
-		conf->out_speed = priv->out_bytes / conf->measure_rate;
-		priv->out_bytes = 0;
-		priv->out_time = jiffies;
-	}
-	if (jiffies - priv->out_time10 > conf->measure_rate * HZ * 10)
-	{
-		conf->out_speed10 = priv->out_bytes10 / (10 * conf->measure_rate);
-		priv->out_bytes10 = 0;
-		priv->out_time10 = jiffies;
-	}
-	if (TXHEAD(dev).offset && TXTAIL(dev).offset)
-	{
-		netif_stop_queue (dev);
-		return 0;
-	}
-	else
-		netif_start_queue (dev);
-
-
-	IFDEBUG(ARLAN_DEBUG_HEADER_DUMP)
-		printk(KERN_WARNING "%s Transmit t %2x:%2x:%2x:%2x:%2x:%2x f %2x:%2x:%2x:%2x:%2x:%2x \n", dev->name,
-		   (unsigned char) buf[0], (unsigned char) buf[1], (unsigned char) buf[2], (unsigned char) buf[3],
-		   (unsigned char) buf[4], (unsigned char) buf[5], (unsigned char) buf[6], (unsigned char) buf[7],
-		   (unsigned char) buf[8], (unsigned char) buf[9], (unsigned char) buf[10], (unsigned char) buf[11]);
-
-	IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk(KERN_ERR "TX command prepare for buffer %d\n", priv->txLast);
-
-	arlan_command(dev, ARLAN_COMMAND_TX);
-
-	priv->last_command_was_rx = 0;
-	priv->tx_last_sent = jiffies;
-	priv->nof_tx++;
-
-	IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk("%s TX Qued %d bytes \n", dev->name, length);
-
-	ARLAN_DEBUG_EXIT("arlan_hw_tx");
-
-	return 0;
-}
-
-
-static int arlan_hw_config(struct net_device *dev)
-{
-	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
-	struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf;
-	struct arlan_private *priv = (struct arlan_private *) dev->priv;
-
-	ARLAN_DEBUG_ENTRY("arlan_hw_config");
-
-	printk(KERN_NOTICE "%s arlan configure called \n", dev->name);
-	if (arlan_EEPROM_bad)
-		printk(KERN_NOTICE "arlan configure with eeprom bad option \n");
-
-
-	WRITESHM(arlan->spreadingCode, conf->spreadingCode, u_char);
-	WRITESHM(arlan->channelSet, conf->channelSet, u_char);
-
-	if (arlan_EEPROM_bad)
-		WRITESHM(arlan->defaultChannelSet, conf->channelSet, u_char);
-
-	WRITESHM(arlan->channelNumber, conf->channelNumber, u_char);
-
-	WRITESHM(arlan->scramblingDisable, conf->scramblingDisable, u_char);
-	WRITESHM(arlan->txAttenuation, conf->txAttenuation, u_char);
-
-	WRITESHM(arlan->systemId, conf->systemId, u_int);
-
-	WRITESHM(arlan->maxRetries, conf->maxRetries, u_char);
-	WRITESHM(arlan->receiveMode, conf->receiveMode, u_char);
-	WRITESHM(arlan->priority, conf->priority, u_char);
-	WRITESHM(arlan->rootOrRepeater, conf->rootOrRepeater, u_char);
-	WRITESHM(arlan->SID, conf->SID, u_int);
-
-	WRITESHM(arlan->registrationMode, conf->registrationMode, u_char);
-
-	WRITESHM(arlan->registrationFill, conf->registrationFill, u_char);
-	WRITESHM(arlan->localTalkAddress, conf->localTalkAddress, u_char);
-	WRITESHM(arlan->codeFormat, conf->codeFormat, u_char);
-	WRITESHM(arlan->numChannels, conf->numChannels, u_char);
-	WRITESHM(arlan->channel1, conf->channel1, u_char);
-	WRITESHM(arlan->channel2, conf->channel2, u_char);
-	WRITESHM(arlan->channel3, conf->channel3, u_char);
-	WRITESHM(arlan->channel4, conf->channel4, u_char);
-	WRITESHM(arlan->radioNodeId, conf->radioNodeId, u_short);
-	WRITESHM(arlan->SID, conf->SID, u_int);
-	WRITESHM(arlan->waitTime, conf->waitTime, u_short);
-	WRITESHM(arlan->lParameter, conf->lParameter, u_short);
-	memcpy_toio(&(arlan->_15), &(conf->_15), 3);
-	WRITESHM(arlan->_15, conf->_15, u_short);
-	WRITESHM(arlan->headerSize, conf->headerSize, u_short);
-	if (arlan_EEPROM_bad)
-		WRITESHM(arlan->hardwareType, conf->hardwareType, u_char);
-	WRITESHM(arlan->radioType, conf->radioType, u_char);
-	if (arlan_EEPROM_bad)
-		WRITESHM(arlan->radioModule, conf->radioType, u_char);
-
-	memcpy_toio(arlan->encryptionKey + keyStart, encryptionKey, 8);
-	memcpy_toio(arlan->name, conf->siteName, 16);
-
-	WRITESHMB(arlan->commandByte, ARLAN_COM_INT | ARLAN_COM_CONF);	/* do configure */
-	memset_io(arlan->commandParameter, 0, 0xf);	/* 0xf */
-	memset_io(arlan->commandParameter + 1, 0, 2);
-	if (conf->writeEEPROM)
-	{
-		  memset_io(arlan->commandParameter, conf->writeEEPROM, 1);
-//		conf->writeEEPROM=0;
-	}
-	if (conf->registrationMode && conf->registrationInterrupts)
-		memset_io(arlan->commandParameter + 3, 1, 1);
-	else
-		memset_io(arlan->commandParameter + 3, 0, 1);
-
-	priv->irq_test_done = 0;
-
-	if (conf->tx_queue_len)
-		dev->tx_queue_len = conf->tx_queue_len;
-	udelay(100);
-
-	ARLAN_DEBUG_EXIT("arlan_hw_config");
-	return 0;
-}
-
-
-static int arlan_read_card_configuration(struct net_device *dev)
-{
-	u_char tlx415;
-	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
-	struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf;
-
-	ARLAN_DEBUG_ENTRY("arlan_read_card_configuration");
-
-	if (radioNodeId == radioNodeIdUNKNOWN)
-	{
-		READSHM(conf->radioNodeId, arlan->radioNodeId, u_short);
-	}
-	else
-		conf->radioNodeId = radioNodeId;
-		
-	if (SID == SIDUNKNOWN)
-	{
-		READSHM(conf->SID, arlan->SID, u_int);
-	}
-	else conf->SID = SID;
-		
-	if (spreadingCode == spreadingCodeUNKNOWN)
-	{
-		  READSHM(conf->spreadingCode, arlan->spreadingCode, u_char);
-	}
-	else
-		conf->spreadingCode = spreadingCode;
-		
-	if (channelSet == channelSetUNKNOWN)
-	{
-		READSHM(conf->channelSet, arlan->channelSet, u_char);
-	}
-	else conf->channelSet = channelSet;
-
-	if (channelNumber == channelNumberUNKNOWN)
-	{
-		READSHM(conf->channelNumber, arlan->channelNumber, u_char);
-	}
-	else conf->channelNumber = channelNumber;
-	
-	READSHM(conf->scramblingDisable, arlan->scramblingDisable, u_char);
-	READSHM(conf->txAttenuation, arlan->txAttenuation, u_char);
-	
-	if (systemId == systemIdUNKNOWN)
-	{
-		READSHM(conf->systemId, arlan->systemId, u_int);
-	} 
-	else conf->systemId = systemId;
-	
-	READSHM(conf->maxDatagramSize, arlan->maxDatagramSize, u_short);
-	READSHM(conf->maxFrameSize, arlan->maxFrameSize, u_short);
-	READSHM(conf->maxRetries, arlan->maxRetries, u_char);
-	READSHM(conf->receiveMode, arlan->receiveMode, u_char);
-	READSHM(conf->priority, arlan->priority, u_char);
-	READSHM(conf->rootOrRepeater, arlan->rootOrRepeater, u_char);
-
-	if (SID == SIDUNKNOWN)
-	{
-		  READSHM(conf->SID, arlan->SID, u_int);
-	}
-	else conf->SID = SID;
-	
-	if (registrationMode == registrationModeUNKNOWN)
-	{
-		  READSHM(conf->registrationMode, arlan->registrationMode, u_char);
-	}
-	else conf->registrationMode = registrationMode;
-	
-	READSHM(conf->registrationFill, arlan->registrationFill, u_char);
-	READSHM(conf->localTalkAddress, arlan->localTalkAddress, u_char);
-	READSHM(conf->codeFormat, arlan->codeFormat, u_char);
-	READSHM(conf->numChannels, arlan->numChannels, u_char);
-	READSHM(conf->channel1, arlan->channel1, u_char);
-	READSHM(conf->channel2, arlan->channel2, u_char);
-	READSHM(conf->channel3, arlan->channel3, u_char);
-	READSHM(conf->channel4, arlan->channel4, u_char);
-	READSHM(conf->waitTime, arlan->waitTime, u_short);
-	READSHM(conf->lParameter, arlan->lParameter, u_short);
-	READSHM(conf->_15, arlan->_15, u_short);
-	READSHM(conf->headerSize, arlan->headerSize, u_short);
-	READSHM(conf->hardwareType, arlan->hardwareType, u_char);
-	READSHM(conf->radioType, arlan->radioModule, u_char);
-	
-	if (conf->radioType == 0)
-		conf->radioType = 0xc;
-
-	WRITESHM(arlan->configStatus, 0xA5, u_char);
-	READSHM(tlx415, arlan->configStatus, u_char);
-	
-	if (tlx415 != 0xA5)
-		printk(KERN_INFO "%s tlx415 chip \n", dev->name);
-	
-	conf->txClear = 0;
-	conf->txRetries = 1;
-	conf->txRouting = 1;
-	conf->txScrambled = 0;
-	conf->rxParameter = 1;
-	conf->txTimeoutMs = 4000;
-	conf->waitCardTimeout = 100000;
-	conf->receiveMode = ARLAN_RCV_CLEAN;
-	memcpy_fromio(conf->siteName, arlan->name, 16);
-	conf->siteName[16] = '\0';
-	conf->retries = retries;
-	conf->tx_delay_ms = tx_delay_ms;
-	conf->async = async;
-	conf->ReTransmitPacketMaxSize = 200;
-	conf->waitReTransmitPacketMaxSize = 200;
-	conf->txAckTimeoutMs = 900;
-	conf->fastReTransCount = 3;
-
-	ARLAN_DEBUG_EXIT("arlan_read_card_configuration");
-
-	return 0;
-}
-
-
-static int lastFoundAt = 0xbe000;
-
-
-/*
- * This is the real probe routine. Linux has a history of friendly device
- * probes on the ISA bus. A good device probes avoids doing writes, and
- * verifies that the correct device exists and functions.
- */
-
-static int __init arlan_check_fingerprint(int memaddr)
-{
-	static char probeText[] = "TELESYSTEM SLW INC.    ARLAN \0";
-	char tempBuf[49];
-	volatile struct arlan_shmem *arlan = (struct arlan_shmem *) memaddr;
-
-	ARLAN_DEBUG_ENTRY("arlan_check_fingerprint");
-	if (check_mem_region(virt_to_phys((void *)memaddr),0x2000 )){
-		// printk(KERN_WARNING "arlan: memory region %lx excluded from probing \n",virt_to_phys((void*)memaddr));
-		return -ENODEV;
-	};
-	memcpy_fromio(tempBuf, arlan->textRegion, 29);
-	tempBuf[30] = 0;
-
-	/* check for card at this address */
-	if (0 != strncmp(tempBuf, probeText, 29)){
-// not 		release_mem_region(virt_to_phys((void*)memaddr),0x2000);
-		return -ENODEV;
-	}
-
-//   printk(KERN_INFO "arlan found at 0x%x \n",memaddr);
-	ARLAN_DEBUG_EXIT("arlan_check_fingerprint");
-
-	return 0;
-
-
-}
-
-static int __init arlan_probe_everywhere(struct net_device *dev)
-{
-	int m;
-	int probed = 0;
-	int found = 0;
-
-	SET_MODULE_OWNER(dev);
-
-	ARLAN_DEBUG_ENTRY("arlan_probe_everywhere");
-	if (mem != 0 && numDevices == 1)	/* Check a single specified location. */
-	{
-		if (arlan_probe_here(dev, (int) phys_to_virt(  mem) ) == 0)
-			return 0;
-		else
-			return -ENODEV;
-	}
-	for (m = (int)phys_to_virt(lastFoundAt) + 0x2000; m <= (int)phys_to_virt(0xDE000); m += 0x2000)
-	{
-		if (arlan_probe_here(dev, m) == 0)
-		{
-			found++;
-			lastFoundAt = (int)virt_to_phys((void*)m);
-			break;
-		}
-		probed++;
-	}
-	if (found == 0 && probed != 0)
-	{
-		if (lastFoundAt == 0xbe000)
-			printk(KERN_ERR "arlan: No Arlan devices found \n");
-		return -ENODEV;
-	}
-	else
-		return 0;
-
-	ARLAN_DEBUG_EXIT("arlan_probe_everywhere");
-
-	return -ENODEV;
-}
-
-
-static int arlan_change_mtu(struct net_device *dev, int new_mtu)
-{
-	struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf;
-
-	ARLAN_DEBUG_ENTRY("arlan_change_mtu");
-	if (new_mtu > 2032)
-		return -EINVAL;
-	dev->mtu = new_mtu;
-	if (new_mtu < 256)
-		new_mtu = 256;	/* cards book suggests 1600 */
-	conf->maxDatagramSize = new_mtu;
-	conf->maxFrameSize = new_mtu + 48;
-
-	arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_CONF);
-	printk(KERN_NOTICE "%s mtu changed to %d \n", dev->name, new_mtu);
-
-	ARLAN_DEBUG_EXIT("arlan_change_mtu");
-
-	return 0;
-}
-
-static int arlan_mac_addr(struct net_device *dev, void *p)
-{
-	struct sockaddr *addr = p;
-
-
-	ARLAN_DEBUG_ENTRY("arlan_mac_addr");
-	return -EINVAL;
-
-	if (!netif_running(dev))
-		return -EBUSY;
-	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
-
-	ARLAN_DEBUG_EXIT("arlan_mac_addr");
-	return 0;
-}
-
-
-
-
-static int __init
-	      arlan_allocate_device(int num, struct net_device *devs)
-{
-
-	struct net_device *dev;
-	struct arlan_private *ap;
-
-	ARLAN_DEBUG_ENTRY("arlan_allocate_device");
-
-	if (!devs) {
-		dev = init_etherdev(0, sizeof(struct arlan_private) + sizeof(struct arlan_shmem));
-		if (!dev) {
-			printk(KERN_ERR "ARLAN: init_etherdev failed\n");
-			return 0;
-		}
-		ap = dev->priv;
-		ap->conf = dev->priv + sizeof(struct arlan_private);
-		ap->init_etherdev_alloc = 1;
-	} else {
-		dev = devs;
-		dev->priv = kmalloc(sizeof(struct arlan_private) + sizeof(struct arlan_shmem), GFP_KERNEL);
-		if (!dev->priv) {
-			printk(KERN_ERR "ARLAN: kmalloc of dev->priv failed\n");
-			return 0;
-		}
-		ap = dev->priv;
-		ap->conf = dev->priv + sizeof(struct arlan_private);
-		memset(ap, 0, sizeof(*ap));
-	}
-
-	/* Fill in the 'dev' fields. */
-	dev->base_addr = 0;
-	dev->mem_start = 0;
-	dev->mem_end = 0;
-	dev->mtu = 1500;
-	dev->flags = 0;		/* IFF_BROADCAST & IFF_MULTICAST & IFF_PROMISC; */
-	dev->irq = 0;
-	dev->dma = 0;
-	dev->tx_queue_len = tx_queue_len;
-	ether_setup(dev);
-	dev->tx_queue_len = tx_queue_len;
-	dev->open = arlan_open;
-	dev->stop = arlan_close;
-	dev->hard_start_xmit = arlan_tx;
-	dev->get_stats = arlan_statistics;
-	dev->set_multicast_list = arlan_set_multicast;
-	dev->change_mtu = arlan_change_mtu;
-	dev->set_mac_address = arlan_mac_addr;
-	dev->tx_timeout = arlan_tx_timeout;
-	dev->watchdog_timeo = 3*HZ;
-	
-	((struct arlan_private *) dev->priv)->irq_test_done = 0;
-	arlan_device[num] = dev;
-	((struct arlan_private *) arlan_device[num]->priv)->Conf = &(arlan_conf[num]);
-
-	((struct arlan_private *) dev->priv)->Conf->pre_Command_Wait = 40;
-	((struct arlan_private *) dev->priv)->Conf->rx_tweak1 = 30;
-	((struct arlan_private *) dev->priv)->Conf->rx_tweak2 = 0;
-
-	ARLAN_DEBUG_EXIT("arlan_allocate_device");
-	return (int) dev;
-}
-
-
-static int __init arlan_probe_here(struct net_device *dev, int memaddr)
-{
-	volatile struct arlan_shmem *arlan;
-
-	ARLAN_DEBUG_ENTRY("arlan_probe_here");
-
-	if (arlan_check_fingerprint(memaddr))
-		return -ENODEV;
-
-	printk(KERN_NOTICE "%s: Arlan found at %x, \n ", dev->name, (int) virt_to_phys((void*)memaddr));
-
-	if (!arlan_allocate_device(arlans_found, dev))
-		return -1;
-
-	((struct arlan_private *) dev->priv)->card = (struct arlan_shmem *) memaddr;
-	arlan = (void *) memaddr;
-
-	dev->mem_start = memaddr;
-	dev->mem_end = memaddr + 0x1FFF;
-
-	if (dev->irq < 2)
-	{
-		READSHM(dev->irq, arlan->irqLevel, u_char);
-	} else if (dev->irq == 2)
-		dev->irq = 9;
-
-	arlan_read_card_configuration(dev);
-
-	ARLAN_DEBUG_EXIT("arlan_probe_here");
-	return 0;
-}
-
-
-
-
-static int arlan_open(struct net_device *dev)
-{
-	struct arlan_private *priv = (struct arlan_private *) dev->priv;
-	volatile struct arlan_shmem *arlan = priv->card;
-	int ret = 0;
-
-	ARLAN_DEBUG_ENTRY("arlan_open");
-
-	if (dev->mem_start == 0)
-		ret = arlan_probe_everywhere(dev);
-	if (ret != 0)
-		return ret;
-
-	arlan = ((struct arlan_private *) dev->priv)->card;
-	ret = request_irq(dev->irq, &arlan_interrupt, 0, dev->name, dev);
-	if (ret)
-	{
-		printk(KERN_ERR "%s: unable to get IRQ %d .\n",
-			dev->name, dev->irq);
-		return ret;
-	}
-
-
-	priv->bad = 0;
-	priv->lastReset = 0;
-	priv->reset = 0;
-	priv->open_time = jiffies;
-	memcpy_fromio(dev->dev_addr, arlan->lanCardNodeId, 6);
-	memset(dev->broadcast, 0xff, 6);
-	priv->txOffset = 0;
-	dev->tx_queue_len = tx_queue_len;
-	priv->interrupt_processing_active = 0;
-	priv->command_lock = 0;
-
-	netif_start_queue (dev);
-
-	init_MUTEX(&priv->card_lock);
-	myATOMIC_INIT(priv->card_users, 1);	/* damn 2.0.33 */
-	priv->registrationLostCount = 0;
-	priv->registrationLastSeen = jiffies;
-	priv->txLast = 0;
-	priv->tx_command_given = 0;
-	priv->rx_command_given = 0;
-	
-	priv->reRegisterExp = 1;
-	priv->nof_tx = 0;
-	priv->nof_tx_ack = 0;
-	priv->last_command_was_rx = 0;
-	priv->tx_last_sent = jiffies - 1;
-	priv->tx_last_cleared = jiffies;
-	priv->Conf->writeEEPROM = 0;
-	priv->Conf->registrationInterrupts = 1;
-
-	init_timer(&priv->timer);
-	priv->timer.expires = jiffies + HZ / 10;
-	priv->timer.data = (unsigned long) dev;
-	priv->timer.function = &arlan_registration_timer;	/* timer handler */
-
-	arlan_command(dev, ARLAN_COMMAND_POWERUP | ARLAN_COMMAND_LONG_WAIT_NOW);
-	mdelay(200);
-	add_timer(&priv->timer);
-
-#ifdef CONFIG_PROC_FS
-#ifndef MODULE
-	if (arlan_device[0])
-		init_arlan_proc();
-#endif
-#endif
-	ARLAN_DEBUG_EXIT("arlan_open");
-	return 0;
-}
-
-
-static void arlan_tx_timeout (struct net_device *dev)
-{
-	printk(KERN_ERR "%s: arlan transmit timed out, kernel decided\n", dev->name);
-	/* Try to restart the adaptor. */
-	arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET);
-	// dev->trans_start = jiffies;
-	// netif_start_queue (dev);
-}
-
-
-static int arlan_tx(struct sk_buff *skb, struct net_device *dev)
-{
-	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
-	short length;
-	unsigned char *buf;
-
-	ARLAN_DEBUG_ENTRY("arlan_tx");
-	
-	length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
-	buf = skb->data;
-
-	if (priv->txOffset + length + 0x12 > 0x800) {
-		printk(KERN_ERR "TX RING overflow \n");
-		netif_stop_queue (dev);
-	}
-
-	if (arlan_hw_tx(dev, buf, length) == -1)
-		goto bad_end;
-
-	dev->trans_start = jiffies;
-
-	dev_kfree_skb(skb);
-
-	arlan_process_interrupt(dev);
-	priv->tx_chain_active = 0;
-	ARLAN_DEBUG_EXIT("arlan_tx");
-	return 0;
-
-bad_end:
-	arlan_process_interrupt(dev);
-	priv->tx_chain_active = 0;
-	netif_stop_queue (dev);
-	ARLAN_DEBUG_EXIT("arlan_tx");
-	return 1;
-}
-
-
-static inline int DoNotReTransmitCrap(struct net_device *dev)
-{
-	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
-
-	if (TXLAST(dev).length < priv->Conf->ReTransmitPacketMaxSize)
-		return 1;
-	return 0;
-
-}
-
-static inline int DoNotWaitReTransmitCrap(struct net_device *dev)
-{
-	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
-
-	if (TXLAST(dev).length < priv->Conf->waitReTransmitPacketMaxSize)
-		return 1;
-	return 0;
-}
-
-static inline void arlan_queue_retransmit(struct net_device *dev)
-{
-	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
-
-	ARLAN_DEBUG_ENTRY("arlan_queue_retransmit");
-
-	if (DoNotWaitReTransmitCrap(dev))
-	{
-		  arlan_drop_tx(dev);
-	} else
-		priv->ReTransmitRequested++;
-
-	ARLAN_DEBUG_EXIT("arlan_queue_retransmit");
-};
-
-static inline void RetryOrFail(struct net_device *dev)
-{
-	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
-
-	ARLAN_DEBUG_ENTRY("RetryOrFail");
-
-	if (priv->retransmissions > priv->Conf->retries ||
-	    DoNotReTransmitCrap(dev))
-	{
-		arlan_drop_tx(dev);
-	}
-	else if (priv->bad <= priv->Conf->fastReTransCount)
-	{
-		arlan_retransmit_now(dev);
-	}
-	else arlan_queue_retransmit(dev);
-
-	ARLAN_DEBUG_EXIT("RetryOrFail");
-}
-
-
-static void arlan_tx_done_interrupt(struct net_device *dev, int status)
-{
-	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
-
-	ARLAN_DEBUG_ENTRY("arlan_tx_done_interrupt");
-
-	priv->tx_last_cleared = jiffies;
-	priv->tx_command_given = 0;
-	priv->nof_tx_ack++;
-	switch (status)
-	{
-		case 1:
-		{
-			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
-				printk("arlan intr: transmit OK\n");
-			priv->stats.tx_packets++;
-			priv->bad = 0;
-			priv->reset = 0;
-			priv->retransmissions = 0;
-			if (priv->Conf->tx_delay_ms)
-			{
-				priv->tx_done_delayed = jiffies + (priv->Conf->tx_delay_ms * HZ) / 1000 + 1;;
-			}
-			else
-			{
-				TXLAST(dev).offset = 0;
-				if (priv->txLast)
-					priv->txLast = 0;
-				else if (TXTAIL(dev).offset)
-					priv->txLast = 1;
-				if (TXLAST(dev).offset)
-				{
-					arlan_retransmit_now(dev);
-					dev->trans_start = jiffies;
-				}
-				if (!TXHEAD(dev).offset || !TXTAIL(dev).offset)
-				{
-					priv->txOffset = 0;
-					netif_wake_queue (dev);
-				}
-			}
-		}
-		break;
-		
-		case 2:
-		{
-			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
-				printk("arlan intr: transmit timed out\n");
-			priv->bad += 1;
-			//arlan_queue_retransmit(dev);
-			RetryOrFail(dev);
-		}
-		break;
-
-		case 3:
-		{
-			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
-				printk("arlan intr: transmit max retries\n");
-			priv->bad += 1;
-			priv->reset = 0;
-			//arlan_queue_retransmit(dev);
-			RetryOrFail(dev);
-		}
-		break;
-		
-		case 4:
-		{
-			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
-				printk("arlan intr: transmit aborted\n");
-			priv->bad += 1;
-			arlan_queue_retransmit(dev);
-			//RetryOrFail(dev);
-		}
-		break;
-
-		case 5:
-		{
-			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
-				printk("arlan intr: transmit not registered\n");
-			priv->bad += 1;
-			//debug=101;
-			arlan_queue_retransmit(dev);
-		}
-		break;
-
-		case 6:
-		{
-			IFDEBUG(ARLAN_DEBUG_TX_CHAIN) 
-				printk("arlan intr: transmit destination full\n");
-			priv->bad += 1;
-			priv->reset = 0;
-			//arlan_drop_tx(dev);
-			arlan_queue_retransmit(dev);
-		}
-		break;
-
-		case 7:
-		{
-			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
-				printk("arlan intr: transmit unknown ack\n");
-			priv->bad += 1;
-			priv->reset = 0;
-			arlan_queue_retransmit(dev);
-		}
-		break;
-		
-		case 8:
-		{
-			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
-				printk("arlan intr: transmit dest mail box full\n");
-			priv->bad += 1;
-			priv->reset = 0;
-			//arlan_drop_tx(dev);
-			arlan_queue_retransmit(dev);
-		}
-		break;
-
-		case 9:
-		{
-			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
-				printk("arlan intr: transmit root dest not reg.\n");
-			priv->bad += 1;
-			priv->reset = 1;
-			//arlan_drop_tx(dev);
-			arlan_queue_retransmit(dev);
-		}
-		break;
-
-		default:
-		{
-			printk(KERN_ERR "arlan intr: transmit status unknown\n");
-			priv->bad += 1;
-			priv->reset = 1;
-			arlan_drop_tx(dev);
-		}
-	}
-
-	ARLAN_DEBUG_EXIT("arlan_tx_done_interrupt");
-}
-
-
-static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short rxOffset, u_short pkt_len)
-{
-	char *skbtmp;
-	int i = 0;
-
-	struct arlan_private *priv = (struct arlan_private *) dev->priv;
-	volatile struct arlan_shmem *arlan = priv->card;
-	struct arlan_conf_stru *conf = priv->Conf;
-
-
-	ARLAN_DEBUG_ENTRY("arlan_rx_interrupt");
-	// by spec,   not                WRITESHMB(arlan->rxStatus,0x00);
-	// prohibited here              arlan_command(dev, ARLAN_COMMAND_RX);
-
-	if (pkt_len < 10 || pkt_len > 2048)
-	{
-		printk(KERN_WARNING "%s: got too short or long packet, len %d \n", dev->name, pkt_len);
-		return;
-	}
-	if (rxOffset + pkt_len > 0x2000)
-	{
-		printk("%s: got too long packet, len %d offset %x\n", dev->name, pkt_len, rxOffset);
-		return;
-	}
-	priv->in_bytes += pkt_len;
-	priv->in_bytes10 += pkt_len;
-	if (conf->measure_rate < 1)
-		conf->measure_rate = 1;
-	if (jiffies - priv->in_time > conf->measure_rate * HZ)
-	{
-		conf->in_speed = priv->in_bytes / conf->measure_rate;
-		priv->in_bytes = 0;
-		priv->in_time = jiffies;
-	}
-	if (jiffies - priv->in_time10 > conf->measure_rate * HZ * 10)
-	{
-		conf->in_speed10 = priv->in_bytes10 / (10 * conf->measure_rate);
-		priv->in_bytes10 = 0;
-		priv->in_time10 = jiffies;
-	}
-	DEBUGSHM(1, "arlan rcv pkt rxStatus= %d ", arlan->rxStatus, u_char);
-	switch (rxStatus)
-	{
-		case 1:
-		case 2:
-		case 3:
-		{
-			/* Malloc up new buffer. */
-			struct sk_buff *skb;
-
-			DEBUGSHM(50, "arlan recv pkt offs=%d\n", arlan->rxOffset, u_short);
-			DEBUGSHM(1, "arlan rxFrmType = %d \n", arlan->rxFrmType, u_char);
-			DEBUGSHM(1, KERN_INFO "arlan rx scrambled = %d \n", arlan->scrambled, u_char);
-
-			/* here we do multicast filtering to avoid slow 8-bit memcopy */
-#ifdef ARLAN_MULTICAST
-			if (!(dev->flags & IFF_ALLMULTI) &&
-				!(dev->flags & IFF_PROMISC) &&
-				dev->mc_list)
-			{
-				char hw_dst_addr[6];
-				struct dev_mc_list *dmi = dev->mc_list;
-				int i;
-
-				memcpy_fromio(hw_dst_addr, arlan->ultimateDestAddress, 6);
-				if (hw_dst_addr[0] == 0x01)
-				{
-					if (mdebug)
-						if (hw_dst_addr[1] == 0x00)
-							printk(KERN_ERR "%s mcast 0x0100 \n", dev->name);
-						else if (hw_dst_addr[1] == 0x40)
-							printk(KERN_ERR "%s m/bcast 0x0140 \n", dev->name);
-					while (dmi)
-					{							if (dmi->dmi_addrlen == 6)
-						{
-							if (arlan_debug & ARLAN_DEBUG_HEADER_DUMP)
-								printk(KERN_ERR "%s mcl %2x:%2x:%2x:%2x:%2x:%2x \n", dev->name,
-										 dmi->dmi_addr[0], dmi->dmi_addr[1], dmi->dmi_addr[2],
-										 dmi->dmi_addr[3], dmi->dmi_addr[4], dmi->dmi_addr[5]);
-							for (i = 0; i < 6; i++)
-								if (dmi->dmi_addr[i] != hw_dst_addr[i])
-									break;
-							if (i == 6)
-								break;
-						}
-						else
-							printk(KERN_ERR "%s: invalid multicast address length given.\n", dev->name);
-						dmi = dmi->next;
-					}
-					/* we reach here if multicast filtering is on and packet 
-					 * is multicast and not for receive */
-					goto end_of_interrupt;
-				}
-			}
-#endif				// ARLAN_MULTICAST
-			/* multicast filtering ends here */
-			pkt_len += ARLAN_FAKE_HDR_LEN;
-
-			skb = dev_alloc_skb(pkt_len + 4);
-			if (skb == NULL)
-			{
-				printk(KERN_ERR "%s: Memory squeeze, dropping packet.\n", dev->name);
-				priv->stats.rx_dropped++;
-				break;
-			}
-			skb_reserve(skb, 2);
-			skb->dev = dev;
-			skbtmp = skb_put(skb, pkt_len);
-
-			memcpy_fromio(skbtmp + ARLAN_FAKE_HDR_LEN, ((char *) arlan) + rxOffset, pkt_len - ARLAN_FAKE_HDR_LEN);
-			memcpy_fromio(skbtmp, arlan->ultimateDestAddress, 6);
-			memcpy_fromio(skbtmp + 6, arlan->rxSrc, 6);
-			WRITESHMB(arlan->rxStatus, 0x00);
-			arlan_command(dev, ARLAN_COMMAND_RX);
-
-			IFDEBUG(ARLAN_DEBUG_HEADER_DUMP)
-			{
-				char immedDestAddress[6];
-				char immedSrcAddress[6];
-				memcpy_fromio(immedDestAddress, arlan->immedDestAddress, 6);
-				memcpy_fromio(immedSrcAddress, arlan->immedSrcAddress, 6);
-
-				printk(KERN_WARNING "%s t %2x:%2x:%2x:%2x:%2x:%2x f %2x:%2x:%2x:%2x:%2x:%2x imd %2x:%2x:%2x:%2x:%2x:%2x ims %2x:%2x:%2x:%2x:%2x:%2x\n", dev->name,
-					(unsigned char) skbtmp[0], (unsigned char) skbtmp[1], (unsigned char) skbtmp[2], (unsigned char) skbtmp[3],
-					(unsigned char) skbtmp[4], (unsigned char) skbtmp[5], (unsigned char) skbtmp[6], (unsigned char) skbtmp[7],
-					(unsigned char) skbtmp[8], (unsigned char) skbtmp[9], (unsigned char) skbtmp[10], (unsigned char) skbtmp[11],
-					immedDestAddress[0], immedDestAddress[1], immedDestAddress[2],
-					immedDestAddress[3], immedDestAddress[4], immedDestAddress[5],
-					immedSrcAddress[0], immedSrcAddress[1], immedSrcAddress[2],
-					immedSrcAddress[3], immedSrcAddress[4], immedSrcAddress[5]);
-			}
-			skb->protocol = eth_type_trans(skb, dev);
-			IFDEBUG(ARLAN_DEBUG_HEADER_DUMP)
-				if (skb->protocol != 0x608 && skb->protocol != 0x8)
-				{
-					for (i = 0; i <= 22; i++)
-						printk("%02x:", (u_char) skbtmp[i + 12]);
-					printk(KERN_ERR "\n");
-					printk(KERN_WARNING "arlan kernel pkt type trans %x \n", skb->protocol);
-				}
-			netif_rx(skb);
-			dev->last_rx = jiffies;
-			priv->stats.rx_packets++;
-			priv->stats.rx_bytes += pkt_len;
-		}
-		break;
-		
-		default:
-			printk(KERN_ERR "arlan intr: received unknown status\n");
-			priv->stats.rx_crc_errors++;
-			break;
-	}
-	ARLAN_DEBUG_EXIT("arlan_rx_interrupt");
-}
-
-static void arlan_process_interrupt(struct net_device *dev)
-{
-	struct arlan_private *priv = (struct arlan_private *) dev->priv;
-	volatile struct arlan_shmem *arlan = priv->card;
-	u_char rxStatus = READSHMB(arlan->rxStatus);
-	u_char txStatus = READSHMB(arlan->txStatus);
-	u_short rxOffset = READSHMS(arlan->rxOffset);
-	u_short pkt_len = READSHMS(arlan->rxLength);
-	int interrupt_count = 0;
-
-	ARLAN_DEBUG_ENTRY("arlan_process_interrupt");
-
-	if (test_and_set_bit(0, (void *) &priv->interrupt_processing_active))
-	{
-		if (arlan_debug & ARLAN_DEBUG_CHAIN_LOCKS)
-			printk(KERN_ERR "interrupt chain reentering \n");
-		goto end_int_process;
-	}
-	while ((rxStatus || txStatus || priv->interrupt_ack_requested)
-			&& (interrupt_count < 5))
-	{
-		if (rxStatus)
-			priv->last_rx_int_ack_time = arlan_time();
-
-		arlan_command(dev, ARLAN_COMMAND_INT_ACK);
-		arlan_command(dev, ARLAN_COMMAND_INT_ENABLE);
-		
-		IFDEBUG(ARLAN_DEBUG_INTERRUPT)
-			printk(KERN_ERR "%s:  got IRQ rx %x tx %x comm %x rxOff %x rxLen %x \n",
-					dev->name, rxStatus, txStatus, READSHMB(arlan->commandByte),
-					rxOffset, pkt_len);
-
-		if (rxStatus == 0 && txStatus == 0)
-		{
-			priv->last_command_was_rx = 0;
-			if (priv->irq_test_done)
-			{
-				if (!registrationBad(dev))
-					IFDEBUG(ARLAN_DEBUG_INTERRUPT) printk(KERN_ERR "%s unknown interrupt(nop? regLost ?) reason tx %d rx %d ",
-										    dev->name, txStatus, rxStatus);
-			} else {
-				IFDEBUG(ARLAN_DEBUG_INTERRUPT)
-					printk(KERN_INFO "%s irq $%d test OK \n", dev->name, dev->irq);
-
-			}
-			priv->interrupt_ack_requested = 0;
-			goto ends;
-		}
-		if (txStatus != 0)
-		{
-			WRITESHMB(arlan->txStatus, 0x00);
-			arlan_tx_done_interrupt(dev, txStatus);
-			goto ends;
-		}
-		if (rxStatus == 1 || rxStatus == 2)
-		{		/* a packet waiting */
-			arlan_rx_interrupt(dev, rxStatus, rxOffset, pkt_len);
-			goto ends;
-		}
-		if (rxStatus > 2 && rxStatus < 0xff)
-		{
-			priv->last_command_was_rx = 0;
-			WRITESHMB(arlan->rxStatus, 0x00);
-			printk(KERN_ERR "%s unknown rxStatus reason tx %d rx %d ",
-				dev->name, txStatus, rxStatus);
-			goto ends;
-		}
-		if (rxStatus == 0xff)
-		{
-			priv->last_command_was_rx = 0;
-			WRITESHMB(arlan->rxStatus, 0x00);
-			arlan_command(dev, ARLAN_COMMAND_RX);
-			if (registrationBad(dev))
-				netif_device_detach(dev);
-			if (!registrationBad(dev))
-			{
-				priv->registrationLastSeen = jiffies;
-				if (!netif_queue_stopped(dev) && !priv->under_reset && !priv->under_config)
-					netif_wake_queue (dev);
-			}
-			goto ends;
-		}
-ends:
-
-		arlan_command_process(dev);
-
-		rxStatus = READSHMB(arlan->rxStatus);
-		txStatus = READSHMB(arlan->txStatus);
-		rxOffset = READSHMS(arlan->rxOffset);
-		pkt_len = READSHMS(arlan->rxLength);
-
-
-		priv->irq_test_done = 1;
-
-		interrupt_count++;
-	}
-	priv->interrupt_processing_active = 0;
-
-end_int_process:
-	arlan_command_process(dev);
-
-	ARLAN_DEBUG_EXIT("arlan_process_interrupt");
-	return;
-}
-
-static void arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-	struct net_device *dev = dev_id;
-	struct arlan_private *priv = (struct arlan_private *) dev->priv;
-	volatile struct arlan_shmem *arlan = priv->card;
-	u_char rxStatus = READSHMB(arlan->rxStatus);
-	u_char txStatus = READSHMB(arlan->txStatus);
-
-	ARLAN_DEBUG_ENTRY("arlan_interrupt");
-
-
-	if (!rxStatus && !txStatus)
-		priv->interrupt_ack_requested++;
-
-	arlan_process_interrupt(dev);
-	
-	priv->irq_test_done = 1;
-
-	ARLAN_DEBUG_EXIT("arlan_interrupt");
-	return;
-
-}
-
-
-static int arlan_close(struct net_device *dev)
-{
-	struct arlan_private *priv = (struct arlan_private *) dev->priv;
-
-	if (!dev)
-	{
-		printk(KERN_CRIT "arlan: No Device\n");
-		return 0;
-	}
-	priv = (struct arlan_private *) dev->priv;
-	if (!priv)
-	{
-		printk(KERN_CRIT "arlan: No Device priv \n");
-		return 0;
-	}
-	ARLAN_DEBUG_ENTRY("arlan_close");
-
-	del_timer(&priv->timer);
-
-	arlan_command(dev, ARLAN_COMMAND_POWERDOWN);
-
-	IFDEBUG(ARLAN_DEBUG_STARTUP)
-		printk(KERN_NOTICE "%s: Closing device\n", dev->name);
-
-	priv->open_time = 0;
-	netif_stop_queue(dev);
-	free_irq(dev->irq, dev);
-
-	ARLAN_DEBUG_EXIT("arlan_close");
-	return 0;
-}
-
-#ifdef ARLAN_DEBUGGING
-static long alignLong(volatile u_char * ptr)
-{
-	long ret;
-	memcpy_fromio(&ret, (void *) ptr, 4);
-	return ret;
-}
-#endif
-
-/*
- * Get the current statistics.
- * This may be called with the card open or closed.
- */
-
-static struct net_device_stats *arlan_statistics(struct net_device *dev)
-{
-	struct arlan_private *priv = (struct arlan_private *) dev->priv;
-	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
-
-
-	ARLAN_DEBUG_ENTRY("arlan_statistics");
-
-	/* Update the statistics from the device registers. */
-
-	READSHM(priv->stats.collisions, arlan->numReTransmissions, u_int);
-	READSHM(priv->stats.rx_crc_errors, arlan->numCRCErrors, u_int);
-	READSHM(priv->stats.rx_dropped, arlan->numFramesDiscarded, u_int);
-	READSHM(priv->stats.rx_fifo_errors, arlan->numRXBufferOverflows, u_int);
-	READSHM(priv->stats.rx_frame_errors, arlan->numReceiveFramesLost, u_int);
-	READSHM(priv->stats.rx_over_errors, arlan->numRXOverruns, u_int);
-	READSHM(priv->stats.rx_packets, arlan->numDatagramsReceived, u_int);
-	READSHM(priv->stats.tx_aborted_errors, arlan->numAbortErrors, u_int);
-	READSHM(priv->stats.tx_carrier_errors, arlan->numStatusTimeouts, u_int);
-	READSHM(priv->stats.tx_dropped, arlan->numDatagramsDiscarded, u_int);
-	READSHM(priv->stats.tx_fifo_errors, arlan->numTXUnderruns, u_int);
-	READSHM(priv->stats.tx_packets, arlan->numDatagramsTransmitted, u_int);
-	READSHM(priv->stats.tx_window_errors, arlan->numHoldOffs, u_int);
-
-	ARLAN_DEBUG_EXIT("arlan_statistics");
-
-	return &priv->stats;
-}
-
-
-static void arlan_set_multicast(struct net_device *dev)
-{
-	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
-	struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf;
-	int board_conf_needed = 0;
-
-
-	ARLAN_DEBUG_ENTRY("arlan_set_multicast");
-
-	if (dev->flags & IFF_PROMISC)
-	{
-		unsigned char recMode;
-		READSHM(recMode, arlan->receiveMode, u_char);
-		conf->receiveMode = (ARLAN_RCV_PROMISC | ARLAN_RCV_CONTROL);
-		if (conf->receiveMode != recMode)
-			board_conf_needed = 1;
-	}
-	else
-	{
-		/* turn off promiscuous mode  */
-		unsigned char recMode;
-		READSHM(recMode, arlan->receiveMode, u_char);
-		conf->receiveMode = ARLAN_RCV_CLEAN | ARLAN_RCV_CONTROL;
-		if (conf->receiveMode != recMode)
-			board_conf_needed = 1;
-	}
-	if (board_conf_needed)
-		arlan_command(dev, ARLAN_COMMAND_CONF);
-
-	ARLAN_DEBUG_EXIT("arlan_set_multicast");
-}
-
-
-int __init arlan_probe(struct net_device *dev)
-{
-	printk("Arlan driver %s\n", arlan_version);
-
-	if (arlan_probe_everywhere(dev))
-		return -ENODEV;
-
-	arlans_found++;
-
-	if (arlans_found == 1)
-		siteName = kmalloc(100, GFP_KERNEL);
-	return 0;
-}
-
-#ifdef  MODULE
-
-static int __init arlan_find_devices(void)
-{
-	int m;
-	int found = 0;
-
-	ARLAN_DEBUG_ENTRY("arlan_find_devices");
-	if (mem != 0 && numDevices == 1)	/* Check a single specified location. */
-		return 1;
-	for (m =(int) phys_to_virt(0xc0000); m <=(int) phys_to_virt(0xDE000); m += 0x2000)
-	{
-		if (arlan_check_fingerprint(m) == 0)
-			found++;
-	}
-	ARLAN_DEBUG_EXIT("arlan_find_devices");
-
-	return found;
-}
-
-int init_module(void)
-{
-	int i = 0;
-
-	ARLAN_DEBUG_ENTRY("init_module");
-
-	if (channelSet != channelSetUNKNOWN || channelNumber != channelNumberUNKNOWN || systemId != systemIdUNKNOWN)
-		return -EINVAL;
-
-	numDevices = arlan_find_devices();
-	if (numDevices == 0)
-		return -ENODEV;
-
-	siteName = kmalloc(100, GFP_KERNEL);
-	if(siteName==NULL)
-		return -ENOMEM;
-
-	for (i = 0; i < numDevices && i < MAX_ARLANS; i++)
-	{
-		if (!arlan_allocate_device(i, NULL))
-			return -ENOMEM;
-
-		if (arlan_device[i] == NULL)
-			return -ENOMEM;
-
-		if (probe)
-			arlan_probe_everywhere(arlan_device[i]);
-//		arlan_command(arlan_device[i], ARLAN_COMMAND_POWERDOWN );
-	}
-	printk(KERN_INFO "Arlan driver %s\n", arlan_version);
-	ARLAN_DEBUG_EXIT("init_module");
-	return 0;
-}
-
-
-void cleanup_module(void)
-{
-	int i = 0;
-	struct arlan_private *ap;
-
-	ARLAN_DEBUG_ENTRY("cleanup_module");
-
-	IFDEBUG(ARLAN_DEBUG_SHUTDOWN)
-		printk(KERN_INFO "arlan: unloading module\n");
-	for (i = 0; i < MAX_ARLANS; i++)
-	{
-		if (arlan_device[i])
-		{
-			arlan_command(arlan_device[i], ARLAN_COMMAND_POWERDOWN );
-
-//			release_mem_region(virt_to_phys(arlan_device[i]->mem_start), 0x2000 );
-			unregister_netdev(arlan_device[i]);
-			ap = arlan_device[i]->priv;
-			if (ap->init_etherdev_alloc) {
-				kfree(arlan_device[i]);
-				arlan_device[i] = NULL;
-			} else {
-				kfree(ap);
-				ap = NULL;
-			}
-		}
-	}
-	ARLAN_DEBUG_EXIT("cleanup_module");
-}
-
-
-#endif
-MODULE_LICENSE("GPL");
diff -Nru a/drivers/net/arlan.h b/drivers/net/arlan.h
--- a/drivers/net/arlan.h	Sun Feb 23 22:25:24 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,577 +0,0 @@
-/*
- *  Copyright (C) 1997 Cullen Jennings
- *  Copyright (C) 1998 Elmer.Joandi@ut.ee, +37-255-13500	
- *  GNU General Public License applies
- */
-#include <linux/version.h>
-
-#include <linux/module.h>
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/skbuff.h>
-#include <linux/if_ether.h>	/* For the statistics structure. */
-#include <linux/if_arp.h>	/* For ARPHRD_ETHER */
-#include <linux/ptrace.h>
-#include <linux/ioport.h>
-#include <linux/in.h>
-#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/timer.h>
-
-#include <linux/init.h>
-#include <asm/system.h>
-#include <asm/bitops.h>
-#include <asm/io.h>
-#include <linux/errno.h>
-#include <linux/delay.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-
-
-//#define ARLAN_DEBUGGING 1
-
-#define ARLAN_PROC_INTERFACE
-#define MAX_ARLANS 4 /* not more than 4 ! */
-#define ARLAN_PROC_SHM_DUMP /* shows all card registers, makes driver way larger */
-
-#define ARLAN_MAX_MULTICAST_ADDRS 16
-#define ARLAN_RCV_CLEAN 	0
-#define ARLAN_RCV_PROMISC 1
-#define ARLAN_RCV_CONTROL 2
-
-
-#ifdef CONFIG_PROC_FS
-extern int 	init_arlan_proc(void);
-#endif
-
-extern struct net_device *arlan_device[MAX_ARLANS];
-extern int	arlan_debug;
-extern char *	siteName;
-extern int	arlan_entry_debug;
-extern int	arlan_exit_debug;
-extern int	testMemory;
-extern const char* arlan_version;
-extern int     arlan_command(struct net_device * dev, int command);
- 
-#define SIDUNKNOWN -1
-#define radioNodeIdUNKNOWN -1
-#define encryptionKeyUNKNOWN '\0';
-#define irqUNKNOWN 0
-#define memUNKNOWN 0
-#define debugUNKNOWN 0
-#define probeUNKNOWN 1
-#define numDevicesUNKNOWN 1
-#define testMemoryUNKNOWN 1
-#define spreadingCodeUNKNOWN 0
-#define channelNumberUNKNOWN 0
-#define channelSetUNKNOWN 0
-#define systemIdUNKNOWN -1
-#define registrationModeUNKNOWN -1
-#define siteNameUNKNOWN "LinuxSite"
-
-
-
-#define IFDEBUG( L ) if ( (L) & arlan_debug ) 
-#define ARLAN_FAKE_HDR_LEN 12 
-
-#ifdef ARLAN_DEBUGGING
-	#define DEBUG 1
-	#define ARLAN_ENTRY_EXIT_DEBUGGING 1
-	#define ARLAN_DEBUG(a,b) printk(KERN_DEBUG a, b)
-#else
-	#define ARLAN_DEBUG(a,b) 
-#endif
-
-struct arlan_shmem
-{
-      /* Header Signature */ 
-      volatile	char textRegion[48];
-      volatile	u_char resetFlag;
-      volatile	u_char  diagnosticInfo;
-      volatile	u_short diagnosticOffset;
-      volatile	u_char _1[12];
-      volatile	u_char lanCardNodeId[6];
-      volatile	u_char broadcastAddress[6];
-      volatile	u_char hardwareType;
-      volatile	u_char majorHardwareVersion;
-      volatile	u_char minorHardwareVersion;
-      volatile	u_char radioModule;// shows EEPROM, can be overridden at 0x111
-      volatile	u_char defaultChannelSet; // shows EEProm, can be overriiden at 0x10A
-      volatile	u_char _2[47];
-      
-      /* Control/Status Block - 0x0080 */
-      volatile	u_char interruptInProgress; /* not used by lancpu */
-      volatile	u_char cntrlRegImage; /* not used by lancpu */
-      volatile	u_char _3[13];
-      volatile	u_char dumpByte;
-      volatile	u_char commandByte; /* non-zero = active */
-      volatile	u_char commandParameter[15];
-
-      /* Receive Status - 0x00a0 */
-      volatile	u_char rxStatus; /* 1- data, 2-control, 0xff - registr change */
-      volatile	u_char rxFrmType;
-      volatile	u_short rxOffset;
-      volatile	u_short rxLength;
-      volatile	u_char rxSrc[6];
-      volatile	u_char rxBroadcastFlag;
-      volatile	u_char rxQuality;
-      volatile	u_char scrambled;
-      volatile	u_char _4[1];
-      
-      /* Transmit Status - 0x00b0 */
-      volatile	u_char txStatus;
-      volatile	u_char txAckQuality;
-      volatile	u_char numRetries;
-      volatile	u_char _5[14];
-      volatile	u_char registeredRouter[6];
-      volatile	u_char backboneRouter[6];
-      volatile	u_char registrationStatus;
-      volatile	u_char configuredStatusFlag;
-      volatile	u_char _6[1];
-      volatile	u_char ultimateDestAddress[6];
-      volatile	u_char immedDestAddress[6];
-      volatile	u_char immedSrcAddress[6];
-      volatile	u_short rxSequenceNumber;
-      volatile	u_char assignedLocaltalkAddress;
-      volatile	u_char _7[27];
-
-      /* System Parameter Block */
-
-      /* - Driver Parameters (Novell Specific) */
-
-      volatile	u_short txTimeout;
-      volatile	u_short transportTime;
-      volatile	u_char _8[4];
-
-      /* - Configuration Parameters */
-      volatile	u_char irqLevel;
-      volatile	u_char spreadingCode;
-      volatile	u_char channelSet;
-      volatile	u_char channelNumber;
-      volatile	u_short radioNodeId;
-      volatile	u_char _9[2];
-      volatile	u_char scramblingDisable;
-      volatile	u_char radioType;
-      volatile	u_short routerId;
-      volatile	u_char _10[9];
-      volatile	u_char txAttenuation;
-      volatile	u_char systemId[4]; 
-      volatile	u_short globalChecksum;
-      volatile	u_char _11[4];
-      volatile	u_short maxDatagramSize;
-      volatile	u_short maxFrameSize;
-      volatile	u_char maxRetries;
-      volatile	u_char receiveMode;
-      volatile	u_char priority;
-      volatile	u_char rootOrRepeater;
-      volatile	u_char specifiedRouter[6];
-      volatile	u_short fastPollPeriod;
-      volatile	u_char pollDecay;
-      volatile	u_char fastPollDelay[2];
-      volatile	u_char arlThreshold;
-      volatile	u_char arlDecay;
-      volatile	u_char _12[1];
-      volatile	u_short specRouterTimeout;
-      volatile	u_char _13[5];
-
-      /* Scrambled Area */
-      volatile	u_char SID[4];
-      volatile	u_char encryptionKey[12];
-      volatile	u_char _14[2];
-      volatile	u_char waitTime[2];
-      volatile	u_char lParameter[2];
-      volatile	u_char _15[3];
-      volatile	u_short headerSize;
-      volatile	u_short sectionChecksum;
-
-      volatile	u_char registrationMode;
-      volatile	u_char registrationFill;
-      volatile	u_short pollPeriod;
-      volatile	u_short refreshPeriod;
-      volatile	u_char name[16];
-      volatile	u_char NID[6];
-      volatile	u_char localTalkAddress;
-      volatile	u_char codeFormat;
-      volatile	u_char numChannels;
-      volatile	u_char channel1;
-      volatile	u_char channel2;
-      volatile	u_char channel3;
-      volatile	u_char channel4;
-      volatile	u_char SSCode[59];
-
-      volatile	u_char _16[0xC0];
-      volatile	u_short auxCmd;
-      volatile	u_char  dumpPtr[4];
-      volatile	u_char dumpVal;
-      volatile	u_char _17[0x6A];
-      volatile	u_char wireTest;
-      volatile	u_char _18[14];
-
-      /* Statistics Block - 0x0300 */
-      volatile	u_char hostcpuLock;
-      volatile	u_char lancpuLock;
-      volatile	u_char resetTime[18];
-      
-      volatile	u_char numDatagramsTransmitted[4];
-      volatile	u_char numReTransmissions[4];
-      volatile	u_char numFramesDiscarded[4];
-      volatile	u_char numDatagramsReceived[4];
-      volatile	u_char numDuplicateReceivedFrames[4];
-      volatile	u_char numDatagramsDiscarded[4];
-      
-      volatile	u_short maxNumReTransmitDatagram;
-      volatile	u_short maxNumReTransmitFrames;
-      volatile	u_short maxNumConsecutiveDuplicateFrames;
-      /* misaligned here so we have to go to characters */
-     
-      volatile	u_char numBytesTransmitted[4];
-      volatile	u_char numBytesReceived[4];
-      volatile	u_char numCRCErrors[4];
-      volatile	u_char numLengthErrors[4];
-      volatile	u_char numAbortErrors[4];
-      volatile	u_char numTXUnderruns[4];
-      volatile	u_char numRXOverruns[4];
-      volatile	u_char numHoldOffs[4];
-      volatile	u_char numFramesTransmitted[4];
-      volatile	u_char numFramesReceived[4];
-      volatile	u_char numReceiveFramesLost[4];
-      volatile	u_char numRXBufferOverflows[4];
-      volatile	u_char numFramesDiscardedAddrMismatch[4];
-      volatile	u_char numFramesDiscardedSIDMismatch[4];
-      volatile	u_char numPollsTransmistted[4];
-      volatile	u_char numPollAcknowledges[4];
-      volatile	u_char numStatusTimeouts[4];
-      volatile	u_char numNACKReceived[4];
-
-      volatile	u_char _19[0x86];
-
-      volatile	u_char txBuffer[0x800];
-      volatile	u_char rxBuffer[0x800];
-
-      volatile	u_char _20[0x800];
-      volatile	u_char _21[0x3fb];
-      volatile	u_char configStatus;
-      volatile	u_char _22;
-      volatile	u_char progIOCtrl;
-      volatile	u_char shareMBase;
-      volatile	u_char controlRegister;
-};
-
-struct arlan_conf_stru {
-      int spreadingCode;
-      int channelSet;
-      int channelNumber;
-      int scramblingDisable;
-      int txAttenuation;
-      int systemId; 
-      int maxDatagramSize;
-      int maxFrameSize;
-      int maxRetries;
-      int receiveMode;
-      int priority;
-      int rootOrRepeater;
-      int SID;
-      int radioNodeId;
-      int registrationMode;
-      int registrationFill;
-      int localTalkAddress;
-      int codeFormat;
-      int numChannels;
-      int channel1;
-      int channel2;
-      int channel3;
-      int channel4;
-      int txClear;
-      int txRetries;
-      int txRouting;
-      int txScrambled;
-      int rxParameter;
-      int txTimeoutMs;
-      int txAckTimeoutMs;
-      int waitCardTimeout;
-      int	waitTime;
-      int	lParameter;
-      int	_15;
-      int	headerSize;
-      int async;
-      int retries;
-      int tx_delay_ms;
-      int waitReTransmitPacketMaxSize;
-      int ReTransmitPacketMaxSize;
-      int fastReTransCount;
-      int driverRetransmissions;
-      int registrationInterrupts;
-      int hardwareType;
-      int radioType;
-      int writeRadioType;
-      int writeEEPROM;
-      char siteName[17];
-      int measure_rate;
-      int in_speed;
-      int out_speed;
-      int in_speed10;
-      int out_speed10;
-      int in_speed_max;
-      int out_speed_max;
-      int pre_Command_Wait;
-      int rx_tweak1;
-      int rx_tweak2;
-      int tx_queue_len;
-};
-
-extern struct arlan_conf_stru arlan_conf[MAX_ARLANS];
-
-struct TxParam
-{
-      volatile	short 		offset;
-      volatile 	short 		length;
-      volatile	u_char 		dest[6];
-      volatile	unsigned	char clear;
-      volatile	unsigned	char retries;
-      volatile	unsigned	char routing;
-      volatile	unsigned	char scrambled;
-};
-
-struct TxRingPoint  {
-	struct TxParam txParam;
-	
-	
-};
-
-#define TX_RING_SIZE 2
-/* Information that need to be kept for each board. */
-struct arlan_private {
-      struct net_device_stats stats;
-      long open_time;			/* Useless example local info. */
-      struct arlan_shmem * card;
-      struct arlan_shmem * conf;
-      struct TxParam txParam;      
-      int multicastLength;
-      char  multicastList[ARLAN_MAX_MULTICAST_ADDRS][6];
-      int promiscModeEnabled;
-      struct arlan_conf_stru * Conf;	     
-      int	bad;
-      int 	reset;
-      long long lastReset;
-      struct timer_list timer;
-      struct timer_list tx_delay_timer;
-      struct timer_list tx_retry_timer;
-      struct timer_list rx_check_timer;
-      struct semaphore card_lock;
-      atomic_t 	card_users;
-      atomic_t	delay_on;
-      atomic_t  retr_on;
-      int registrationLostCount;
-      int reRegisterExp;
-      int nof_tx;
-      int nof_tx_ack;
-      int last_nof_tx;
-      int last_nof_tx_ack;
-      int irq_test_done;
-      int last_command_was_rx;
-      struct TxParam txRing[TX_RING_SIZE];
-      char reTransmitBuff[0x800];
-      volatile int txLast;
-      volatile int txNew;
-      volatile int txOffset;
-      volatile char ReTransmitRequested;
-      volatile long long tx_done_delayed;
-      volatile long long registrationLastSeen;
-      volatile char under_command;
-      volatile char under_toggle;
-      volatile long long tx_last_sent;
-      volatile long long tx_last_cleared;
-      volatile u_char under_tx;
-      volatile int 	retransmissions;
-      volatile int	tx_chain_active;
-      volatile int 	timer_chain_active;
-      volatile int 	interrupt_ack_requested;
-      volatile long	command_lock;
-      volatile int	rx_command_needed;
-      volatile int	tx_command_needed;
-      volatile int 	waiting_command_mask;
-      volatile int 	card_polling_interval;
-      volatile int 	last_command_buff_free_time;
-      volatile int	numResets;
-      volatile int 	under_reset;
-      volatile int 	under_config;
-      volatile int 	rx_command_given;
-      volatile long 	tx_command_given;
-      volatile long	interrupt_processing_active;
-      volatile long long 	last_tx_time;
-      volatile long long	last_rx_time;
-      volatile long long	last_rx_int_ack_time;
-      int	in_bytes;
-      int	out_bytes;
-      int	in_time;
-      int	out_time;
-      int	in_time10;
-      int	out_time10;
-      int	in_bytes10;
-      int	out_bytes10;
-      int	init_etherdev_alloc;
-};
-
-
-
-#define ARLAN_CLEAR		0x00
-#define ARLAN_RESET 		0x01
-#define ARLAN_CHANNEL_ATTENTION 0x02
-#define ARLAN_INTERRUPT_ENABLE 	0x04
-#define ARLAN_CLEAR_INTERRUPT 	0x08
-#define ARLAN_POWER 		0x40
-#define ARLAN_ACCESS		0x80
-
-#define ARLAN_COM_CONF                0x01
-#define ARLAN_COM_RX_ENABLE           0x03
-#define ARLAN_COM_RX_ABORT            0x04
-#define ARLAN_COM_TX_ENABLE           0x05
-#define ARLAN_COM_TX_ABORT            0x06
-#define ARLAN_COM_NOP		      0x07
-#define ARLAN_COM_STANDBY             0x08
-#define ARLAN_COM_ACTIVATE            0x09
-#define ARLAN_COM_GOTO_SLOW_POLL      0x0a
-#define ARLAN_COM_INT                 0x80
-
-
-#define TXLAST(dev) (((struct arlan_private *)dev->priv)->txRing[((struct arlan_private *)dev->priv)->txLast])
-#define TXHEAD(dev) (((struct arlan_private *)dev->priv)->txRing[0])
-#define TXTAIL(dev) (((struct arlan_private *)dev->priv)->txRing[1])
-
-#define TXBuffStart(dev) \
- ((int)(((struct arlan_private *)dev->priv)->card)->txBuffer) - ((int)(((struct arlan_private *)dev->priv)->card) )
-#define TXBuffEnd(dev) \
- ((int)(((struct arlan_private *)dev->priv)->card)->rxBuffer) - ((int)(((struct arlan_private *)dev->priv)->card)
- 
-#define READSHM(to,from,atype) {\
-	atype tmp;\
-	memcpy_fromio(&(tmp),&(from),sizeof(atype));\
-	to = tmp;\
-	}
-
-#define READSHMEM(from,atype)\
-	atype from; \
-	READSHM(from, arlan->from, atype);
-
-#define WRITESHM(to,from,atype) \
-	{ atype tmpSHM = from;\
-	memcpy_toio(&(to),&tmpSHM,sizeof(atype));\
-	}
-
-#define DEBUGSHM(levelSHM,stringSHM,stuff,atype) \
-	{	atype tmpSHM; \
-		memcpy_fromio(&tmpSHM,&(stuff),sizeof(atype));\
-		IFDEBUG(levelSHM) printk(stringSHM,tmpSHM);\
-	}
-
-#define WRITESHMB(to, val) \
-	writeb(val,&(to))
-#define READSHMB(to) \
-	readb(&(to))
-#define WRITESHMS(to, val) \
-	writew(val,&(to))
-#define READSHMS(to) \
-	readw(&(to))
-#define WRITESHMI(to, val) \
-	writel(val,&(to))
-#define READSHMI(to) \
-	readl(&(to))
-
-
-
-
-
-#define registrationBad(dev)\
-   ( (   READSHMB(((struct arlan_private *)dev->priv)->card->registrationMode)    > 0) && \
-     (   READSHMB(((struct arlan_private *)dev->priv)->card->registrationStatus) == 0)    )
-
-
-#define readControlRegister(dev)\
- 	READSHMB(((struct arlan_private *)dev->priv)->card->cntrlRegImage)
-
-#define writeControlRegister(dev, v){\
-   WRITESHMB(((struct arlan_private *)dev->priv)->card->cntrlRegImage	,((v) &0xF) );\
-   WRITESHMB(((struct arlan_private *)dev->priv)->card->controlRegister	,(v) 	);}
-
-
-#define arlan_interrupt_lancpu(dev) {\
-   int cr;   \
-   \
-   priv->under_toggle++;   \
-   cr = readControlRegister(dev);\
-   if (cr & ARLAN_CHANNEL_ATTENTION){ \
-      writeControlRegister(dev, (cr & ~ARLAN_CHANNEL_ATTENTION));\
-   }else  \
-      writeControlRegister(dev, (cr | ARLAN_CHANNEL_ATTENTION));\
-   priv->under_toggle=0;     \
-}
-
-#define clearChannelAttention(dev){ \
-   writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_CHANNEL_ATTENTION);}
-#define setHardwareReset(dev) {\
-   writeControlRegister(dev,readControlRegister(dev) | ARLAN_RESET);}
-#define clearHardwareReset(dev) {\
-   writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_RESET);}
-#define setInterruptEnable(dev){\
-   writeControlRegister(dev,readControlRegister(dev) | ARLAN_INTERRUPT_ENABLE)  ;}
-#define clearInterruptEnable(dev){\
-   writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_INTERRUPT_ENABLE)  ;}
-#define setClearInterrupt(dev){\
-   writeControlRegister(dev,readControlRegister(dev) | ARLAN_CLEAR_INTERRUPT)   ;}
-#define clearClearInterrupt(dev){\
-   writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_CLEAR_INTERRUPT);}
-#define setPowerOff(dev){\
-   writeControlRegister(dev,readControlRegister(dev) | (ARLAN_POWER && ARLAN_ACCESS));\
-   writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_ACCESS);}
-#define setPowerOn(dev){\
-   writeControlRegister(dev,readControlRegister(dev) & ~(ARLAN_POWER));   }
-#define arlan_lock_card_access(dev){\
-   writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_ACCESS);}
-#define arlan_unlock_card_access(dev){\
-   writeControlRegister(dev,readControlRegister(dev) | ARLAN_ACCESS ); }  
-
-
-
-
-#define ARLAN_COMMAND_RX		0x000001
-#define ARLAN_COMMAND_NOOP		0x000002
-#define ARLAN_COMMAND_NOOPINT		0x000004
-#define ARLAN_COMMAND_TX		0x000008
-#define ARLAN_COMMAND_CONF		0x000010
-#define ARLAN_COMMAND_RESET		0x000020
-#define ARLAN_COMMAND_TX_ABORT		0x000040
-#define ARLAN_COMMAND_RX_ABORT		0x000080
-#define ARLAN_COMMAND_POWERDOWN		0x000100
-#define ARLAN_COMMAND_POWERUP		0x000200
-#define ARLAN_COMMAND_SLOW_POLL 	0x000400
-#define ARLAN_COMMAND_ACTIVATE 		0x000800
-#define ARLAN_COMMAND_INT_ACK		0x001000
-#define ARLAN_COMMAND_INT_ENABLE	0x002000
-#define ARLAN_COMMAND_WAIT_NOW		0x004000
-#define ARLAN_COMMAND_LONG_WAIT_NOW	0x008000
-#define ARLAN_COMMAND_STANDBY		0x010000
-#define ARLAN_COMMAND_INT_RACK		0x020000
-#define ARLAN_COMMAND_INT_RENABLE	0x040000
-#define ARLAN_COMMAND_CONF_WAIT		0x080000
-#define ARLAN_COMMAND_TBUSY_CLEAR	0x100000
-#define ARLAN_COMMAND_CLEAN_AND_CONF	(ARLAN_COMMAND_TX_ABORT\
-					| ARLAN_COMMAND_RX_ABORT\
-					| ARLAN_COMMAND_CONF)
-#define ARLAN_COMMAND_CLEAN_AND_RESET   (ARLAN_COMMAND_TX_ABORT\
-					| ARLAN_COMMAND_RX_ABORT\
-					| ARLAN_COMMAND_RESET)
-
-
- 
-#define ARLAN_DEBUG_CHAIN_LOCKS		0x00001
-#define ARLAN_DEBUG_RESET		0x00002
-#define ARLAN_DEBUG_TIMING		0x00004
-#define ARLAN_DEBUG_CARD_STATE		0x00008
-#define ARLAN_DEBUG_TX_CHAIN		0x00010
-#define ARLAN_DEBUG_MULTICAST		0x00020
-#define ARLAN_DEBUG_HEADER_DUMP		0x00040
-#define ARLAN_DEBUG_INTERRUPT		0x00080
-#define ARLAN_DEBUG_STARTUP		0x00100
-#define ARLAN_DEBUG_SHUTDOWN		0x00200
- 
diff -Nru a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
--- a/drivers/net/au1000_eth.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/net/au1000_eth.c	Sun Feb 23 22:25:24 2003
@@ -110,7 +110,7 @@
 
 
 /*
- * Base address and interupt of the Au1xxx ethernet macs
+ * Base address and interrupt of the Au1xxx ethernet macs
  */
 static struct {
 	unsigned int port;
@@ -465,7 +465,7 @@
 
 		mii_status = mdio_read(dev, phy_addr, MII_STATUS);
 		if (mii_status == 0xffff || mii_status == 0x0000)
-			/* the mii is not accessable, try next one */
+			/* the mii is not accessible, try next one */
 			continue;
 
 		phy_id0 = mdio_read(dev, phy_addr, MII_PHY_ID0);
diff -Nru a/drivers/net/bonding.c b/drivers/net/bonding.c
--- a/drivers/net/bonding.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/net/bonding.c	Sun Feb 23 22:25:26 2003
@@ -2547,7 +2547,7 @@
 
 /* 
  * in XOR mode, we determine the output device by performing xor on
- * the source and destination hw adresses.  If this device is not 
+ * the source and destination hw addresses.  If this device is not 
  * enabled, find the next slave following this xor slave. 
  */
 static int bond_xmit_xor(struct sk_buff *skb, struct net_device *dev)
diff -Nru a/drivers/net/dgrs_plx9060.h b/drivers/net/dgrs_plx9060.h
--- a/drivers/net/dgrs_plx9060.h	Sun Feb 23 22:25:24 2003
+++ b/drivers/net/dgrs_plx9060.h	Sun Feb 23 22:25:24 2003
@@ -18,7 +18,7 @@
 #define	PCI_INT_LINE		0x3C
 
 /*
- *	Registers accessable directly from PCI and local side.
+ *	Registers accessible directly from PCI and local side.
  *	Offset is from PCI side.  Add PLX_LCL_OFFSET for local address.
  */
 #define	PLX_LCL_OFFSET	0x80	/* Offset of regs from local side */
diff -Nru a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
--- a/drivers/net/e1000/e1000_main.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/net/e1000/e1000_main.c	Sun Feb 23 22:25:23 2003
@@ -1150,7 +1150,7 @@
  *
  * The set_multi entry point is called whenever the multicast address
  * list or the network interface flags are updated.  This routine is
- * resposible for configuring the hardware for proper multicast,
+ * responsible for configuring the hardware for proper multicast,
  * promiscuous mode, and all-multi behavior.
  **/
 
diff -Nru a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
--- a/drivers/net/irda/vlsi_ir.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/net/irda/vlsi_ir.c	Sun Feb 23 22:25:21 2003
@@ -26,7 +26,6 @@
 MODULE_DESCRIPTION("IrDA SIR/MIR/FIR driver for VLSI 82C147");
 MODULE_AUTHOR("Martin Diehl <info@mdiehl.de>");
 MODULE_LICENSE("GPL");
-EXPORT_NO_SYMBOLS;
 
 #define DRIVER_NAME "vlsi_ir"
 #define DRIVER_VERSION "v0.4"
diff -Nru a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
--- a/drivers/net/lasi_82596.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/net/lasi_82596.c	Sun Feb 23 22:25:22 2003
@@ -181,7 +181,6 @@
 MODULE_LICENSE("GPL");
 MODULE_PARM(i596_debug, "i");
 MODULE_PARM_DESC(i596_debug, "lasi_82596 debug mask");
-EXPORT_NO_SYMBOLS;
 
 /* Copy frames shorter than rx_copybreak, otherwise pass on up in
  * a full sized sk_buff.  Value of 100 stolen from tulip.c (!alpha).
diff -Nru a/drivers/net/natsemi.c b/drivers/net/natsemi.c
--- a/drivers/net/natsemi.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/net/natsemi.c	Sun Feb 23 22:25:21 2003
@@ -2608,7 +2608,7 @@
 			if (wol) {
 				/* restart the NIC in WOL mode.
 				 * The nic must be stopped for this.
-				 * FIXME: use the WOL interupt
+				 * FIXME: use the WOL interrupt
 				 */
 				enable_wol_mode(dev, 0);
 			} else {
diff -Nru a/drivers/net/pcmcia/Kconfig b/drivers/net/pcmcia/Kconfig
--- a/drivers/net/pcmcia/Kconfig	Sun Feb 23 22:25:25 2003
+++ b/drivers/net/pcmcia/Kconfig	Sun Feb 23 22:25:25 2003
@@ -153,34 +153,6 @@
 	  The module will be called ibmtr_cs.  If you want to compile it as
 	  a module, say M here and read <file:Documentation/modules.txt>.
 
-config NET_PCMCIA_RADIO
-	bool "Pcmcia Wireless LAN"
-	depends on NET_PCMCIA
-	help
-	  Say Y here if you would like to use a PCMCIA (PC-card) device to
-	  connect to a wireless local area network. Then say Y to the driver
-	  for your particular card below.
-
-	  To use your PC-cards, you will need supporting software from David
-	  Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>
-	  for location). You also want to check out the PCMCIA-HOWTO,
-	  available from <http://www.linuxdoc.org/docs.html#howto>.
-
-config PCMCIA_RAYCS
-	tristate "Aviator/Raytheon 2.4MHz wireless support"
-	depends on NET_PCMCIA_RADIO && PCMCIA
-	---help---
-	  Say Y here if you intend to attach an Aviator/Raytheon PCMCIA
-	  (PC-card) wireless Ethernet networking card to your computer.
-	  Please read the file <file:Documentation/networking/ray_cs.txt> for
-	  details.
-
-	  This driver is also available as a module ( = code which can be
-	  inserted in and removed from the running kernel whenever you want).
-	  The module will be called ray_cs.  If you want to compile it as a
-	  module, say M here and read <file:Documentation/modules.txt>.  If
-	  unsure, say N.
-
 config AIRONET4500_CS
 	tristate "Aironet 4500/4800 PCMCIA support"
 	depends on NET_PCMCIA_RADIO && AIRONET4500 && PCMCIA
diff -Nru a/drivers/net/pcmcia/Makefile b/drivers/net/pcmcia/Makefile
--- a/drivers/net/pcmcia/Makefile	Sun Feb 23 22:25:21 2003
+++ b/drivers/net/pcmcia/Makefile	Sun Feb 23 22:25:21 2003
@@ -14,7 +14,6 @@
 obj-$(CONFIG_PCMCIA_AXNET)	+= axnet_cs.o
 
 # 16-bit wireless client drivers
-obj-$(CONFIG_PCMCIA_RAYCS)	+= ray_cs.o
 obj-$(CONFIG_AIRONET4500_CS)	+= aironet4500_cs.o
 
 obj-$(CONFIG_PCMCIA_IBMTR)	+= ibmtr_cs.o
diff -Nru a/drivers/net/pcmcia/ray_cs.c b/drivers/net/pcmcia/ray_cs.c
--- a/drivers/net/pcmcia/ray_cs.c	Sun Feb 23 22:25:23 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,3012 +0,0 @@
-/*=============================================================================
- *
- * A  PCMCIA client driver for the Raylink wireless LAN card.
- * The starting point for this module was the skeleton.c in the
- * PCMCIA 2.9.12 package written by David Hinds, dahinds@users.sourceforge.net
- *
- *
- * Copyright (c) 1998  Corey Thomas (corey@world.std.com)
- *
- * This driver is free software; you can redistribute it and/or modify
- * it under the terms of version 2 only of the GNU General Public License as 
- * published by the Free Software Foundation.
- *
- * It is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * Changes:
- * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/08/2000
- * - reorganize kmallocs in ray_attach, checking all for failure
- *   and releasing the previous allocations if one fails
- *
- * 
-=============================================================================*/
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/proc_fs.h>
-#include <linux/ptrace.h>
-#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/timer.h>
-#include <linux/init.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/if_arp.h>
-#include <linux/ioport.h>
-#include <linux/skbuff.h>
-#include <linux/ethtool.h>
-
-#include <pcmcia/version.h>
-#include <pcmcia/cs_types.h>
-#include <pcmcia/cs.h>
-#include <pcmcia/cistpl.h>
-#include <pcmcia/cisreg.h>
-#include <pcmcia/ds.h>
-#include <pcmcia/mem_op.h>
-
-#ifdef CONFIG_NET_PCMCIA_RADIO
-#include <linux/wireless.h>
-
-#include <asm/io.h>
-#include <asm/system.h>
-#include <asm/byteorder.h>
-#include <asm/uaccess.h>
-
-/* Warning : these stuff will slow down the driver... */
-#define WIRELESS_SPY		/* Enable spying addresses */
-/* Definitions we need for spy */
-typedef struct iw_statistics	iw_stats;
-typedef struct iw_quality	iw_qual;
-typedef u_char	mac_addr[ETH_ALEN];	/* Hardware address */
-#endif	/* CONFIG_NET_PCMCIA_RADIO */
-
-#include "rayctl.h"
-#include "ray_cs.h"
-
-/* All the PCMCIA modules use PCMCIA_DEBUG to control debugging.  If
-   you do not define PCMCIA_DEBUG at all, all the debug code will be
-   left out.  If you compile with PCMCIA_DEBUG=0, the debug code will
-   be present but disabled -- but it can then be enabled for specific
-   modules at load time with a 'pc_debug=#' option to insmod.
-*/
-
-#ifdef RAYLINK_DEBUG
-#define PCMCIA_DEBUG RAYLINK_DEBUG
-#endif
-#ifdef PCMCIA_DEBUG
-static int ray_debug;
-static int pc_debug = PCMCIA_DEBUG;
-MODULE_PARM(pc_debug, "i");
-/* #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); */
-#define DEBUG(n, args...) if (pc_debug>(n)) printk(args);
-#else
-#define DEBUG(n, args...)
-#endif
-/** Prototypes based on PCMCIA skeleton driver *******************************/
-static void ray_config(dev_link_t *link);
-static void ray_release(u_long arg);
-static int ray_event(event_t event, int priority, event_callback_args_t *args);
-static dev_link_t *ray_attach(void);
-static void ray_detach(dev_link_t *);
-
-/***** Prototypes indicated by device structure ******************************/
-static int ray_dev_close(struct net_device *dev);
-static int ray_dev_config(struct net_device *dev, struct ifmap *map);
-static struct net_device_stats *ray_get_stats(struct net_device *dev);
-static int ray_dev_init(struct net_device *dev);
-static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
-static int ray_open(struct net_device *dev);
-static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev);
-static void set_multicast_list(struct net_device *dev);
-static void ray_update_multi_list(struct net_device *dev, int all);
-static int translate_frame(ray_dev_t *local, struct tx_msg *ptx,
-                unsigned char *data, int len);
-static void ray_build_header(ray_dev_t *local, struct tx_msg *ptx, UCHAR msg_type,
-                unsigned char *data);
-static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len);
-#if WIRELESS_EXT > 7	/* If wireless extension exist in the kernel */
-static iw_stats * ray_get_wireless_stats(struct net_device *	dev);
-#endif	/* WIRELESS_EXT > 7 */
-
-/***** Prototypes for raylink functions **************************************/
-static int asc_to_int(char a);
-static void authenticate(ray_dev_t *local);
-static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type);
-static void authenticate_timeout(u_long);
-static int get_free_ccs(ray_dev_t *local);
-static int get_free_tx_ccs(ray_dev_t *local);
-static void init_startup_params(ray_dev_t *local);
-static int parse_addr(char *in_str, UCHAR *out);
-static int ray_hw_xmit(unsigned char* data, int len, struct net_device* dev, UCHAR type);
-static int ray_init(struct net_device *dev);
-static int interrupt_ecf(ray_dev_t *local, int ccs);
-static void ray_reset(struct net_device *dev);
-static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len);
-static void verify_dl_startup(u_long);
-
-/* Prototypes for interrpt time functions **********************************/
-static void ray_interrupt (int reg, void *dev_id, struct pt_regs *regs);
-static void clear_interrupt(ray_dev_t *local);
-static void rx_deauthenticate(ray_dev_t *local, struct rcs *prcs, 
-                       unsigned int pkt_addr, int rx_len);
-static int copy_from_rx_buff(ray_dev_t *local, UCHAR *dest, int pkt_addr, int len);
-static void ray_rx(struct net_device *dev, ray_dev_t *local, struct rcs *prcs);
-static void release_frag_chain(ray_dev_t *local, struct rcs *prcs);
-static void rx_authenticate(ray_dev_t *local, struct rcs *prcs,
-                     unsigned int pkt_addr, int rx_len);
-static void rx_data(struct net_device *dev, struct rcs *prcs, unsigned int pkt_addr, 
-             int rx_len);
-static void associate(ray_dev_t *local);
-
-/* Card command functions */
-static int dl_startup_params(struct net_device *dev);
-static void join_net(u_long local);
-static void start_net(u_long local);
-/* void start_net(ray_dev_t *local); */
-
-/* Create symbol table for registering with kernel in init_module */
-EXPORT_SYMBOL(ray_dev_ioctl);
-EXPORT_SYMBOL(ray_rx);
-
-/*===========================================================================*/
-/* Parameters that can be set with 'insmod' */
-/* Bit map of interrupts to choose from */
-/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, and 3 */
-static u_long irq_mask = 0xdeb8;
-
-/* ADHOC=0, Infrastructure=1 */
-static int net_type = ADHOC;
-
-/* Hop dwell time in Kus (1024 us units defined by 802.11) */
-static int hop_dwell = 128;
-
-/* Beacon period in Kus */
-static int beacon_period = 256;
-
-/* power save mode (0 = off, 1 = save power) */
-static int psm;
-
-/* String for network's Extended Service Set ID. 32 Characters max */
-static char *essid;
-
-/* Default to encapsulation unless translation requested */
-static int translate = 1;
-
-static int country = USA;
-
-static int sniffer;
-
-static int bc;
-
-/* 48 bit physical card address if overriding card's real physical
- * address is required.  Since IEEE 802.11 addresses are 48 bits
- * like ethernet, an int can't be used, so a string is used. To
- * allow use of addresses starting with a decimal digit, the first
- * character must be a letter and will be ignored. This letter is
- * followed by up to 12 hex digits which are the address.  If less
- * than 12 digits are used, the address will be left filled with 0's.
- * Note that bit 0 of the first byte is the broadcast bit, and evil
- * things will happen if it is not 0 in a card address.
- */
-static char *phy_addr = NULL;
-
-
-/* The dev_info variable is the "key" that is used to match up this
-   device driver with appropriate cards, through the card configuration
-   database.
-*/
-static dev_info_t dev_info = "ray_cs";
-
-/* A linked list of "instances" of the ray device.  Each actual
-   PCMCIA card corresponds to one device instance, and is described
-   by one dev_link_t structure (defined in ds.h).
-*/
-static dev_link_t *dev_list = NULL;
-
-/* A dev_link_t structure has fields for most things that are needed
-   to keep track of a socket, but there will usually be some device
-   specific information that also needs to be kept track of.  The
-   'priv' pointer in a dev_link_t structure can be used to point to
-   a device-specific private data structure, like this.
-*/
-static unsigned int ray_mem_speed = 500;
-
-MODULE_AUTHOR("Corey Thomas <corey@world.std.com>");
-MODULE_DESCRIPTION("Raylink/WebGear wireless LAN driver");
-MODULE_LICENSE("GPL");
-
-MODULE_PARM(irq_mask,"i");
-MODULE_PARM(net_type,"i");
-MODULE_PARM(hop_dwell,"i");
-MODULE_PARM(beacon_period,"i");
-MODULE_PARM(psm,"i");
-MODULE_PARM(essid,"s");
-MODULE_PARM(translate,"i");
-MODULE_PARM(country,"i");
-MODULE_PARM(sniffer,"i");
-MODULE_PARM(bc,"i");
-MODULE_PARM(phy_addr,"s");
-MODULE_PARM(ray_mem_speed, "i");
-
-static UCHAR b5_default_startup_parms[] = {
-    0,   0,                         /* Adhoc station */
-   'L','I','N','U','X', 0,  0,  0,  /* 32 char ESSID */
-    0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,
-    1,  0,                          /* Active scan, CA Mode */
-    0,  0,  0,  0,  0,  0,          /* No default MAC addr  */
-    0x7f, 0xff,                     /* Frag threshold */
-    0x00, 0x80,                     /* Hop time 128 Kus*/
-    0x01, 0x00,                     /* Beacon period 256 Kus */
-    0x01, 0x07, 0xa3,               /* DTIM, retries, ack timeout*/
-    0x1d, 0x82, 0x4e,               /* SIFS, DIFS, PIFS */
-    0x7f, 0xff,                     /* RTS threshold */
-    0x04, 0xe2, 0x38, 0xA4,         /* scan_dwell, max_scan_dwell */
-    0x05,                           /* assoc resp timeout thresh */
-    0x08, 0x02, 0x08,               /* adhoc, infra, super cycle max*/
-    0,                              /* Promiscuous mode */
-    0x0c, 0x0bd,                    /* Unique word */
-    0x32,                           /* Slot time */
-    0xff, 0xff,                     /* roam-low snr, low snr count */
-    0x05, 0xff,                     /* Infra, adhoc missed bcn thresh */
-    0x01, 0x0b, 0x4f,               /* USA, hop pattern, hop pat length */
-/* b4 - b5 differences start here */
-    0x00, 0x3f,                     /* CW max */
-    0x00, 0x0f,                     /* CW min */
-    0x04, 0x08,                     /* Noise gain, limit offset */
-    0x28, 0x28,                     /* det rssi, med busy offsets */
-    7,                              /* det sync thresh */
-    0, 2, 2,                        /* test mode, min, max */
-    0,                              /* allow broadcast SSID probe resp */
-    0, 0,                           /* privacy must start, can join */
-    2, 0, 0, 0, 0, 0, 0, 0          /* basic rate set */
-};
-
-static UCHAR b4_default_startup_parms[] = {
-    0,   0,                         /* Adhoc station */
-   'L','I','N','U','X', 0,  0,  0,  /* 32 char ESSID */
-    0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,
-    1,  0,                          /* Active scan, CA Mode */
-    0,  0,  0,  0,  0,  0,          /* No default MAC addr  */
-    0x7f, 0xff,                     /* Frag threshold */
-    0x02, 0x00,                     /* Hop time */
-    0x00, 0x01,                     /* Beacon period */
-    0x01, 0x07, 0xa3,               /* DTIM, retries, ack timeout*/
-    0x1d, 0x82, 0xce,               /* SIFS, DIFS, PIFS */
-    0x7f, 0xff,                     /* RTS threshold */
-    0xfb, 0x1e, 0xc7, 0x5c,         /* scan_dwell, max_scan_dwell */
-    0x05,                           /* assoc resp timeout thresh */
-    0x04, 0x02, 0x4,                /* adhoc, infra, super cycle max*/
-    0,                              /* Promiscuous mode */
-    0x0c, 0x0bd,                    /* Unique word */
-    0x4e,                           /* Slot time (TBD seems wrong)*/
-    0xff, 0xff,                     /* roam-low snr, low snr count */
-    0x05, 0xff,                     /* Infra, adhoc missed bcn thresh */
-    0x01, 0x0b, 0x4e,               /* USA, hop pattern, hop pat length */
-/* b4 - b5 differences start here */
-    0x3f, 0x0f,                     /* CW max, min */
-    0x04, 0x08,                     /* Noise gain, limit offset */
-    0x28, 0x28,                     /* det rssi, med busy offsets */
-    7,                              /* det sync thresh */
-    0, 2, 2                         /* test mode, min, max*/
-};
-/*===========================================================================*/
-static unsigned char eth2_llc[] = {0xaa, 0xaa, 3, 0, 0, 0};
-
-static char hop_pattern_length[] = { 1,
-	     USA_HOP_MOD,             EUROPE_HOP_MOD,
-	     JAPAN_HOP_MOD,           KOREA_HOP_MOD,
-	     SPAIN_HOP_MOD,           FRANCE_HOP_MOD,
-	     ISRAEL_HOP_MOD,          AUSTRALIA_HOP_MOD,
-	     JAPAN_TEST_HOP_MOD
-};
-
-static char rcsid[] = "Raylink/WebGear wireless LAN - Corey <Thomas corey@world.std.com>";
-
-/*===========================================================================*/
-static void cs_error(client_handle_t handle, int func, int ret)
-{
-    error_info_t err = { func, ret };
-    pcmcia_report_error(handle, &err);
-}
-/*======================================================================
-
-    This bit of code is used to avoid unregistering network devices
-    at inappropriate times.  2.2 and later kernels are fairly picky
-    about when this can happen.
-    
-======================================================================*/
-
-static void flush_stale_links(void)
-{
-    dev_link_t *link, *next;
-    for (link = dev_list; link; link = next) {
-	next = link->next;
-	if (link->state & DEV_STALE_LINK)
-	    ray_detach(link);
-    }
-}
-
-/*=============================================================================
-    ray_attach() creates an "instance" of the driver, allocating
-    local data structures for one device.  The device is registered
-    with Card Services.
-    The dev_link structure is initialized, but we don't actually
-    configure the card at this point -- we wait until we receive a
-    card insertion event.
-=============================================================================*/
-static dev_link_t *ray_attach(void)
-{
-    client_reg_t client_reg;
-    dev_link_t *link;
-    ray_dev_t *local;
-    int ret;
-    struct net_device *dev;
-    
-    DEBUG(1, "ray_attach()\n");
-    flush_stale_links();
-
-    /* Initialize the dev_link_t structure */
-    link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
-
-    if (!link)
-	    return NULL;
-
-    /* Allocate space for private device-specific data */
-    dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
-
-    if (!dev)
-	    goto fail_alloc_dev;
-
-    local = kmalloc(sizeof(ray_dev_t), GFP_KERNEL);
-
-    if (!local)
-	    goto fail_alloc_local;
-
-    memset(link, 0, sizeof(struct dev_link_t));
-    memset(dev, 0, sizeof(struct net_device));
-    memset(local, 0, sizeof(ray_dev_t));
-
-    init_timer(&link->release);
-    link->release.function = &ray_release;
-    link->release.data = (u_long)link;
-
-    /* The io structure describes IO port mapping. None used here */
-    link->io.NumPorts1 = 0;
-    link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
-    link->io.IOAddrLines = 5;
-
-    /* Interrupt setup. For PCMCIA, driver takes what's given */
-    link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
-    link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID;
-    link->irq.IRQInfo2 = irq_mask;
-    link->irq.Handler = &ray_interrupt;
-
-    /* General socket configuration */
-    link->conf.Attributes = CONF_ENABLE_IRQ;
-    link->conf.Vcc = 50;
-    link->conf.IntType = INT_MEMORY_AND_IO;
-    link->conf.ConfigIndex = 1;
-    link->conf.Present = PRESENT_OPTION;
-
-    link->priv = dev;
-    link->irq.Instance = dev;
-    
-    dev->priv = local;
-    local->finder = link;
-    local->card_status = CARD_INSERTED;
-    local->authentication_state = UNAUTHENTICATED;
-    local->num_multi = 0;
-    DEBUG(2,"ray_attach link = %p,  dev = %p,  local = %p, intr = %p\n",
-          link,dev,local,&ray_interrupt);
-
-    /* Raylink entries in the device structure */
-    dev->hard_start_xmit = &ray_dev_start_xmit;
-    dev->set_config = &ray_dev_config;
-    dev->get_stats  = &ray_get_stats;
-    dev->do_ioctl = &ray_dev_ioctl;
-#if WIRELESS_EXT > 7	/* If wireless extension exist in the kernel */
-    dev->get_wireless_stats = ray_get_wireless_stats;
-#endif
-
-    dev->set_multicast_list = &set_multicast_list;
-
-    DEBUG(2,"ray_cs ray_attach calling ether_setup.)\n");
-    ether_setup(dev);
-    dev->init = &ray_dev_init;
-    dev->open = &ray_open;
-    dev->stop = &ray_dev_close;
-    netif_stop_queue(dev);
-
-    /* Register with Card Services */
-    link->next = dev_list;
-    dev_list = link;
-    client_reg.dev_info = &dev_info;
-    client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
-    client_reg.EventMask =
-        CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
-        CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
-        CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
-    client_reg.event_handler = &ray_event;
-    client_reg.Version = 0x0210;
-    client_reg.event_callback_args.client_data = link;
-
-    DEBUG(2,"ray_cs ray_attach calling CardServices(RegisterClient...)\n");
-
-    init_timer(&local->timer);
-
-    ret = pcmcia_register_client(&link->handle, &client_reg);
-    if (ret != 0) {
-        printk("ray_cs ray_attach RegisterClient unhappy - detaching\n");
-        cs_error(link->handle, RegisterClient, ret);
-        ray_detach(link);
-        return NULL;
-    }
-    DEBUG(2,"ray_cs ray_attach ending\n");
-    return link;
-
-fail_alloc_local:
-    kfree(dev);
-fail_alloc_dev:
-    kfree(link);
-    return NULL;
-} /* ray_attach */
-/*=============================================================================
-    This deletes a driver "instance".  The device is de-registered
-    with Card Services.  If it has been released, all local data
-    structures are freed.  Otherwise, the structures will be freed
-    when the device is released.
-=============================================================================*/
-static void ray_detach(dev_link_t *link)
-{
-    dev_link_t **linkp;
-
-    DEBUG(1, "ray_detach(0x%p)\n", link);
-    
-    /* Locate device structure */
-    for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
-        if (*linkp == link) break;
-    if (*linkp == NULL)
-        return;
-
-    /* If the device is currently configured and active, we won't
-      actually delete it yet.  Instead, it is marked so that when
-      the release() function is called, that will trigger a proper
-      detach().
-    */
-    del_timer(&link->release);
-    if (link->state & DEV_CONFIG) {
-        ray_release((u_long)link);
-        if(link->state & DEV_STALE_CONFIG) {
-            link->state |= DEV_STALE_LINK;
-            return;
-        }
-    }
-
-    /* Break the link with Card Services */
-    if (link->handle)
-        pcmcia_deregister_client(link->handle);
-    
-    /* Unlink device structure, free pieces */
-    *linkp = link->next;
-    if (link->priv) {
-        struct net_device *dev = link->priv;
-	if (link->dev) unregister_netdev(dev);
-        if (dev->priv)
-            kfree(dev->priv);
-        kfree(link->priv);
-    }
-    kfree(link);
-    DEBUG(2,"ray_cs ray_detach ending\n");
-} /* ray_detach */
-/*=============================================================================
-    ray_config() is run after a CARD_INSERTION event
-    is received, to configure the PCMCIA socket, and to make the
-    ethernet device available to the system.
-=============================================================================*/
-#define CS_CHECK(fn, args...) \
-while ((last_ret=fn(args))!=0) goto cs_failed
-#define MAX_TUPLE_SIZE 128
-static void ray_config(dev_link_t *link)
-{
-    client_handle_t handle = link->handle;
-    tuple_t tuple;
-    cisparse_t parse;
-    int last_fn = 0, last_ret = 0;
-    int i;
-    u_char buf[MAX_TUPLE_SIZE];
-    win_req_t req;
-    memreq_t mem;
-    struct net_device *dev = (struct net_device *)link->priv;
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
-
-    DEBUG(1, "ray_config(0x%p)\n", link);
-
-    /* This reads the card's CONFIG tuple to find its configuration regs */
-    tuple.DesiredTuple = CISTPL_CONFIG;
-    CS_CHECK(pcmcia_get_first_tuple, handle, &tuple);
-    tuple.TupleData = buf;
-    tuple.TupleDataMax = MAX_TUPLE_SIZE;
-    tuple.TupleOffset = 0;
-    CS_CHECK(pcmcia_get_tuple_data, handle, &tuple);
-    CS_CHECK(pcmcia_parse_tuple, handle, &tuple, &parse);
-    link->conf.ConfigBase = parse.config.base;
-    link->conf.Present = parse.config.rmask[0];
-
-    /* Determine card type and firmware version */
-    buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0;
-    tuple.DesiredTuple = CISTPL_VERS_1;
-    CS_CHECK(pcmcia_get_first_tuple, handle, &tuple);
-    tuple.TupleData = buf;
-    tuple.TupleDataMax = MAX_TUPLE_SIZE;
-    tuple.TupleOffset = 2;
-    CS_CHECK(pcmcia_get_tuple_data, handle, &tuple);
-
-    for (i=0; i<tuple.TupleDataLen - 4; i++) 
-        if (buf[i] == 0) buf[i] = ' ';
-    printk(KERN_INFO "ray_cs Detected: %s\n",buf);
-
-    /* Configure card */
-    link->state |= DEV_CONFIG;
-
-    /* Now allocate an interrupt line.  Note that this does not
-       actually assign a handler to the interrupt.
-    */
-    CS_CHECK(pcmcia_request_irq, link->handle, &link->irq);
-    dev->irq = link->irq.AssignedIRQ;
-    
-    /* This actually configures the PCMCIA socket -- setting up
-       the I/O windows and the interrupt mapping.
-    */
-    CS_CHECK(pcmcia_request_configuration, link->handle, &link->conf);
-
-/*** Set up 32k window for shared memory (transmit and control) ************/
-    req.Attributes = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
-    req.Base = 0;
-    req.Size = 0x8000;
-    req.AccessSpeed = ray_mem_speed;
-    CS_CHECK(pcmcia_request_window, &link->handle, &req, &link->win);
-    mem.CardOffset = 0x0000; mem.Page = 0;
-    CS_CHECK(pcmcia_map_mem_page, link->win, &mem);
-    local->sram = (UCHAR *)(ioremap(req.Base,req.Size));
-
-/*** Set up 16k window for shared memory (receive buffer) ***************/
-    req.Attributes = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
-    req.Base = 0;
-    req.Size = 0x4000;
-    req.AccessSpeed = ray_mem_speed;
-    CS_CHECK(pcmcia_request_window, &link->handle, &req, &local->rmem_handle);
-    mem.CardOffset = 0x8000; mem.Page = 0;
-    CS_CHECK(pcmcia_map_mem_page, local->rmem_handle, &mem);
-    local->rmem = (UCHAR *)(ioremap(req.Base,req.Size));
-
-/*** Set up window for attribute memory ***********************************/
-    req.Attributes = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT;
-    req.Base = 0;
-    req.Size = 0x1000;
-    req.AccessSpeed = ray_mem_speed;
-    CS_CHECK(pcmcia_request_window, &link->handle, &req, &local->amem_handle);
-    mem.CardOffset = 0x0000; mem.Page = 0;
-    CS_CHECK(pcmcia_map_mem_page, local->amem_handle, &mem);
-    local->amem = (UCHAR *)(ioremap(req.Base,req.Size));
-
-    DEBUG(3,"ray_config sram=%p\n",local->sram);
-    DEBUG(3,"ray_config rmem=%p\n",local->rmem);
-    DEBUG(3,"ray_config amem=%p\n",local->amem);
-    if (ray_init(dev) < 0) {
-        ray_release((u_long)link);
-        return;
-    }
-
-    i = register_netdev(dev);
-    if (i != 0) {
-        printk("ray_config register_netdev() failed\n");
-        ray_release((u_long)link);
-        return;
-    }
-
-    strcpy(local->node.dev_name, dev->name);
-    link->dev = &local->node;
-
-    link->state &= ~DEV_CONFIG_PENDING;
-    printk(KERN_INFO "%s: RayLink, irq %d, hw_addr ",
-       dev->name, dev->irq);
-    for (i = 0; i < 6; i++)
-    printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : "\n"));
-
-    return;
-
-cs_failed:
-    cs_error(link->handle, last_fn, last_ret);
-
-    ray_release((u_long)link);
-} /* ray_config */
-/*===========================================================================*/
-static int ray_init(struct net_device *dev)
-{
-    int i;
-    UCHAR *p;
-    struct ccs *pccs;
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
-    dev_link_t *link = local->finder;
-    DEBUG(1, "ray_init(0x%p)\n", dev);
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(0,"ray_init - device not present\n");
-        return -1;
-    }
-
-    local->net_type = net_type;
-    local->sta_type = TYPE_STA;
-
-    /* Copy the startup results to local memory */
-    memcpy_fromio(&local->startup_res, local->sram + ECF_TO_HOST_BASE,\
-           sizeof(struct startup_res_6));
-
-    /* Check Power up test status and get mac address from card */
-    if (local->startup_res.startup_word != 0x80) {
-    printk(KERN_INFO "ray_init ERROR card status = %2x\n",
-           local->startup_res.startup_word);
-        local->card_status = CARD_INIT_ERROR;
-        return -1;
-    }
-
-    local->fw_ver = local->startup_res.firmware_version[0];
-    local->fw_bld = local->startup_res.firmware_version[1];
-    local->fw_var = local->startup_res.firmware_version[2];
-    DEBUG(1,"ray_init firmware version %d.%d \n",local->fw_ver, local->fw_bld);
-
-    local->tib_length = 0x20;
-    if ((local->fw_ver == 5) && (local->fw_bld >= 30))
-        local->tib_length = local->startup_res.tib_length;
-    DEBUG(2,"ray_init tib_length = 0x%02x\n", local->tib_length);
-    /* Initialize CCS's to buffer free state */
-    pccs = (struct ccs *)(local->sram + CCS_BASE);
-    for (i=0;  i<NUMBER_OF_CCS;  i++) {
-        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
-    }
-    init_startup_params(local);
-
-    /* copy mac address to startup parameters */
-    if (parse_addr(phy_addr, local->sparm.b4.a_mac_addr))
-    {
-        p = local->sparm.b4.a_mac_addr;
-    }
-    else
-    {
-        memcpy(&local->sparm.b4.a_mac_addr,
-               &local->startup_res.station_addr, ADDRLEN);
-        p = local->sparm.b4.a_mac_addr;
-    }
-
-    clear_interrupt(local); /* Clear any interrupt from the card */
-    local->card_status = CARD_AWAITING_PARAM;
-    DEBUG(2,"ray_init ending\n");
-    return 0;
-} /* ray_init */
-/*===========================================================================*/
-/* Download startup parameters to the card and command it to read them       */
-static int dl_startup_params(struct net_device *dev)
-{
-    int ccsindex;
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
-    struct ccs *pccs;
-    dev_link_t *link = local->finder;
-
-    DEBUG(1,"dl_startup_params entered\n");
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_cs dl_startup_params - device not present\n");
-        return -1;
-    }
-    
-    /* Copy parameters to host to ECF area */
-    if (local->fw_ver == 0x55) 
-        memcpy_toio(local->sram + HOST_TO_ECF_BASE, &local->sparm.b4,
-               sizeof(struct b4_startup_params));
-    else
-        memcpy_toio(local->sram + HOST_TO_ECF_BASE, &local->sparm.b5,
-               sizeof(struct b5_startup_params));
-
-    
-    /* Fill in the CCS fields for the ECF */
-    if ((ccsindex = get_free_ccs(local)) < 0) return -1;
-    local->dl_param_ccs = ccsindex;
-    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
-    writeb(CCS_DOWNLOAD_STARTUP_PARAMS, &pccs->cmd);
-    DEBUG(2,"dl_startup_params start ccsindex = %d\n", local->dl_param_ccs);
-    /* Interrupt the firmware to process the command */
-    if (interrupt_ecf(local, ccsindex)) {
-        printk(KERN_INFO "ray dl_startup_params failed - "
-           "ECF not ready for intr\n");
-        local->card_status = CARD_DL_PARAM_ERROR;
-        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
-        return -2;
-    }
-    local->card_status = CARD_DL_PARAM;
-    /* Start kernel timer to wait for dl startup to complete. */
-    local->timer.expires = jiffies + HZ/2;
-    local->timer.data = (long)local;
-    local->timer.function = &verify_dl_startup;
-    add_timer(&local->timer);
-    DEBUG(2,"ray_cs dl_startup_params started timer for verify_dl_startup\n");
-    return 0;
-} /* dl_startup_params */
-/*===========================================================================*/
-static void init_startup_params(ray_dev_t *local)
-{
-    int i; 
-
-    if (country > JAPAN_TEST) country = USA;
-    else
-        if (country < USA) country = USA;
-    /* structure for hop time and beacon period is defined here using 
-     * New 802.11D6.1 format.  Card firmware is still using old format
-     * until version 6.
-     *    Before                    After
-     *    a_hop_time ms byte        a_hop_time ms byte
-     *    a_hop_time 2s byte        a_hop_time ls byte
-     *    a_hop_time ls byte        a_beacon_period ms byte
-     *    a_beacon_period           a_beacon_period ls byte
-     *
-     *    a_hop_time = uS           a_hop_time = KuS
-     *    a_beacon_period = hops    a_beacon_period = KuS
-     */                             /* 64ms = 010000 */
-    if (local->fw_ver == 0x55)  {
-        memcpy((UCHAR *)&local->sparm.b4, b4_default_startup_parms, 
-               sizeof(struct b4_startup_params));
-        /* Translate sane kus input values to old build 4/5 format */
-        /* i = hop time in uS truncated to 3 bytes */
-        i = (hop_dwell * 1024) & 0xffffff;
-        local->sparm.b4.a_hop_time[0] = (i >> 16) & 0xff;
-        local->sparm.b4.a_hop_time[1] = (i >> 8) & 0xff;
-        local->sparm.b4.a_beacon_period[0] = 0;
-        local->sparm.b4.a_beacon_period[1] =
-            ((beacon_period/hop_dwell) - 1) & 0xff;
-        local->sparm.b4.a_curr_country_code = country;
-        local->sparm.b4.a_hop_pattern_length = 
-            hop_pattern_length[(int)country] - 1;
-        if (bc)
-        {
-            local->sparm.b4.a_ack_timeout = 0x50;
-            local->sparm.b4.a_sifs = 0x3f;
-        }
-    }
-    else {    /* Version 5 uses real kus values */
-        memcpy((UCHAR *)&local->sparm.b5, b5_default_startup_parms, 
-               sizeof(struct b5_startup_params));
-
-        local->sparm.b5.a_hop_time[0] = (hop_dwell >> 8) & 0xff;
-        local->sparm.b5.a_hop_time[1] = hop_dwell & 0xff;
-        local->sparm.b5.a_beacon_period[0] = (beacon_period >> 8) & 0xff;
-        local->sparm.b5.a_beacon_period[1] = beacon_period & 0xff;
-        if (psm)
-            local->sparm.b5.a_power_mgt_state = 1;
-        local->sparm.b5.a_curr_country_code = country;
-        local->sparm.b5.a_hop_pattern_length = 
-            hop_pattern_length[(int)country];
-    }
-    
-    local->sparm.b4.a_network_type = net_type & 0x01;
-    local->sparm.b4.a_acting_as_ap_status = TYPE_STA;
-
-    if (essid != NULL)
-        strncpy(local->sparm.b4.a_current_ess_id, essid, ESSID_SIZE);
-} /* init_startup_params */ 
-/*===========================================================================*/
-static void verify_dl_startup(u_long data)
-{
-    ray_dev_t *local = (ray_dev_t *)data;
-    struct ccs *pccs = ((struct ccs *)(local->sram + CCS_BASE)) + local->dl_param_ccs;
-    UCHAR status;
-    dev_link_t *link = local->finder;
-
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_cs verify_dl_startup - device not present\n");
-        return;
-    }
-#ifdef PCMCIA_DEBUG
-    if (pc_debug > 2) {
-    int i;
-    printk(KERN_DEBUG "verify_dl_startup parameters sent via ccs %d:\n",
-           local->dl_param_ccs);
-        for (i=0; i<sizeof(struct b5_startup_params); i++) {
-            printk(" %2x", (unsigned int) readb(local->sram + HOST_TO_ECF_BASE + i));
-        }
-    printk("\n");
-    }
-#endif
-
-    status = readb(&pccs->buffer_status);
-    if (status!= CCS_BUFFER_FREE)
-    {
-        printk(KERN_INFO "Download startup params failed.  Status = %d\n",
-           status);
-        local->card_status = CARD_DL_PARAM_ERROR;
-        return;
-    }
-    if (local->sparm.b4.a_network_type == ADHOC)
-        start_net((u_long)local);
-    else
-        join_net((u_long)local);
-
-    return;
-} /* end verify_dl_startup */
-/*===========================================================================*/
-/* Command card to start a network */
-static void start_net(u_long data)
-{
-    ray_dev_t *local = (ray_dev_t *)data;
-    struct ccs *pccs;
-    int ccsindex;
-    dev_link_t *link = local->finder;
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_cs start_net - device not present\n");
-        return;
-    }
-    /* Fill in the CCS fields for the ECF */
-    if ((ccsindex = get_free_ccs(local)) < 0) return;
-    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
-    writeb(CCS_START_NETWORK, &pccs->cmd);
-    writeb(0, &pccs->var.start_network.update_param);
-    /* Interrupt the firmware to process the command */
-    if (interrupt_ecf(local, ccsindex)) {
-        DEBUG(1,"ray start net failed - card not ready for intr\n");
-        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
-        return;
-    }
-    local->card_status = CARD_DOING_ACQ;
-    return;
-} /* end start_net */
-/*===========================================================================*/
-/* Command card to join a network */
-static void join_net(u_long data)
-{
-    ray_dev_t *local = (ray_dev_t *)data;
-
-    struct ccs *pccs;
-    int ccsindex;
-    dev_link_t *link = local->finder;
-    
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_cs join_net - device not present\n");
-        return;
-    }
-    /* Fill in the CCS fields for the ECF */
-    if ((ccsindex = get_free_ccs(local)) < 0) return;
-    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
-    writeb(CCS_JOIN_NETWORK, &pccs->cmd);
-    writeb(0, &pccs->var.join_network.update_param);
-    writeb(0, &pccs->var.join_network.net_initiated);
-    /* Interrupt the firmware to process the command */
-    if (interrupt_ecf(local, ccsindex)) {
-        DEBUG(1,"ray join net failed - card not ready for intr\n");
-        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
-        return;
-    }
-    local->card_status = CARD_DOING_ACQ;
-    return;
-}
-/*============================================================================
-    After a card is removed, ray_release() will unregister the net
-    device, and release the PCMCIA configuration.  If the device is
-    still open, this will be postponed until it is closed.
-=============================================================================*/
-static void ray_release(u_long arg)
-{
-    dev_link_t *link = (dev_link_t *)arg;
-    struct net_device *dev = link->priv; 
-    ray_dev_t *local = dev->priv;
-    int i;
-    
-    DEBUG(1, "ray_release(0x%p)\n", link);
-    /* If the device is currently in use, we won't release until it
-      is actually closed.
-    */
-    if (link->open) {
-        DEBUG(1, "ray_cs: release postponed, '%s' still open\n",
-              link->dev->dev_name);
-        link->state |= DEV_STALE_CONFIG;
-        return;
-    }
-    del_timer(&local->timer);
-    link->state &= ~DEV_CONFIG;
-
-    iounmap(local->sram);
-    iounmap(local->rmem);
-    iounmap(local->amem);
-    /* Do bother checking to see if these succeed or not */
-    i = pcmcia_release_window(link->win);
-    if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(link->win) ret = %x\n",i);
-    i = pcmcia_release_window(local->amem_handle);
-    if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->amem) ret = %x\n",i);
-    i = pcmcia_release_window(local->rmem_handle);
-    if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->rmem) ret = %x\n",i);
-    i = pcmcia_release_configuration(link->handle);
-    if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseConfiguration ret = %x\n",i);
-    i = pcmcia_release_irq(link->handle, &link->irq);
-    if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseIRQ ret = %x\n",i);
-
-    DEBUG(2,"ray_release ending\n");
-} /* ray_release */
-/*=============================================================================
-    The card status event handler.  Mostly, this schedules other
-    stuff to run after an event is received.  A CARD_REMOVAL event
-    also sets some flags to discourage the net drivers from trying
-    to talk to the card any more.
-
-    When a CARD_REMOVAL event is received, we immediately set a flag
-    to block future accesses to this device.  All the functions that
-    actually access the device should check this flag to make sure
-    the card is still present.
-=============================================================================*/
-static int ray_event(event_t event, int priority,
-                     event_callback_args_t *args)
-{
-    dev_link_t *link = args->client_data;
-    struct net_device *dev = link->priv;
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
-    DEBUG(1, "ray_event(0x%06x)\n", event);
-    
-    switch (event) {
-    case CS_EVENT_CARD_REMOVAL:
-        link->state &= ~DEV_PRESENT;
-        netif_device_detach(dev);
-        if (link->state & DEV_CONFIG) {
-            mod_timer(&link->release, jiffies + HZ/20);
-            del_timer(&local->timer);
-        }
-        break;
-    case CS_EVENT_CARD_INSERTION:
-        link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
-        ray_config(link);
-        break;
-    case CS_EVENT_PM_SUSPEND:
-        link->state |= DEV_SUSPEND;
-        /* Fall through... */
-    case CS_EVENT_RESET_PHYSICAL:
-        if (link->state & DEV_CONFIG) {
-            if (link->open)
-            	netif_device_detach(dev);
-
-            pcmcia_release_configuration(link->handle);
-        }
-        break;
-    case CS_EVENT_PM_RESUME:
-        link->state &= ~DEV_SUSPEND;
-        /* Fall through... */
-    case CS_EVENT_CARD_RESET:
-        if (link->state & DEV_CONFIG) {
-            pcmcia_request_configuration(link->handle, &link->conf);
-            if (link->open) {
-                ray_reset(dev);
-		netif_device_attach(dev);
-            }
-        }
-        break;
-    }
-    return 0;
-    DEBUG(2,"ray_event ending\n");
-} /* ray_event */
-/*===========================================================================*/
-int ray_dev_init(struct net_device *dev)
-{
-#ifdef RAY_IMMEDIATE_INIT
-    int i;
-#endif	/* RAY_IMMEDIATE_INIT */
-    ray_dev_t *local = dev->priv;
-    dev_link_t *link = local->finder;
-
-    DEBUG(1,"ray_dev_init(dev=%p)\n",dev);
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_dev_init - device not present\n");
-        return -1;
-    }
-#ifdef RAY_IMMEDIATE_INIT
-    /* Download startup parameters */
-    if ( (i = dl_startup_params(dev)) < 0)
-    {
-        printk(KERN_INFO "ray_dev_init dl_startup_params failed - "
-           "returns 0x%x\n",i);
-        return -1;
-    }
-#else	/* RAY_IMMEDIATE_INIT */
-    /* Postpone the card init so that we can still configure the card,
-     * for example using the Wireless Extensions. The init will happen
-     * in ray_open() - Jean II */
-    DEBUG(1,"ray_dev_init: postponing card init to ray_open() ; Status = %d\n",
-	  local->card_status);
-#endif	/* RAY_IMMEDIATE_INIT */
-
-    /* copy mac and broadcast addresses to linux device */
-    memcpy(&dev->dev_addr, &local->sparm.b4.a_mac_addr, ADDRLEN);
-    memset(dev->broadcast, 0xff, ETH_ALEN);
-
-    DEBUG(2,"ray_dev_init ending\n");
-    return 0;
-}
-/*===========================================================================*/
-static int ray_dev_config(struct net_device *dev, struct ifmap *map)
-{
-    ray_dev_t *local = dev->priv;
-    dev_link_t *link = local->finder;
-    /* Dummy routine to satisfy device structure */
-    DEBUG(1,"ray_dev_config(dev=%p,ifmap=%p)\n",dev,map);
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_dev_config - device not present\n");
-        return -1;
-    }
-
-    return 0;
-}
-/*===========================================================================*/
-static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-    ray_dev_t *local = dev->priv;
-    dev_link_t *link = local->finder;
-    short length = skb->len;
-
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_dev_start_xmit - device not present\n");
-        return -1;
-    }
-    DEBUG(3,"ray_dev_start_xmit(skb=%p, dev=%p)\n",skb,dev);
-    if (local->authentication_state == NEED_TO_AUTH) {
-        DEBUG(0,"ray_cs Sending authentication request.\n");
-        if (!build_auth_frame (local, local->auth_id, OPEN_AUTH_REQUEST)) {
-            local->authentication_state = AUTHENTICATED;
-            netif_stop_queue(dev);
-            return 1;
-        }
-    }
-
-    if (length < ETH_ZLEN)
-    {
-    	skb = skb_padto(skb, ETH_ZLEN);
-    	if (skb == NULL)
-    		return 0;
-    	length = ETH_ZLEN;
-    }
-    switch (ray_hw_xmit( skb->data, length, dev, DATA_TYPE)) {
-        case XMIT_NO_CCS:
-        case XMIT_NEED_AUTH:
-	    netif_stop_queue(dev);
-            return 1;
-        case XMIT_NO_INTR:
-        case XMIT_MSG_BAD:
-        case XMIT_OK:
-        default:
-            dev->trans_start = jiffies;
-            dev_kfree_skb(skb);
-            return 0;
-    }
-    return 0;
-} /* ray_dev_start_xmit */
-/*===========================================================================*/
-static int ray_hw_xmit(unsigned char* data, int len, struct net_device* dev, 
-                UCHAR msg_type)
-{
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
-    struct ccs *pccs;
-    int ccsindex;
-    int offset;
-    struct tx_msg *ptx; /* Address of xmit buffer in PC space */
-    short int addr;     /* Address of xmit buffer in card space */
-    
-    DEBUG(3,"ray_hw_xmit(data=%p, len=%d, dev=%p)\n",data,len,dev);
-    if (len + TX_HEADER_LENGTH > TX_BUF_SIZE)
-    {
-        printk(KERN_INFO "ray_hw_xmit packet too large: %d bytes\n",len);
-        return XMIT_MSG_BAD;
-    }
-	switch (ccsindex = get_free_tx_ccs(local)) {
-	case ECCSBUSY:
-		DEBUG(2,"ray_hw_xmit tx_ccs table busy\n");
-	case ECCSFULL:
-        DEBUG(2,"ray_hw_xmit No free tx ccs\n");
-	case ECARDGONE:
-	netif_stop_queue(dev);
-        return XMIT_NO_CCS;
-	default:
-		break;
-	}
-    addr = TX_BUF_BASE + (ccsindex << 11);
-
-    if (msg_type == DATA_TYPE) {
-        local->stats.tx_bytes += len;
-        local->stats.tx_packets++;
-    }
-
-    ptx = (struct tx_msg *)(local->sram + addr);
-
-    ray_build_header(local, ptx, msg_type, data);
-    if (translate) {
-        offset = translate_frame(local, ptx, data, len);
-    }
-    else { /* Encapsulate frame */
-        /* TBD TIB length will move address of ptx->var */
-        memcpy_toio(&ptx->var, data, len);
-        offset = 0;
-    }
-
-    /* fill in the CCS */
-    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
-    len += TX_HEADER_LENGTH + offset;
-    writeb(CCS_TX_REQUEST, &pccs->cmd);
-    writeb(addr >> 8, &pccs->var.tx_request.tx_data_ptr[0]);
-    writeb(local->tib_length, &pccs->var.tx_request.tx_data_ptr[1]);
-    writeb(len >> 8, &pccs->var.tx_request.tx_data_length[0]);
-    writeb(len & 0xff, &pccs->var.tx_request.tx_data_length[1]);
-/* TBD still need psm_cam? */
-    writeb(PSM_CAM, &pccs->var.tx_request.pow_sav_mode);
-    writeb(local->net_default_tx_rate, &pccs->var.tx_request.tx_rate);
-    writeb(0, &pccs->var.tx_request.antenna);
-    DEBUG(3,"ray_hw_xmit default_tx_rate = 0x%x\n",\
-          local->net_default_tx_rate);
-
-    /* Interrupt the firmware to process the command */
-    if (interrupt_ecf(local, ccsindex)) {
-        DEBUG(2,"ray_hw_xmit failed - ECF not ready for intr\n");
-/* TBD very inefficient to copy packet to buffer, and then not
-   send it, but the alternative is to queue the messages and that
-   won't be done for a while.  Maybe set tbusy until a CCS is free?
-*/
-        writeb(CCS_BUFFER_FREE, &pccs->buffer_status);
-        return XMIT_NO_INTR;
-    }
-    return XMIT_OK;
-} /* end ray_hw_xmit */
-/*===========================================================================*/
-static int translate_frame(ray_dev_t *local, struct tx_msg *ptx, unsigned char *data,
-                    int len)
-{
-    unsigned short int proto = ((struct ethhdr *)data)->h_proto;
-    if (ntohs(proto) >= 1536) { /* DIX II ethernet frame */
-        DEBUG(3,"ray_cs translate_frame DIX II\n");
-        /* Copy LLC header to card buffer */
-        memcpy_toio((UCHAR *)&ptx->var, eth2_llc, sizeof(eth2_llc));
-        memcpy_toio( ((UCHAR *)&ptx->var) + sizeof(eth2_llc), (UCHAR *)&proto, 2);
-        if ((proto == 0xf380) || (proto == 0x3781)) {
-            /* This is the selective translation table, only 2 entries */
-            writeb(0xf8, (UCHAR *) &((struct snaphdr_t *)ptx->var)->org[3]);
-        }
-        /* Copy body of ethernet packet without ethernet header */
-        memcpy_toio((UCHAR *)&ptx->var + sizeof(struct snaphdr_t), \
-                    data + ETH_HLEN,  len - ETH_HLEN);
-        return (int) sizeof(struct snaphdr_t) - ETH_HLEN;
-    }
-    else { /* already  802 type, and proto is length */
-        DEBUG(3,"ray_cs translate_frame 802\n");
-        if (proto == 0xffff) { /* evil netware IPX 802.3 without LLC */
-        DEBUG(3,"ray_cs translate_frame evil IPX\n");
-            memcpy_toio((UCHAR *)&ptx->var, data + ETH_HLEN,  len - ETH_HLEN);
-            return 0 - ETH_HLEN;
-        }
-        memcpy_toio((UCHAR *)&ptx->var, data + ETH_HLEN,  len - ETH_HLEN);
-        return 0 - ETH_HLEN;
-    }
-    /* TBD do other frame types */
-} /* end translate_frame */
-/*===========================================================================*/
-static void ray_build_header(ray_dev_t *local, struct tx_msg *ptx, UCHAR msg_type,
-                unsigned char *data)
-{
-    writeb(PROTOCOL_VER | msg_type, &ptx->mac.frame_ctl_1);
-/*** IEEE 802.11 Address field assignments *************
-                TODS FROMDS   addr_1     addr_2          addr_3   addr_4
-Adhoc           0    0        dest       src (terminal)  BSSID    N/A
-AP to Terminal  0    1        dest       AP(BSSID)       source   N/A
-Terminal to AP  1    0        AP(BSSID)  src (terminal)  dest     N/A
-AP to AP        1    1        dest AP    src AP          dest     source      
-*******************************************************/
-    if (local->net_type == ADHOC) {   
-        writeb(0, &ptx->mac.frame_ctl_2);
-        memcpy_toio(ptx->mac.addr_1, ((struct ethhdr *)data)->h_dest, 2 * ADDRLEN);
-        memcpy_toio(ptx->mac.addr_3, local->bss_id, ADDRLEN);
-    }
-    else /* infrastructure */
-    {
-        if (local->sparm.b4.a_acting_as_ap_status)
-        {
-            writeb(FC2_FROM_DS, &ptx->mac.frame_ctl_2);
-            memcpy_toio(ptx->mac.addr_1, ((struct ethhdr *)data)->h_dest, ADDRLEN);
-            memcpy_toio(ptx->mac.addr_2, local->bss_id, 6);
-            memcpy_toio(ptx->mac.addr_3, ((struct ethhdr *)data)->h_source, ADDRLEN);
-        }
-        else /* Terminal */
-        {
-            writeb(FC2_TO_DS, &ptx->mac.frame_ctl_2);
-            memcpy_toio(ptx->mac.addr_1, local->bss_id, ADDRLEN);
-            memcpy_toio(ptx->mac.addr_2, ((struct ethhdr *)data)->h_source, ADDRLEN);
-            memcpy_toio(ptx->mac.addr_3, ((struct ethhdr *)data)->h_dest, ADDRLEN);
-        }
-    }
-} /* end encapsulate_frame */
-
-
-/*===========================================================================*/
-
-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
-{
-	u32 ethcmd;
-		
-	if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
-		return -EFAULT;
-	
-	switch (ethcmd) {
-	case ETHTOOL_GDRVINFO: {
-		struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
-		strncpy(info.driver, "ray_cs", sizeof(info.driver)-1);
-		if (copy_to_user(useraddr, &info, sizeof(info)))
-			return -EFAULT;
-		return 0;
-	}
-	}
-	
-	return -EOPNOTSUPP;
-}
-
-/*====================================================================*/
-
-static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
-    dev_link_t *link = local->finder;
-    int err = 0;
-#if WIRELESS_EXT > 7
-    struct iwreq *wrq = (struct iwreq *) ifr;
-#endif	/* WIRELESS_EXT > 7 */
-
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_dev_ioctl - device not present\n");
-        return -1;
-    }
-    DEBUG(2,"ray_cs IOCTL dev=%p, ifr=%p, cmd = 0x%x\n",dev,ifr,cmd);
-    /* Validate the command */
-    switch (cmd)
-    {
-    case SIOCETHTOOL:
-      err = netdev_ethtool_ioctl(dev, (void *) ifr->ifr_data);
-      break;
-
-#if WIRELESS_EXT > 7
-      /* --------------- WIRELESS EXTENSIONS --------------- */
-      /* Get name */
-    case SIOCGIWNAME:
-      strcpy(wrq->u.name, "IEEE 802.11-FH");
-      break;
-
-      /* Get frequency/channel */
-    case SIOCGIWFREQ:
-      wrq->u.freq.m = local->sparm.b5.a_hop_pattern;
-      wrq->u.freq.e = 0;
-      break;
-
-      /* Set frequency/channel */
-    case SIOCSIWFREQ:
-      /* Reject if card is already initialised */
-      if(local->card_status != CARD_AWAITING_PARAM)
-	{
-	  err = -EBUSY;
-	  break;
-	}
-
-      /* Setting by channel number */
-      if ((wrq->u.freq.m > USA_HOP_MOD) || (wrq->u.freq.e > 0))
-	err = -EOPNOTSUPP;
-      else
-	  local->sparm.b5.a_hop_pattern = wrq->u.freq.m;
-      break;
-
-      /* Get current network name (ESSID) */
-    case SIOCGIWESSID:
-      if (wrq->u.data.pointer)
-	{
-	  char essid[IW_ESSID_MAX_SIZE + 1];
-	  /* Get the essid that was set */
-	  memcpy(essid, local->sparm.b5.a_current_ess_id,
-		 IW_ESSID_MAX_SIZE);
-	  essid[IW_ESSID_MAX_SIZE] = '\0';
-
-	  /* Push it out ! */
-	  wrq->u.data.length = strlen(essid) + 1;
-	  wrq->u.data.flags = 1; /* active */
-	  copy_to_user(wrq->u.data.pointer, essid, sizeof(essid));
-	}
-      break;
-
-      /* Set desired network name (ESSID) */
-    case SIOCSIWESSID:
-      /* Reject if card is already initialised */
-      if(local->card_status != CARD_AWAITING_PARAM)
-	{
-	  err = -EBUSY;
-	  break;
-	}
-
-	if (wrq->u.data.pointer)
-	{
-	    char	card_essid[IW_ESSID_MAX_SIZE + 1];
-	    
-	    /* Check if we asked for `any' */
-	    if(wrq->u.data.flags == 0)
-	    {
-		/* Corey : can you do that ? */
-		err = -EOPNOTSUPP;
-	    }
-	    else
-	    {
-		/* Check the size of the string */
-		if(wrq->u.data.length >
-		   IW_ESSID_MAX_SIZE + 1)
-		{
-		    err = -E2BIG;
-		    break;
-		}
-		if (copy_from_user(card_essid,
-				   wrq->u.data.pointer,
-				   wrq->u.data.length)) {
-			err = -EFAULT;
-			break;
-		}
-		card_essid[IW_ESSID_MAX_SIZE] = '\0';
-
-		/* Set the ESSID in the card */
-		memcpy(local->sparm.b5.a_current_ess_id, card_essid,
-		       IW_ESSID_MAX_SIZE);
-	    }
-	}
-	break;
-
-      /* Get current Access Point (BSSID in our case) */
-    case SIOCGIWAP:
-      memcpy(wrq->u.ap_addr.sa_data, local->bss_id, ETH_ALEN);
-      wrq->u.ap_addr.sa_family = ARPHRD_ETHER;
-      break;
-
-      /* Get the current bit-rate */
-    case SIOCGIWRATE:
-      if(local->net_default_tx_rate == 3)
-	wrq->u.bitrate.value = 2000000;		/* Hum... */
-      else
-	wrq->u.bitrate.value = local->net_default_tx_rate * 500000;
-      wrq->u.bitrate.fixed = 0;		/* We are in auto mode */
-      break;
-
-      /* Set the desired bit-rate */
-    case SIOCSIWRATE:
-      /* Check if rate is in range */
-      if((wrq->u.bitrate.value != 1000000) &&
-	 (wrq->u.bitrate.value != 2000000))
-	{
-	  err = -EINVAL;
-	  break;
-	}
-      /* Hack for 1.5 Mb/s instead of 2 Mb/s */
-      if((local->fw_ver == 0x55) &&		/* Please check */
-	 (wrq->u.bitrate.value == 2000000))
-	local->net_default_tx_rate = 3;
-      else
-	local->net_default_tx_rate = wrq->u.bitrate.value/500000;
-      break;
-
-      /* Get the current RTS threshold */
-    case SIOCGIWRTS:
-      wrq->u.rts.value = (local->sparm.b5.a_rts_threshold[0] << 8)
-	+ local->sparm.b5.a_rts_threshold[1];
-#if WIRELESS_EXT > 8
-      wrq->u.rts.disabled = (wrq->u.rts.value == 32767);
-#endif /* WIRELESS_EXT > 8 */
-      wrq->u.rts.fixed = 1;
-      break;
-
-      /* Set the desired RTS threshold */
-    case SIOCSIWRTS:
-    {
-	int rthr = wrq->u.rts.value;
-
-      /* Reject if card is already initialised */
-      if(local->card_status != CARD_AWAITING_PARAM)
-	{
-	  err = -EBUSY;
-	  break;
-	}
-
-	/* if(wrq->u.rts.fixed == 0) we should complain */
-#if WIRELESS_EXT > 8
-	if(wrq->u.rts.disabled)
-	    rthr = 32767;
-	else
-#endif /* WIRELESS_EXT > 8 */
-	    if((rthr < 0) || (rthr > 2347)) /* What's the max packet size ??? */
-	    {
-		err = -EINVAL;
-		break;
-	    }
-	local->sparm.b5.a_rts_threshold[0] = (rthr >> 8) & 0xFF;
-	local->sparm.b5.a_rts_threshold[1] = rthr & 0xFF;
-    }
-    break;
-
-      /* Get the current fragmentation threshold */
-    case SIOCGIWFRAG:
-      wrq->u.frag.value = (local->sparm.b5.a_frag_threshold[0] << 8)
-	+ local->sparm.b5.a_frag_threshold[1];
-#if WIRELESS_EXT > 8
-      wrq->u.frag.disabled = (wrq->u.frag.value == 32767);
-#endif /* WIRELESS_EXT > 8 */
-      wrq->u.frag.fixed = 1;
-      break;
-
-      /* Set the desired fragmentation threshold */
-    case SIOCSIWFRAG:
-    {
-	int fthr = wrq->u.frag.value;
-
-      /* Reject if card is already initialised */
-      if(local->card_status != CARD_AWAITING_PARAM)
-	{
-	  err = -EBUSY;
-	  break;
-	}
-
-	/* if(wrq->u.frag.fixed == 0) should complain */
-#if WIRELESS_EXT > 8
-	if(wrq->u.frag.disabled)
-	    fthr = 32767;
-	else
-#endif /* WIRELESS_EXT > 8 */
-	    if((fthr < 256) || (fthr > 2347)) /* To check out ! */
-	    {
-		err = -EINVAL;
-		break;
-	    }
-	local->sparm.b5.a_frag_threshold[0] = (fthr >> 8) & 0xFF;
-	local->sparm.b5.a_frag_threshold[1] = fthr & 0xFF;
-    }
-    break;
-
-#endif	/* WIRELESS_EXT > 7 */
-#if WIRELESS_EXT > 8
-
-      /* Get the current mode of operation */
-    case SIOCGIWMODE:
-      if(local->sparm.b5.a_network_type)
-	wrq->u.mode = IW_MODE_INFRA;
-      else
-	wrq->u.mode = IW_MODE_ADHOC;
-      break;
-
-      /* Set the current mode of operation */
-    case SIOCSIWMODE:
-    {
-	char card_mode = 1;
-	
-      /* Reject if card is already initialised */
-      if(local->card_status != CARD_AWAITING_PARAM)
-	{
-	  err = -EBUSY;
-	  break;
-	}
-
-	switch (wrq->u.mode)
-	{
-	case IW_MODE_ADHOC:
-	    card_mode = 0;
-	    // Fall through
-	case IW_MODE_INFRA:
-	    local->sparm.b5.a_network_type = card_mode;
-	    break;
-	default:
-	    err = -EINVAL;
-	}
-    }
-    break;
-
-#endif /* WIRELESS_EXT > 8 */
-#if WIRELESS_EXT > 7
-      /* ------------------ IWSPY SUPPORT ------------------ */
-      /* Define the range (variations) of above parameters */
-    case SIOCGIWRANGE:
-      /* Basic checking... */
-      if(wrq->u.data.pointer != (caddr_t) 0)
-	{
-	  struct iw_range	range;
-	  memset((char *) &range, 0, sizeof(struct iw_range));
-
-	  /* Set the length (very important for backward compatibility) */
-	  wrq->u.data.length = sizeof(struct iw_range);
-
-#if WIRELESS_EXT > 10
-	  /* Set the Wireless Extension versions */
-	  range.we_version_compiled = WIRELESS_EXT;
-	  range.we_version_source = 9;
-#endif /* WIRELESS_EXT > 10 */
-
-	  /* Set information in the range struct */
-	  range.throughput = 1.1 * 1000 * 1000;	/* Put the right number here */
-	  range.num_channels = hop_pattern_length[(int)country]; 
-	  range.num_frequency = 0;
-	  range.max_qual.qual = 0;
-	  range.max_qual.level = 255;	/* What's the correct value ? */
-	  range.max_qual.noise = 255;	/* Idem */
-	  range.num_bitrates = 2;
-	  range.bitrate[0] = 1000000;	/* 1 Mb/s */
-	  range.bitrate[1] = 2000000;	/* 2 Mb/s */
-
-	  /* Copy structure to the user buffer */
-	  if(copy_to_user(wrq->u.data.pointer, &range,
-			  sizeof(struct iw_range)))
-	    err = -EFAULT;
-	}
-      break;
-
-#ifdef WIRELESS_SPY
-      /* Set addresses to spy */
-    case SIOCSIWSPY:
-      /* Check the number of addresses */
-      if(wrq->u.data.length > IW_MAX_SPY)
-	{
-	  err = -E2BIG;
-	  break;
-	}
-      local->spy_number = wrq->u.data.length;
-
-      /* If there is some addresses to copy */
-      if(local->spy_number > 0)
-	{
-	  struct sockaddr	address[IW_MAX_SPY];
-	  int			i;
-
-	  /* Copy addresses to the driver */
-	  if(copy_from_user(address, wrq->u.data.pointer,
-			    sizeof(struct sockaddr) * local->spy_number))
-	    {
-	      err = -EFAULT;
-	      break;
-	    }
-
-	  /* Copy addresses to the lp structure */
-	  for(i = 0; i < local->spy_number; i++)
-	    memcpy(local->spy_address[i], address[i].sa_data, ETH_ALEN);
-
-	  /* Reset structure... */
-	  memset(local->spy_stat, 0x00, sizeof(iw_qual) * IW_MAX_SPY);
-
-#ifdef DEBUG_IOCTL_INFO
-	  printk(KERN_DEBUG "SetSpy - Set of new addresses is :\n");
-	  for(i = 0; i < local->spy_number; i++)
-	    printk(KERN_DEBUG "%02X:%02X:%02X:%02X:%02X:%02X\n",
-		   local->spy_address[i][0],
-		   local->spy_address[i][1],
-		   local->spy_address[i][2],
-		   local->spy_address[i][3],
-		   local->spy_address[i][4],
-		   local->spy_address[i][5]);
-#endif	/* DEBUG_IOCTL_INFO */
-	}
-      break;
-
-      /* Get the spy list and spy stats */
-    case SIOCGIWSPY:
-      /* Set the number of addresses */
-      wrq->u.data.length = local->spy_number;
-
-      /* If the user want to have the addresses back... */
-      if((local->spy_number > 0) && (wrq->u.data.pointer != (caddr_t) 0))
-	{
-	  struct sockaddr	address[IW_MAX_SPY];
-	  int			i;
-
-	  /* Copy addresses from the lp structure */
-	  for(i = 0; i < local->spy_number; i++)
-	    {
-	      memcpy(address[i].sa_data, local->spy_address[i], ETH_ALEN);
-	      address[i].sa_family = ARPHRD_ETHER;
-	    }
-
-	  /* Copy addresses to the user buffer */
-	  if(copy_to_user(wrq->u.data.pointer, address,
-		       sizeof(struct sockaddr) * local->spy_number))
-	    {
-	      err = -EFAULT;
-	      break;
-	    }
-
-	  /* Copy stats to the user buffer (just after) */
-	  if(copy_to_user(wrq->u.data.pointer +
-		       (sizeof(struct sockaddr) * local->spy_number),
-		       local->spy_stat, sizeof(iw_qual) * local->spy_number))
-	    {
-	      err = -EFAULT;
-	      break;
-	    }
-
-	  /* Reset updated flags */
-	  for(i = 0; i < local->spy_number; i++)
-	    local->spy_stat[i].updated = 0x0;
-	}	/* if(pointer != NULL) */
-
-      break;
-#endif	/* WIRELESS_SPY */
-
-      /* ------------------ PRIVATE IOCTL ------------------ */
-#ifndef SIOCIWFIRSTPRIV
-#define SIOCIWFIRSTPRIV	SIOCDEVPRIVATE
-#endif /* SIOCIWFIRSTPRIV */
-#define SIOCSIPFRAMING	SIOCIWFIRSTPRIV		/* Set framing mode */
-#define SIOCGIPFRAMING	SIOCIWFIRSTPRIV + 1	/* Get framing mode */
-#define SIOCGIPCOUNTRY	SIOCIWFIRSTPRIV + 3	/* Get country code */
-    case SIOCSIPFRAMING:
-      if(!capable(CAP_NET_ADMIN))	/* For private IOCTLs, we need to check permissions */
-	{
-	  err = -EPERM;
-	  break;
-	}
-      translate = *(wrq->u.name);	/* Set framing mode */
-      break;
-    case SIOCGIPFRAMING:
-      *(wrq->u.name) = translate;
-      break;
-    case SIOCGIPCOUNTRY:
-      *(wrq->u.name) = country;
-      break;
-    case SIOCGIWPRIV:
-      /* Export our "private" intercace */
-      if(wrq->u.data.pointer != (caddr_t) 0)
-	{
-	  struct iw_priv_args	priv[] =
-	  {	/* cmd,		set_args,	get_args,	name */
-	    { SIOCSIPFRAMING, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, "set_framing" },
-	    { SIOCGIPFRAMING, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "get_framing" },
-	    { SIOCGIPCOUNTRY, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "get_country" },
-	  };
-	  /* Set the number of ioctl available */
-	  wrq->u.data.length = 3;
-	  /* Copy structure to the user buffer */
-	  if(copy_to_user(wrq->u.data.pointer, (u_char *) priv,
-		       sizeof(priv)))
-	    err = -EFAULT;
-	}
-      break;
-#endif	/* WIRELESS_EXT > 7 */
-
-
-        default:
-            DEBUG(0,"ray_dev_ioctl cmd = 0x%x\n", cmd);
-            err = -EOPNOTSUPP;
-    }
-    return err;
-} /* end ray_dev_ioctl */
-/*===========================================================================*/
-#if WIRELESS_EXT > 7	/* If wireless extension exist in the kernel */
-static iw_stats * ray_get_wireless_stats(struct net_device *	dev)
-{
-  ray_dev_t *	local = (ray_dev_t *) dev->priv;
-  dev_link_t *link = local->finder;
-  struct status *p = (struct status *)(local->sram + STATUS_BASE);
-
-  if(local == (ray_dev_t *) NULL)
-    return (iw_stats *) NULL;
-
-  local->wstats.status = local->card_status;
-#ifdef WIRELESS_SPY
-  if((local->spy_number > 0) && (local->sparm.b5.a_network_type == 0))
-    {
-      /* Get it from the first node in spy list */
-      local->wstats.qual.qual = local->spy_stat[0].qual;
-      local->wstats.qual.level = local->spy_stat[0].level;
-      local->wstats.qual.noise = local->spy_stat[0].noise;
-      local->wstats.qual.updated = local->spy_stat[0].updated;
-    }
-#endif /* WIRELESS_SPY */
-
-  if((link->state & DEV_PRESENT)) {
-    local->wstats.qual.noise = readb(&p->rxnoise);
-    local->wstats.qual.updated |= 4;
-  }
-
-  return &local->wstats;
-} /* end ray_get_wireless_stats */
-#endif	/* WIRELESS_EXT > 7 */
-/*===========================================================================*/
-static int ray_open(struct net_device *dev)
-{
-    dev_link_t *link;
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
-    
-    MOD_INC_USE_COUNT;
-
-    DEBUG(1, "ray_open('%s')\n", dev->name);
-
-    for (link = dev_list; link; link = link->next)
-        if (link->priv == dev) break;
-    if (!DEV_OK(link)) {
-        MOD_DEC_USE_COUNT;
-        return -ENODEV;
-    }
-
-    if (link->open == 0) local->num_multi = 0;
-    link->open++;
-
-    /* If the card is not started, time to start it ! - Jean II */
-    if(local->card_status == CARD_AWAITING_PARAM) {
-	int i;
-
-	DEBUG(1,"ray_open: doing init now !\n");
-
-	/* Download startup parameters */
-	if ( (i = dl_startup_params(dev)) < 0)
-	  {
-	    printk(KERN_INFO "ray_dev_init dl_startup_params failed - "
-		   "returns 0x%x\n",i);
-	    return -1;
-	  }
-     }
-
-    if (sniffer) netif_stop_queue(dev);
-    else         netif_start_queue(dev);
-
-    DEBUG(2,"ray_open ending\n");
-    return 0;
-} /* end ray_open */
-/*===========================================================================*/
-static int ray_dev_close(struct net_device *dev)
-{
-    dev_link_t *link;
-
-    DEBUG(1, "ray_dev_close('%s')\n", dev->name);
-
-    for (link = dev_list; link; link = link->next)
-        if (link->priv == dev) break;
-    if (link == NULL)
-        return -ENODEV;
-
-    link->open--;
-    netif_stop_queue(dev);
-    if (link->state & DEV_STALE_CONFIG)
-	mod_timer(&link->release, jiffies + HZ/20);
-
-    /* In here, we should stop the hardware (stop card from beeing active)
-     * and set local->card_status to CARD_AWAITING_PARAM, so that while the
-     * card is closed we can chage its configuration.
-     * Probably also need a COR reset to get sane state - Jean II */
-
-    MOD_DEC_USE_COUNT;
-
-    return 0;
-} /* end ray_dev_close */
-/*===========================================================================*/
-static void ray_reset(struct net_device *dev) {
-    DEBUG(1,"ray_reset entered\n");
-    return;
-}
-/*===========================================================================*/
-/* Cause a firmware interrupt if it is ready for one                         */
-/* Return nonzero if not ready                                               */
-static int interrupt_ecf(ray_dev_t *local, int ccs)
-{
-    int i = 50;
-    dev_link_t *link = local->finder;
-
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_cs interrupt_ecf - device not present\n");
-        return -1;
-    }
-    DEBUG(2,"interrupt_ecf(local=%p, ccs = 0x%x\n",local,ccs);
-
-    while ( i && 
-            (readb(local->amem + CIS_OFFSET + ECF_INTR_OFFSET) & ECF_INTR_SET))
-        i--;
-    if (i == 0) {
-        DEBUG(2,"ray_cs interrupt_ecf card not ready for interrupt\n");
-        return -1;
-    }
-	/* Fill the mailbox, then kick the card */
-    writeb(ccs, local->sram + SCB_BASE);
-    writeb(ECF_INTR_SET, local->amem + CIS_OFFSET + ECF_INTR_OFFSET);
-    return 0;
-} /* interrupt_ecf */
-/*===========================================================================*/
-/* Get next free transmit CCS                                                */
-/* Return - index of current tx ccs                                          */
-static int get_free_tx_ccs(ray_dev_t *local)
-{
-    int i;
-    struct ccs *pccs = (struct ccs *)(local->sram + CCS_BASE);
-    dev_link_t *link = local->finder;
-
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_cs get_free_tx_ccs - device not present\n");
-        return ECARDGONE;
-    }
-
-    if (test_and_set_bit(0,&local->tx_ccs_lock)) {
-        DEBUG(1,"ray_cs tx_ccs_lock busy\n");
-        return ECCSBUSY;
-    } 
-
-    for (i=0; i < NUMBER_OF_TX_CCS; i++) {
-        if (readb(&(pccs+i)->buffer_status) == CCS_BUFFER_FREE) {
-            writeb(CCS_BUFFER_BUSY, &(pccs+i)->buffer_status);
-            writeb(CCS_END_LIST, &(pccs+i)->link);
-			local->tx_ccs_lock = 0;
-            return i;
-        }
-    }
-	local->tx_ccs_lock = 0;
-    DEBUG(2,"ray_cs ERROR no free tx CCS for raylink card\n");
-    return ECCSFULL;
-} /* get_free_tx_ccs */
-/*===========================================================================*/
-/* Get next free CCS                                                         */
-/* Return - index of current ccs                                             */
-static int get_free_ccs(ray_dev_t *local)
-{
-    int i;
-    struct ccs *pccs = (struct ccs *)(local->sram + CCS_BASE);
-    dev_link_t *link = local->finder;
-
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_cs get_free_ccs - device not present\n");
-        return ECARDGONE;
-    }
-    if (test_and_set_bit(0,&local->ccs_lock)) {
-        DEBUG(1,"ray_cs ccs_lock busy\n");
-        return ECCSBUSY;
-    } 
-
-    for (i = NUMBER_OF_TX_CCS; i < NUMBER_OF_CCS; i++) {
-        if (readb(&(pccs+i)->buffer_status) == CCS_BUFFER_FREE) {
-            writeb(CCS_BUFFER_BUSY, &(pccs+i)->buffer_status);
-            writeb(CCS_END_LIST, &(pccs+i)->link);
-			local->ccs_lock = 0;
-            return i;
-        }
-    }
-	local->ccs_lock = 0;
-    DEBUG(1,"ray_cs ERROR no free CCS for raylink card\n");
-    return ECCSFULL;
-} /* get_free_ccs */
-/*===========================================================================*/
-static void authenticate_timeout(u_long data)
-{
-    ray_dev_t *local = (ray_dev_t *)data;
-    del_timer(&local->timer);
-    printk(KERN_INFO "ray_cs Authentication with access point failed"
-       " - timeout\n");
-    join_net((u_long)local);
-}
-/*===========================================================================*/
-static int asc_to_int(char a)
-{
-    if (a < '0') return -1;
-    if (a <= '9') return (a - '0');
-    if (a < 'A') return -1;
-    if (a <= 'F') return (10 + a - 'A');
-    if (a < 'a') return -1;
-    if (a <= 'f') return (10 + a - 'a');
-    return -1;
-}
-/*===========================================================================*/
-static int parse_addr(char *in_str, UCHAR *out)
-{
-    int len;
-    int i,j,k;
-    int status;
-    
-    if (in_str == NULL) return 0;
-    if ((len = strlen(in_str)) < 2) return 0;
-    memset(out, 0, ADDRLEN);
-
-    status = 1;
-    j = len - 1;
-    if (j > 12) j = 12;
-    i = 5;
-    
-    while (j > 0)
-    {
-        if ((k = asc_to_int(in_str[j--])) != -1) out[i] = k;
-        else return 0;
-
-        if (j == 0) break;
-        if ((k = asc_to_int(in_str[j--])) != -1) out[i] += k << 4;
-        else return 0;
-        if (!i--) break;
-    }
-    return status;
-}
-/*===========================================================================*/
-static struct net_device_stats *ray_get_stats(struct net_device *dev)
-{
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
-    dev_link_t *link = local->finder;
-    struct status *p = (struct status *)(local->sram + STATUS_BASE);
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_cs net_device_stats - device not present\n");
-        return &local->stats;
-    }
-    if (readb(&p->mrx_overflow_for_host))
-    {
-        local->stats.rx_over_errors += ntohs(readb(&p->mrx_overflow));
-        writeb(0,&p->mrx_overflow);
-        writeb(0,&p->mrx_overflow_for_host);
-    }
-    if (readb(&p->mrx_checksum_error_for_host))
-    {
-        local->stats.rx_crc_errors += ntohs(readb(&p->mrx_checksum_error));
-        writeb(0,&p->mrx_checksum_error);
-        writeb(0,&p->mrx_checksum_error_for_host);
-    }
-    if (readb(&p->rx_hec_error_for_host))
-    {
-        local->stats.rx_frame_errors += ntohs(readb(&p->rx_hec_error));
-        writeb(0,&p->rx_hec_error);
-        writeb(0,&p->rx_hec_error_for_host);
-    }
-    return &local->stats;
-}
-/*===========================================================================*/
-static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len)
-{
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
-    dev_link_t *link = local->finder;
-    int ccsindex;
-    int i;
-    struct ccs *pccs;
-
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_update_parm - device not present\n");
-        return;
-    }
-
-    if ((ccsindex = get_free_ccs(local)) < 0)
-    {
-        DEBUG(0,"ray_update_parm - No free ccs\n");
-        return;
-    }
-    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
-    writeb(CCS_UPDATE_PARAMS, &pccs->cmd);
-    writeb(objid, &pccs->var.update_param.object_id);
-    writeb(1, &pccs->var.update_param.number_objects);
-    writeb(0, &pccs->var.update_param.failure_cause);
-    for (i=0; i<len; i++) {
-        writeb(value[i], local->sram + HOST_TO_ECF_BASE);
-    }
-    /* Interrupt the firmware to process the command */
-    if (interrupt_ecf(local, ccsindex)) {
-        DEBUG(0,"ray_cs associate failed - ECF not ready for intr\n");
-        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
-    }
-}
-/*===========================================================================*/
-static void ray_update_multi_list(struct net_device *dev, int all)
-{
-    struct dev_mc_list *dmi, **dmip;
-    int ccsindex;
-    struct ccs *pccs;
-    int i = 0;
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
-    dev_link_t *link = local->finder;
-    UCHAR *p = local->sram + HOST_TO_ECF_BASE;
-
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_update_multi_list - device not present\n");
-        return;
-    }
-    else 
-        DEBUG(2,"ray_update_multi_list(%p)\n",dev);
-    if ((ccsindex = get_free_ccs(local)) < 0)
-    {
-        DEBUG(1,"ray_update_multi - No free ccs\n");
-        return;
-    }
-    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
-    writeb(CCS_UPDATE_MULTICAST_LIST, &pccs->cmd);
-
-    if (all) {
-        writeb(0xff, &pccs->var);
-        local->num_multi = 0xff;
-    }
-    else {
-        /* Copy the kernel's list of MC addresses to card */
-        for (dmip=&dev->mc_list; (dmi=*dmip)!=NULL; dmip=&dmi->next) {
-            memcpy_toio(p, dmi->dmi_addr, ETH_ALEN);
-            DEBUG(1,"ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n",dmi->dmi_addr[0],dmi->dmi_addr[1],dmi->dmi_addr[2],dmi->dmi_addr[3],dmi->dmi_addr[4],dmi->dmi_addr[5]);
-            p += ETH_ALEN;
-            i++;
-        }
-        if (i > 256/ADDRLEN) i = 256/ADDRLEN;
-        writeb((UCHAR)i, &pccs->var);
-        DEBUG(1,"ray_cs update_multi %d addresses in list\n", i);
-        /* Interrupt the firmware to process the command */
-        local->num_multi = i;
-    }
-    if (interrupt_ecf(local, ccsindex)) {
-        DEBUG(1,"ray_cs update_multi failed - ECF not ready for intr\n");
-        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
-    }
-} /* end ray_update_multi_list */
-/*===========================================================================*/
-static void set_multicast_list(struct net_device *dev)
-{
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
-    UCHAR promisc;
-
-    DEBUG(2,"ray_cs set_multicast_list(%p)\n",dev);
-
-    if (dev->flags & IFF_PROMISC)
-    {
-        if (local->sparm.b5.a_promiscuous_mode == 0) {
-            DEBUG(1,"ray_cs set_multicast_list promisc on\n");
-            local->sparm.b5.a_promiscuous_mode = 1;
-            promisc = 1;
-            ray_update_parm(dev,  OBJID_promiscuous_mode, \
-                            &promisc, sizeof(promisc));
-        }
-    }
-    else {
-        if (local->sparm.b5.a_promiscuous_mode == 1) {
-            DEBUG(1,"ray_cs set_multicast_list promisc off\n");
-            local->sparm.b5.a_promiscuous_mode = 0;
-            promisc = 0;
-            ray_update_parm(dev,  OBJID_promiscuous_mode, \
-                            &promisc, sizeof(promisc));
-        }
-    }
-
-    if (dev->flags & IFF_ALLMULTI) ray_update_multi_list(dev, 1);
-    else
-    {
-        if (local->num_multi != dev->mc_count) ray_update_multi_list(dev, 0);
-    }
-} /* end set_multicast_list */
-/*=============================================================================
- * All routines below here are run at interrupt time.
-=============================================================================*/
-static void ray_interrupt(int irq, void *dev_id, struct pt_regs * regs)
-{
-    struct net_device *dev = (struct net_device *)dev_id;
-    dev_link_t *link;
-    ray_dev_t *local;
-    struct ccs *pccs;
-    struct rcs *prcs;
-    UCHAR rcsindex;
-    UCHAR tmp;
-    UCHAR cmd;
-    UCHAR status;
-
-    if (dev == NULL) /* Note that we want interrupts with dev->start == 0 */
-    return;
-
-    DEBUG(4,"ray_cs: interrupt for *dev=%p\n",dev);
-
-    local = (ray_dev_t *)dev->priv;
-    link = (dev_link_t *)local->finder;
-    if ( ! (link->state & DEV_PRESENT) || link->state & DEV_SUSPEND ) {
-        DEBUG(2,"ray_cs interrupt from device not present or suspended.\n");
-        return;
-    }
-    rcsindex = readb(&((struct scb *)(local->sram))->rcs_index);
-
-    if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS))
-    {
-        DEBUG(1,"ray_cs interrupt bad rcsindex = 0x%x\n",rcsindex);
-        clear_interrupt(local);
-        return;
-    }
-    if (rcsindex < NUMBER_OF_CCS) /* If it's a returned CCS */
-    {
-        pccs = ((struct ccs *) (local->sram + CCS_BASE)) + rcsindex;
-        cmd = readb(&pccs->cmd);
-        status = readb(&pccs->buffer_status);
-        switch (cmd)
-        {
-        case CCS_DOWNLOAD_STARTUP_PARAMS: /* Happens in firmware someday */
-            del_timer(&local->timer);
-            if (status == CCS_COMMAND_COMPLETE) {
-                DEBUG(1,"ray_cs interrupt download_startup_parameters OK\n");
-            }
-            else {
-                DEBUG(1,"ray_cs interrupt download_startup_parameters fail\n");
-            }
-            break;
-        case CCS_UPDATE_PARAMS:
-            DEBUG(1,"ray_cs interrupt update params done\n");
-            if (status != CCS_COMMAND_COMPLETE) {
-                tmp = readb(&pccs->var.update_param.failure_cause);
-            DEBUG(0,"ray_cs interrupt update params failed - reason %d\n",tmp);
-            }
-            break;
-        case CCS_REPORT_PARAMS:
-            DEBUG(1,"ray_cs interrupt report params done\n");
-            break;
-        case CCS_UPDATE_MULTICAST_LIST: /* Note that this CCS isn't returned */
-            DEBUG(1,"ray_cs interrupt CCS Update Multicast List done\n");
-            break;
-        case CCS_UPDATE_POWER_SAVINGS_MODE:
-            DEBUG(1,"ray_cs interrupt update power save mode done\n");
-            break;
-        case CCS_START_NETWORK:
-        case CCS_JOIN_NETWORK:
-            if (status == CCS_COMMAND_COMPLETE) {
-                if (readb(&pccs->var.start_network.net_initiated) == 1) {
-                    DEBUG(0,"ray_cs interrupt network \"%s\" started\n",\
-                          local->sparm.b4.a_current_ess_id);
-                }
-                else {
-                    DEBUG(0,"ray_cs interrupt network \"%s\" joined\n",\
-                          local->sparm.b4.a_current_ess_id);
-                }
-                memcpy_fromio(&local->bss_id,pccs->var.start_network.bssid,ADDRLEN);
-
-                if (local->fw_ver == 0x55) local->net_default_tx_rate = 3;
-                else local->net_default_tx_rate = 
-                         readb(&pccs->var.start_network.net_default_tx_rate);
-                local->encryption = readb(&pccs->var.start_network.encryption);
-                if (!sniffer && (local->net_type == INFRA)
-                    && !(local->sparm.b4.a_acting_as_ap_status)) {
-                    authenticate(local);
-                }
-                local->card_status = CARD_ACQ_COMPLETE;
-            }
-            else {
-                local->card_status = CARD_ACQ_FAILED;
-
-                del_timer(&local->timer);
-                local->timer.expires = jiffies + HZ*5;
-                local->timer.data = (long)local;
-                if (status == CCS_START_NETWORK) {
-                    DEBUG(0,"ray_cs interrupt network \"%s\" start failed\n",\
-                          local->sparm.b4.a_current_ess_id);
-                    local->timer.function = &start_net;
-                }
-                else {
-                    DEBUG(0,"ray_cs interrupt network \"%s\" join failed\n",\
-                          local->sparm.b4.a_current_ess_id);
-                    local->timer.function = &join_net;
-                }
-                add_timer(&local->timer);
-            }
-            break;
-        case CCS_START_ASSOCIATION:
-            if (status == CCS_COMMAND_COMPLETE) {
-                local->card_status = CARD_ASSOC_COMPLETE;
-                DEBUG(0,"ray_cs association successful\n");
-            }
-            else
-            {
-                DEBUG(0,"ray_cs association failed,\n");
-                local->card_status = CARD_ASSOC_FAILED;
-                join_net((u_long)local);
-            }
-            break;
-        case CCS_TX_REQUEST:
-            if (status == CCS_COMMAND_COMPLETE) {
-                DEBUG(3,"ray_cs interrupt tx request complete\n");
-            }
-            else {
-                DEBUG(1,"ray_cs interrupt tx request failed\n");
-            }
-            if (!sniffer) netif_start_queue(dev);
-            netif_wake_queue(dev);
-            break;
-        case CCS_TEST_MEMORY:
-            DEBUG(1,"ray_cs interrupt mem test done\n");
-            break;
-        case CCS_SHUTDOWN:
-            DEBUG(1,"ray_cs interrupt Unexpected CCS returned - Shutdown\n");
-            break;
-        case CCS_DUMP_MEMORY:
-            DEBUG(1,"ray_cs interrupt dump memory done\n");
-            break;
-        case CCS_START_TIMER:
-            DEBUG(2,"ray_cs interrupt DING - raylink timer expired\n");
-            break;
-        default:
-            DEBUG(1,"ray_cs interrupt Unexpected CCS 0x%x returned 0x%x\n",\
-                  rcsindex, cmd);
-        }
-        writeb(CCS_BUFFER_FREE, &pccs->buffer_status);
-    }
-    else /* It's an RCS */
-    {
-        prcs = ((struct rcs *)(local->sram + CCS_BASE)) + rcsindex;
-    
-        switch (readb(&prcs->interrupt_id))
-        {
-        case PROCESS_RX_PACKET:
-            ray_rx(dev, local, prcs);
-            break;
-        case REJOIN_NET_COMPLETE:
-            DEBUG(1,"ray_cs interrupt rejoin net complete\n");
-            local->card_status = CARD_ACQ_COMPLETE;
-            /* do we need to clear tx buffers CCS's? */
-            if (local->sparm.b4.a_network_type == ADHOC) {
-                if (!sniffer) netif_start_queue(dev);
-            }
-            else {
-                memcpy_fromio(&local->bss_id, prcs->var.rejoin_net_complete.bssid, ADDRLEN);
-                DEBUG(1,"ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n",\
-                      local->bss_id[0], local->bss_id[1], local->bss_id[2],\
-                      local->bss_id[3], local->bss_id[4], local->bss_id[5]);
-                if (!sniffer) authenticate(local);
-            }
-            break;
-        case ROAMING_INITIATED:
-            DEBUG(1,"ray_cs interrupt roaming initiated\n"); 
-            netif_stop_queue(dev);
-            local->card_status = CARD_DOING_ACQ;
-            break;
-        case JAPAN_CALL_SIGN_RXD:
-            DEBUG(1,"ray_cs interrupt japan call sign rx\n");
-            break;
-        default:
-            DEBUG(1,"ray_cs Unexpected interrupt for RCS 0x%x cmd = 0x%x\n",\
-                  rcsindex, (unsigned int) readb(&prcs->interrupt_id));
-            break;
-        }
-        writeb(CCS_BUFFER_FREE, &prcs->buffer_status);
-    }
-    clear_interrupt(local);
-} /* ray_interrupt */
-/*===========================================================================*/
-static void ray_rx(struct net_device *dev, ray_dev_t *local, struct rcs *prcs)
-{
-    int rx_len;
-    unsigned int pkt_addr;
-    UCHAR *pmsg;
-    DEBUG(4,"ray_rx process rx packet\n");
-
-    /* Calculate address of packet within Rx buffer */
-    pkt_addr = ((readb(&prcs->var.rx_packet.rx_data_ptr[0]) << 8)
-                + readb(&prcs->var.rx_packet.rx_data_ptr[1])) & RX_BUFF_END;
-    /* Length of first packet fragment */
-    rx_len = (readb(&prcs->var.rx_packet.rx_data_length[0]) << 8)
-        + readb(&prcs->var.rx_packet.rx_data_length[1]);
-
-    local->last_rsl = readb(&prcs->var.rx_packet.rx_sig_lev);
-    pmsg = local->rmem + pkt_addr;
-    switch(readb(pmsg))
-    {
-    case DATA_TYPE:
-        DEBUG(4,"ray_rx data type\n");
-        rx_data(dev, prcs, pkt_addr, rx_len);
-        break;
-    case AUTHENTIC_TYPE:
-        DEBUG(4,"ray_rx authentic type\n");
-        if (sniffer) rx_data(dev, prcs, pkt_addr, rx_len);
-        else rx_authenticate(local, prcs, pkt_addr, rx_len);
-        break;
-    case DEAUTHENTIC_TYPE:
-        DEBUG(4,"ray_rx deauth type\n");
-        if (sniffer) rx_data(dev, prcs, pkt_addr, rx_len);
-        else rx_deauthenticate(local, prcs, pkt_addr, rx_len);
-        break;
-    case NULL_MSG_TYPE:
-        DEBUG(3,"ray_cs rx NULL msg\n");
-        break;
-    case BEACON_TYPE:
-        DEBUG(4,"ray_rx beacon type\n");
-        if (sniffer) rx_data(dev, prcs, pkt_addr, rx_len);
-
-        copy_from_rx_buff(local, (UCHAR *)&local->last_bcn, pkt_addr, 
-                          rx_len < sizeof(struct beacon_rx) ? 
-                          rx_len : sizeof(struct beacon_rx));
-
-	local->beacon_rxed = 1;
-        /* Get the statistics so the card counters never overflow */
-        ray_get_stats(dev);
-            break;
-    default:
-        DEBUG(0,"ray_cs unknown pkt type %2x\n", (unsigned int) readb(pmsg));
-        break;
-    }
-
-} /* end ray_rx */
-/*===========================================================================*/
-static void rx_data(struct net_device *dev, struct rcs *prcs, unsigned int pkt_addr, 
-             int rx_len)
-{
-    struct sk_buff *skb = NULL;
-    struct rcs *prcslink = prcs;
-    ray_dev_t *local = dev->priv;
-    UCHAR *rx_ptr;
-    int total_len;
-    int tmp;
-#ifdef WIRELESS_SPY
-    int siglev = local->last_rsl;
-    u_char linksrcaddr[ETH_ALEN];	/* Other end of the wireless link */
-#endif
-
-    if (!sniffer) {
-        if (translate) {
-/* TBD length needs fixing for translated header */
-            if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) ||
-                rx_len > (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + FCS_LEN)) 
-            {
-                DEBUG(0,"ray_cs invalid packet length %d received \n",rx_len);
-                return;
-            }
-        }
-        else /* encapsulated ethernet */ {
-            if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) ||
-                rx_len > (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + FCS_LEN))
-            {
-                DEBUG(0,"ray_cs invalid packet length %d received \n",rx_len);
-                return;
-            }
-        }
-    }
-    DEBUG(4,"ray_cs rx_data packet\n");
-    /* If fragmented packet, verify sizes of fragments add up */
-    if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) {
-        DEBUG(1,"ray_cs rx'ed fragment\n");
-        tmp = (readb(&prcs->var.rx_packet.totalpacketlength[0]) << 8)
-            +  readb(&prcs->var.rx_packet.totalpacketlength[1]);
-        total_len = tmp;
-        prcslink = prcs;
-        do {
-            tmp -= (readb(&prcslink->var.rx_packet.rx_data_length[0]) << 8)
-                +   readb(&prcslink->var.rx_packet.rx_data_length[1]);
-            if (readb(&prcslink->var.rx_packet.next_frag_rcs_index) == 0xFF
-                || tmp < 0) break;
-            prcslink = ((struct rcs *)(local->sram + CCS_BASE))
-                + readb(&prcslink->link_field);
-        } while (1);
-
-        if (tmp < 0)
-        {
-            DEBUG(0,"ray_cs rx_data fragment lengths don't add up\n");
-            local->stats.rx_dropped++; 
-            release_frag_chain(local, prcs);
-            return;
-        }
-    }
-    else { /* Single unfragmented packet */
-        total_len = rx_len;
-    }
-
-    skb = dev_alloc_skb( total_len+5 );
-    if (skb == NULL)
-    {
-        DEBUG(0,"ray_cs rx_data could not allocate skb\n");
-        local->stats.rx_dropped++; 
-        if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF)
-            release_frag_chain(local, prcs);
-        return;
-    }
-    skb_reserve( skb, 2);   /* Align IP on 16 byte (TBD check this)*/
-    skb->dev = dev;
-
-    DEBUG(4,"ray_cs rx_data total_len = %x, rx_len = %x\n",total_len,rx_len);
-
-/************************/
-    /* Reserve enough room for the whole damn packet. */
-    rx_ptr = skb_put( skb, total_len);
-    /* Copy the whole packet to sk_buff */
-    rx_ptr += copy_from_rx_buff(local, rx_ptr, pkt_addr & RX_BUFF_END, rx_len);
-    /* Get source address */
-#ifdef WIRELESS_SPY
-    memcpy(linksrcaddr, ((struct mac_header *)skb->data)->addr_2, ETH_ALEN);
-#endif
-    /* Now, deal with encapsulation/translation/sniffer */
-    if (!sniffer) {
-        if (!translate) { 
-            /* Encapsulated ethernet, so just lop off 802.11 MAC header */
-/* TBD reserve            skb_reserve( skb, RX_MAC_HEADER_LENGTH); */
-            skb_pull( skb, RX_MAC_HEADER_LENGTH);
-        }
-        else {
-            /* Do translation */
-            untranslate(local, skb, total_len);
-        }
-    }
-    else 
-    {  /* sniffer mode, so just pass whole packet */  };
-
-/************************/
-    /* Now pick up the rest of the fragments if any */
-    tmp = 17; 
-    if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) {
-        prcslink = prcs;
-        DEBUG(1,"ray_cs rx_data in fragment loop\n");
-        do {
-            prcslink = ((struct rcs *)(local->sram + CCS_BASE))
-                + readb(&prcslink->var.rx_packet.next_frag_rcs_index);
-            rx_len = (( readb(&prcslink->var.rx_packet.rx_data_length[0]) << 8)
-                      + readb(&prcslink->var.rx_packet.rx_data_length[1]))
-                & RX_BUFF_END;
-            pkt_addr = (( readb(&prcslink->var.rx_packet.rx_data_ptr[0]) << 8)
-                        + readb(&prcslink->var.rx_packet.rx_data_ptr[1]))
-                & RX_BUFF_END;
-
-            rx_ptr += copy_from_rx_buff(local, rx_ptr, pkt_addr, rx_len);
-
-        } while (tmp-- && 
-                 readb(&prcslink->var.rx_packet.next_frag_rcs_index) != 0xFF);
-        release_frag_chain(local, prcs);
-    }
-
-    skb->protocol = eth_type_trans(skb,dev);
-    netif_rx(skb);
-    dev->last_rx = jiffies;
-    local->stats.rx_packets++;
-    local->stats.rx_bytes += total_len;
-
-    /* Gather signal strength per address */
-#ifdef WIRELESS_SPY
-    /* For the Access Point or the node having started the ad-hoc net
-     * note : ad-hoc work only in some specific configurations, but we
-     * kludge in ray_get_wireless_stats... */
-    if(!memcmp(linksrcaddr, local->bss_id, ETH_ALEN))
-      {
-	/* Update statistics */
-	/*local->wstats.qual.qual = none ? */
-	local->wstats.qual.level = siglev;
-	/*local->wstats.qual.noise = none ? */
-	local->wstats.qual.updated = 0x2;
-      }
-    /* Now, for the addresses in the spy list */
-    {
-      int	i;
-      /* Look all addresses */
-      for(i = 0; i < local->spy_number; i++)
-	/* If match */
-	if(!memcmp(linksrcaddr, local->spy_address[i], ETH_ALEN))
-	  {
-	    /* Update statistics */
-	    /*local->spy_stat[i].qual = none ? */
-	    local->spy_stat[i].level = siglev;
-	    /*local->spy_stat[i].noise = none ? */
-	    local->spy_stat[i].updated = 0x2;
-	  }
-    }
-#endif	/* WIRELESS_SPY */
-} /* end rx_data */
-/*===========================================================================*/
-static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
-{
-    snaphdr_t *psnap = (snaphdr_t *)(skb->data + RX_MAC_HEADER_LENGTH);
-    struct mac_header *pmac = (struct mac_header *)skb->data;
-    unsigned short type = *(unsigned short *)psnap->ethertype;
-    unsigned int xsap = *(unsigned int *)psnap & 0x00ffffff;
-    unsigned int org = (*(unsigned int *)psnap->org) & 0x00ffffff;
-    int delta;
-    struct ethhdr *peth;
-    UCHAR srcaddr[ADDRLEN];
-    UCHAR destaddr[ADDRLEN];
-
-    if (pmac->frame_ctl_2 & FC2_FROM_DS) {
-	if (pmac->frame_ctl_2 & FC2_TO_DS) { /* AP to AP */
-	    memcpy(destaddr, pmac->addr_3, ADDRLEN);
-	    memcpy(srcaddr, ((unsigned char *)pmac->addr_3) + ADDRLEN, ADDRLEN);
-	} else { /* AP to terminal */
-	    memcpy(destaddr, pmac->addr_1, ADDRLEN);
-	    memcpy(srcaddr, pmac->addr_3, ADDRLEN); 
-	}
-    } else { /* Terminal to AP */
-	if (pmac->frame_ctl_2 & FC2_TO_DS) {
-	    memcpy(destaddr, pmac->addr_3, ADDRLEN);
-	    memcpy(srcaddr, pmac->addr_2, ADDRLEN); 
-	} else { /* Adhoc */
-	    memcpy(destaddr, pmac->addr_1, ADDRLEN);
-	    memcpy(srcaddr, pmac->addr_2, ADDRLEN); 
-	}
-    }
-
-#ifdef PCMCIA_DEBUG
-    if (pc_debug > 3) {
-    int i;
-    printk(KERN_DEBUG "skb->data before untranslate");
-    for (i=0;i<64;i++) 
-        printk("%02x ",skb->data[i]);
-    printk("\n" KERN_DEBUG "type = %08x, xsap = %08x, org = %08x\n",
-           type,xsap,org);
-    printk(KERN_DEBUG "untranslate skb->data = %p\n",skb->data);
-    }
-#endif
-
-    if ( xsap != SNAP_ID) {
-        /* not a snap type so leave it alone */
-        DEBUG(3,"ray_cs untranslate NOT SNAP %x\n", *(unsigned int *)psnap & 0x00ffffff);
-
-        delta = RX_MAC_HEADER_LENGTH - ETH_HLEN;
-        peth = (struct ethhdr *)(skb->data + delta);
-        peth->h_proto = htons(len - RX_MAC_HEADER_LENGTH);
-    }
-    else { /* Its a SNAP */
-        if (org == BRIDGE_ENCAP) { /* EtherII and nuke the LLC  */
-        DEBUG(3,"ray_cs untranslate Bridge encap\n");
-            delta = RX_MAC_HEADER_LENGTH 
-                + sizeof(struct snaphdr_t) - ETH_HLEN;
-            peth = (struct ethhdr *)(skb->data + delta);
-            peth->h_proto = type;
-        }
-        else {
-            if (org == RFC1042_ENCAP) {
-                switch (type) {
-                case RAY_IPX_TYPE:
-                case APPLEARP_TYPE:
-                    DEBUG(3,"ray_cs untranslate RFC IPX/AARP\n");
-                    delta = RX_MAC_HEADER_LENGTH - ETH_HLEN;
-                    peth = (struct ethhdr *)(skb->data + delta);
-                    peth->h_proto = htons(len - RX_MAC_HEADER_LENGTH);
-                    break;
-                default:
-                    DEBUG(3,"ray_cs untranslate RFC default\n");
-                    delta = RX_MAC_HEADER_LENGTH + 
-                        sizeof(struct snaphdr_t) - ETH_HLEN;
-                    peth = (struct ethhdr *)(skb->data + delta);
-                    peth->h_proto = type;
-                    break;
-                }
-            }
-            else {
-                printk("ray_cs untranslate very confused by packet\n");
-                delta = RX_MAC_HEADER_LENGTH - ETH_HLEN;
-                peth = (struct ethhdr *)(skb->data + delta);
-                peth->h_proto = type;
-            }
-        }
-    }
-/* TBD reserve  skb_reserve(skb, delta); */
-    skb_pull(skb, delta);
-    DEBUG(3,"untranslate after skb_pull(%d), skb->data = %p\n",delta,skb->data);
-    memcpy(peth->h_dest, destaddr, ADDRLEN);
-    memcpy(peth->h_source, srcaddr, ADDRLEN);
-#ifdef PCMCIA_DEBUG
-    if (pc_debug > 3) {
-    int i;
-    printk(KERN_DEBUG "skb->data after untranslate:");
-    for (i=0;i<64;i++)
-        printk("%02x ",skb->data[i]);
-    printk("\n");
-    }
-#endif
-} /* end untranslate */
-/*===========================================================================*/
-/* Copy data from circular receive buffer to PC memory.
- * dest     = destination address in PC memory
- * pkt_addr = source address in receive buffer
- * len      = length of packet to copy
- */
-static int copy_from_rx_buff(ray_dev_t *local, UCHAR *dest, int pkt_addr, int length)
-{
-    int wrap_bytes = (pkt_addr + length) - (RX_BUFF_END + 1);
-    if (wrap_bytes <= 0)
-    {
-        memcpy_fromio(dest,local->rmem + pkt_addr,length);
-    }
-    else /* Packet wrapped in circular buffer */
-    {
-        memcpy_fromio(dest,local->rmem+pkt_addr,length - wrap_bytes);
-        memcpy_fromio(dest + length - wrap_bytes, local->rmem, wrap_bytes);
-    }
-    return length;
-}
-/*===========================================================================*/
-static void release_frag_chain(ray_dev_t *local, struct rcs* prcs)
-{
-    struct rcs *prcslink = prcs;
-    int tmp = 17;
-    unsigned rcsindex = readb(&prcs->var.rx_packet.next_frag_rcs_index);
-
-    while (tmp--) {
-        writeb(CCS_BUFFER_FREE, &prcslink->buffer_status);
-        if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) {
-            DEBUG(1,"ray_cs interrupt bad rcsindex = 0x%x\n",rcsindex);
-            break;      
-        }   
-        prcslink = ((struct rcs *)(local->sram + CCS_BASE)) + rcsindex;
-        rcsindex = readb(&prcslink->var.rx_packet.next_frag_rcs_index);
-    }
-    writeb(CCS_BUFFER_FREE, &prcslink->buffer_status);
-}
-/*===========================================================================*/
-static void authenticate(ray_dev_t *local)
-{
-    dev_link_t *link = local->finder;
-    DEBUG(0,"ray_cs Starting authentication.\n");
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_cs authenticate - device not present\n");
-        return;
-    }
-
-    del_timer(&local->timer);
-    if (build_auth_frame(local, local->bss_id, OPEN_AUTH_REQUEST)) {
-        local->timer.function = &join_net;
-    }
-    else {
-        local->timer.function = &authenticate_timeout;
-    }
-    local->timer.expires = jiffies + HZ*2;
-    local->timer.data = (long)local;
-    add_timer(&local->timer);
-    local->authentication_state = AWAITING_RESPONSE;
-} /* end authenticate */
-/*===========================================================================*/
-static void rx_authenticate(ray_dev_t *local, struct rcs *prcs,
-                     unsigned int pkt_addr, int rx_len)
-{
-    UCHAR buff[256];
-    struct rx_msg *msg = (struct rx_msg *)buff;
-    
-    del_timer(&local->timer);
-
-    copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff);
-    /* if we are trying to get authenticated */
-    if (local->sparm.b4.a_network_type == ADHOC) {
-        DEBUG(1,"ray_cs rx_auth var= %02x %02x %02x %02x %02x %02x\n", msg->var[0],msg->var[1],msg->var[2],msg->var[3],msg->var[4],msg->var[5]);
-        if (msg->var[2] == 1) {
-                    DEBUG(0,"ray_cs Sending authentication response.\n");
-                    if (!build_auth_frame (local, msg->mac.addr_2, OPEN_AUTH_RESPONSE)) {
-                        local->authentication_state = NEED_TO_AUTH;
-                        memcpy(local->auth_id, msg->mac.addr_2, ADDRLEN);
-                    }
-        }
-    }
-    else /* Infrastructure network */
-    {
-        if (local->authentication_state == AWAITING_RESPONSE) {
-            /* Verify authentication sequence #2 and success */
-            if (msg->var[2] == 2) {
-                if ((msg->var[3] | msg->var[4]) == 0) {
-                    DEBUG(1,"Authentication successful\n");
-                    local->card_status = CARD_AUTH_COMPLETE;
-                    associate(local);
-                    local->authentication_state = AUTHENTICATED;
-                }
-                else {
-                    DEBUG(0,"Authentication refused\n");
-                    local->card_status = CARD_AUTH_REFUSED;
-                    join_net((u_long)local);
-                    local->authentication_state = UNAUTHENTICATED;
-                }
-            }
-        }
-    }
-
-} /* end rx_authenticate */
-/*===========================================================================*/
-static void associate(ray_dev_t *local)
-{
-    struct ccs *pccs;
-    dev_link_t *link = local->finder;
-    struct net_device *dev = link->priv;
-    int ccsindex;
-    if (!(link->state & DEV_PRESENT)) {
-        DEBUG(2,"ray_cs associate - device not present\n");
-        return;
-    }
-    /* If no tx buffers available, return*/
-    if ((ccsindex = get_free_ccs(local)) < 0)
-    {
-/* TBD should never be here but... what if we are? */
-        DEBUG(1,"ray_cs associate - No free ccs\n");
-        return;
-    }
-    DEBUG(1,"ray_cs Starting association with access point\n");
-    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
-    /* fill in the CCS */
-    writeb(CCS_START_ASSOCIATION, &pccs->cmd);
-    /* Interrupt the firmware to process the command */
-    if (interrupt_ecf(local, ccsindex)) {
-        DEBUG(1,"ray_cs associate failed - ECF not ready for intr\n");
-        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
-
-        del_timer(&local->timer);
-        local->timer.expires = jiffies + HZ*2;
-        local->timer.data = (long)local;
-        local->timer.function = &join_net;
-        add_timer(&local->timer);
-        local->card_status = CARD_ASSOC_FAILED;
-        return;
-    }
-    if (!sniffer) netif_start_queue(dev);
-
-} /* end associate */
-/*===========================================================================*/
-static void rx_deauthenticate(ray_dev_t *local, struct rcs *prcs, 
-                       unsigned int pkt_addr, int rx_len)
-{
-/*  UCHAR buff[256];
-    struct rx_msg *msg = (struct rx_msg *)buff;
-*/
-    DEBUG(0,"Deauthentication frame received\n");
-    local->authentication_state = UNAUTHENTICATED;
-    /* Need to reauthenticate or rejoin depending on reason code */
-/*  copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff);
- */
-}
-/*===========================================================================*/
-static void clear_interrupt(ray_dev_t *local)
-{
-    writeb(0, local->amem + CIS_OFFSET + HCS_INTR_OFFSET);
-}
-/*===========================================================================*/
-#ifdef CONFIG_PROC_FS
-#define MAXDATA (PAGE_SIZE - 80)
-
-static char *card_status[] = {
-    "Card inserted - uninitialized",     /* 0 */
-    "Card not downloaded",               /* 1 */
-    "Waiting for download parameters",   /* 2 */
-    "Card doing acquisition",            /* 3 */
-    "Acquisition complete",              /* 4 */
-    "Authentication complete",           /* 5 */
-    "Association complete",              /* 6 */
-    "???", "???", "???", "???",          /* 7 8 9 10 undefined */
-    "Card init error",                   /* 11 */
-    "Download parameters error",         /* 12 */
-    "???",                               /* 13 */
-    "Acquisition failed",                /* 14 */
-    "Authentication refused",            /* 15 */
-    "Association failed"                 /* 16 */
-};
-
-static char *nettype[] = {"Adhoc", "Infra "};
-static char *framing[] = {"Encapsulation", "Translation"}
-;
-/*===========================================================================*/
-static int ray_cs_proc_read(char *buf, char **start, off_t offset, int len)
-{
-/* Print current values which are not available via other means
- * eg ifconfig 
- */
-    int i;
-    dev_link_t *link;
-    struct net_device *dev;
-    ray_dev_t *local;
-    UCHAR *p;
-    struct freq_hop_element *pfh;
-    UCHAR c[33];
-
-    link = dev_list;
-    if (!link)
-    	return 0;
-    dev = (struct net_device *)link->priv;
-    if (!dev)
-    	return 0;
-    local = (ray_dev_t *)dev->priv;
-    if (!local)
-    	return 0;
-
-    len = 0;
-
-    len += sprintf(buf + len, "Raylink Wireless LAN driver status\n");
-    len += sprintf(buf + len, "%s\n", rcsid);
-    /* build 4 does not report version, and field is 0x55 after memtest */
-    len += sprintf(buf + len, "Firmware version     = ");
-    if (local->fw_ver == 0x55)
-        len += sprintf(buf + len, "4 - Use dump_cis for more details\n");
-    else
-        len += sprintf(buf + len, "%2d.%02d.%02d\n",
-                   local->fw_ver, local->fw_bld, local->fw_var);
-
-    for (i=0; i<32; i++) c[i] = local->sparm.b5.a_current_ess_id[i];
-    c[32] = 0;
-    len += sprintf(buf + len, "%s network ESSID = \"%s\"\n", 
-                   nettype[local->sparm.b5.a_network_type], c);
-
-    p = local->bss_id;
-    len += sprintf(buf + len, 
-                   "BSSID                = %02x:%02x:%02x:%02x:%02x:%02x\n",
-                   p[0],p[1],p[2],p[3],p[4],p[5]);
-
-    len += sprintf(buf + len, "Country code         = %d\n", 
-                   local->sparm.b5.a_curr_country_code);
-
-    i = local->card_status;
-    if (i < 0) i = 10;
-    if (i > 16) i = 10;
-    len += sprintf(buf + len, "Card status          = %s\n", card_status[i]);
-
-    len += sprintf(buf + len, "Framing mode         = %s\n",framing[translate]);
-
-    len += sprintf(buf + len, "Last pkt signal lvl  = %d\n", local->last_rsl);
-
-    if (local->beacon_rxed) {
-	/* Pull some fields out of last beacon received */
-	len += sprintf(buf + len, "Beacon Interval      = %d Kus\n", 
-		       local->last_bcn.beacon_intvl[0]
-		       + 256 * local->last_bcn.beacon_intvl[1]);
-    
-    p = local->last_bcn.elements;
-    if (p[0] == C_ESSID_ELEMENT_ID) p += p[1] + 2;
-    else {
-        len += sprintf(buf + len, "Parse beacon failed at essid element id = %d\n",p[0]);
-        return len;
-    }
-
-    if (p[0] == C_SUPPORTED_RATES_ELEMENT_ID) {
-        len += sprintf(buf + len, "Supported rate codes = ");
-        for (i=2; i<p[1] + 2; i++) 
-            len += sprintf(buf + len, "0x%02x ", p[i]);
-        len += sprintf(buf + len, "\n");
-        p += p[1] + 2;
-    }
-    else {
-        len += sprintf(buf + len, "Parse beacon failed at rates element\n");
-        return len;
-    }
-
-	if (p[0] == C_FH_PARAM_SET_ELEMENT_ID) {
-	    pfh = (struct freq_hop_element *)p;
-	    len += sprintf(buf + len, "Hop dwell            = %d Kus\n",
-			   pfh->dwell_time[0] + 256 * pfh->dwell_time[1]);
-	    len += sprintf(buf + len, "Hop set              = %d \n", pfh->hop_set);
-	    len += sprintf(buf + len, "Hop pattern          = %d \n", pfh->hop_pattern);
-	    len += sprintf(buf + len, "Hop index            = %d \n", pfh->hop_index);
-	    p += p[1] + 2;
-	}
-	else {
-	    len += sprintf(buf + len, "Parse beacon failed at FH param element\n");
-	    return len;
-	}
-    } else {
-	len += sprintf(buf + len, "No beacons received\n");
-    }
-    return len;
-}
-
-#endif
-/*===========================================================================*/
-static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type)
-{
-    int addr;
-    struct ccs *pccs;
-    struct tx_msg *ptx;
-    int ccsindex;
-
-    /* If no tx buffers available, return */
-    if ((ccsindex = get_free_tx_ccs(local)) < 0)
-    {
-        DEBUG(1,"ray_cs send authenticate - No free tx ccs\n");
-        return -1;
-    }
-
-    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
-
-    /* Address in card space */
-    addr = TX_BUF_BASE + (ccsindex << 11);
-    /* fill in the CCS */
-    writeb(CCS_TX_REQUEST, &pccs->cmd);
-    writeb(addr >> 8, pccs->var.tx_request.tx_data_ptr);
-    writeb(0x20, pccs->var.tx_request.tx_data_ptr + 1);
-    writeb(TX_AUTHENTICATE_LENGTH_MSB, pccs->var.tx_request.tx_data_length);
-    writeb(TX_AUTHENTICATE_LENGTH_LSB,pccs->var.tx_request.tx_data_length + 1);
-    writeb(0, &pccs->var.tx_request.pow_sav_mode);
-
-    ptx = (struct tx_msg *)(local->sram + addr);
-    /* fill in the mac header */
-    writeb(PROTOCOL_VER | AUTHENTIC_TYPE, &ptx->mac.frame_ctl_1);
-    writeb(0, &ptx->mac.frame_ctl_2);
-
-    memcpy_toio(ptx->mac.addr_1, dest, ADDRLEN);
-    memcpy_toio(ptx->mac.addr_2, local->sparm.b4.a_mac_addr, ADDRLEN);
-    memcpy_toio(ptx->mac.addr_3, local->bss_id, ADDRLEN);
-
-    /* Fill in msg body with protocol 00 00, sequence 01 00 ,status 00 00 */
-    memset_io(ptx->var, 0, 6);
-    writeb(auth_type & 0xff, ptx->var + 2);
-
-    /* Interrupt the firmware to process the command */
-    if (interrupt_ecf(local, ccsindex)) {
-        DEBUG(1,"ray_cs send authentication request failed - ECF not ready for intr\n");
-        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
-        return -1;
-    }
-    return 0;
-} /* End build_auth_frame */
-
-/*===========================================================================*/
-#ifdef CONFIG_PROC_FS
-static void raycs_write(const char *name, write_proc_t *w, void *data)
-{
-	struct proc_dir_entry * entry = create_proc_entry(name, S_IFREG | S_IWUSR, NULL);
-	if (entry) {
-		entry->write_proc = w;
-		entry->data = data;
-	}
-}
-
-static int write_essid(struct file *file, const char *buffer, unsigned long count, void *data)
-{
-	static char proc_essid[33];
-	int len = count;
-
-	if (len > 32)
-		len = 32;
-	memset(proc_essid, 0, 33);
-	if (copy_from_user(proc_essid, buffer, len))
-		return -EFAULT;
-	essid = proc_essid;
-	return count;
-}
-
-static int write_int(struct file *file, const char *buffer, unsigned long count, void *data)
-{
-	static char proc_number[10];
-	char *p;
-	int nr, len;
-
-	if (!count)
-		return 0;
-
-	if (count > 9)
-		return -EINVAL;
-	if (copy_from_user(proc_number, buffer, count))
-		return -EFAULT;
-	p = proc_number;
-	nr = 0;
-	len = count;
-	do {
-		unsigned int c = *p - '0';
-		if (c > 9)
-			return -EINVAL;
-		nr = nr*10 + c;
-		p++;
-	} while (--len);
-	*(int *)data = nr;
-	return count;
-}
-#endif
-
-static int __init init_ray_cs(void)
-{
-    int rc;
-    
-    DEBUG(1, "%s\n", rcsid);
-    rc = register_pcmcia_driver(&dev_info, &ray_attach, &ray_detach);
-    DEBUG(1, "raylink init_module register_pcmcia_driver returns 0x%x\n",rc);
-
-#ifdef CONFIG_PROC_FS
-    proc_mkdir("driver/ray_cs", 0);
-
-    create_proc_info_entry("driver/ray_cs/ray_cs", 0, NULL, &ray_cs_proc_read);
-    raycs_write("driver/ray_cs/essid", write_essid, NULL);
-    raycs_write("driver/ray_cs/net_type", write_int, &net_type);
-    raycs_write("driver/ray_cs/translate", write_int, &translate);
-#endif
-    if (translate != 0) translate = 1;
-    return 0;
-} /* init_ray_cs */
-
-/*===========================================================================*/
-
-static void __exit exit_ray_cs(void)
-{
-    DEBUG(0, "ray_cs: cleanup_module\n");
-
-
-#ifdef CONFIG_PROC_FS
-    remove_proc_entry("ray_cs", proc_root_driver);
-#endif
-
-    unregister_pcmcia_driver(&dev_info);
-    while (dev_list != NULL)
-        ray_detach(dev_list);
-
-#ifdef CONFIG_PROC_FS
-    remove_proc_entry("driver/ray_cs/ray_cs", NULL);
-    remove_proc_entry("driver/ray_cs/essid", NULL);
-    remove_proc_entry("driver/ray_cs/net_type", NULL);
-    remove_proc_entry("driver/ray_cs/translate", NULL);
-    remove_proc_entry("driver/ray_cs", NULL);
-#endif
-} /* exit_ray_cs */
-
-module_init(init_ray_cs);
-module_exit(exit_ray_cs);
-
-/*===========================================================================*/
diff -Nru a/drivers/net/pcmcia/ray_cs.h b/drivers/net/pcmcia/ray_cs.h
--- a/drivers/net/pcmcia/ray_cs.h	Sun Feb 23 22:25:26 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,78 +0,0 @@
-/* Raytheon wireless LAN PCMCIA card driver for Linux 
-   A  PCMCIA client driver for the Raylink wireless network card
-   Written by Corey Thomas
-*/
-
-#ifndef RAYLINK_H
-
-struct beacon_rx {
-    struct mac_header mac;
-    UCHAR timestamp[8];
-    UCHAR beacon_intvl[2];
-    UCHAR capability[2];
-    UCHAR elements[sizeof(struct essid_element) 
-                  + sizeof(struct rates_element)
-                  + sizeof(struct freq_hop_element) 
-                  + sizeof(struct japan_call_sign_element)
-                  + sizeof(struct tim_element)];
-};
-
-/* Return values for get_free{,_tx}_ccs */
-#define ECCSFULL  (-1)
-#define ECCSBUSY  (-2)
-#define ECARDGONE (-3)
-
-typedef struct ray_dev_t {
-    int card_status;
-    int authentication_state;
-    dev_node_t  node;
-    window_handle_t amem_handle;   /* handle to window for attribute memory  */
-    window_handle_t rmem_handle;   /* handle to window for rx buffer on card */
-    UCHAR *sram;                   /* pointer to beginning of shared RAM     */
-    UCHAR *amem;                   /* pointer to attribute mem window        */
-    UCHAR *rmem;                   /* pointer to receive buffer window       */
-    dev_link_t *finder;            /* pointer back to dev_link_t for card    */
-    struct timer_list timer;
-    long tx_ccs_lock;
-    long ccs_lock;
-    int   dl_param_ccs;
-    union {
-        struct b4_startup_params b4;
-        struct b5_startup_params b5;
-    } sparm;
-    int timeout_flag;
-    UCHAR supported_rates[8];
-    UCHAR japan_call_sign[12];
-    struct startup_res_6 startup_res;
-    int num_multi;
-    /* Network parameters from start/join */
-    UCHAR bss_id[6];
-    UCHAR auth_id[6];
-    UCHAR net_default_tx_rate;
-    UCHAR encryption;
-    struct net_device_stats stats;
-
-    UCHAR net_type;
-    UCHAR sta_type;
-    UCHAR fw_ver;
-    UCHAR fw_bld;
-    UCHAR fw_var;
-    UCHAR ASIC_version;
-    UCHAR assoc_id[2];
-    UCHAR tib_length;
-    UCHAR last_rsl;
-    int beacon_rxed;
-    struct beacon_rx last_bcn;
-#ifdef WIRELESS_EXT
-    iw_stats	wstats;		/* Wireless specific stats */
-#endif
-#ifdef WIRELESS_SPY
-    int		spy_number;		/* Number of addresses to spy */
-    mac_addr	spy_address[IW_MAX_SPY + 1];	/* The addresses to spy */
-    iw_qual	spy_stat[IW_MAX_SPY + 1];	/* Statistics gathered */
-#endif	/* WIRELESS_SPY */
-
-} ray_dev_t;
-/*****************************************************************************/
-
-#endif /* RAYLINK_H */
diff -Nru a/drivers/net/pcmcia/rayctl.h b/drivers/net/pcmcia/rayctl.h
--- a/drivers/net/pcmcia/rayctl.h	Sun Feb 23 22:25:22 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,732 +0,0 @@
-#ifndef RAYLINK_H
-
-typedef unsigned char UCHAR;
-
-/****** IEEE 802.11 constants ************************************************/
-#define ADDRLEN           6
-/* Frame control 1 bit fields */
-#define PROTOCOL_VER      0x00
-#define DATA_TYPE         0x08
-#define ASSOC_REQ_TYPE    0x00
-#define ASSOC_RESP_TYPE   0x10
-#define REASSOC_REQ_TYPE  0x20
-#define REASSOC_RESP_TYPE 0x30
-#define NULL_MSG_TYPE     0x48
-#define BEACON_TYPE       0x80
-#define DISASSOC_TYPE     0xA0
-#define PSPOLL_TYPE       0xA4
-#define AUTHENTIC_TYPE    0xB0
-#define DEAUTHENTIC_TYPE  0xC0
-/* Frame control 2 bit fields */
-#define FC2_TO_DS         0x01
-#define FC2_FROM_DS       0x02
-#define FC2_MORE_FRAG     0x04
-#define FC2_RETRY         0x08
-#define FC2_PSM           0x10
-#define FC2_MORE_DATA     0x20
-#define FC2_WEP           0x40
-#define FC2_ORDER         0x80
-/*****************************************************************************/
-/* 802.11 element ID's and lengths */
-#define C_BP_CAPABILITY_ESS             0x01
-#define C_BP_CAPABILITY_IBSS            0x02
-#define C_BP_CAPABILITY_CF_POLLABLE     0x04
-#define C_BP_CAPABILITY_CF_POLL_REQUEST 0x08
-#define C_BP_CAPABILITY_PRIVACY         0x10
-
-#define C_ESSID_ELEMENT_ID               0
-#define C_ESSID_ELEMENT_MAX_LENGTH       32
-
-#define C_SUPPORTED_RATES_ELEMENT_ID     1
-#define C_SUPPORTED_RATES_ELEMENT_LENGTH 2
-
-#define C_FH_PARAM_SET_ELEMENT_ID        2
-#define C_FH_PARAM_SET_ELEMENT_LNGTH     5
-
-#define C_CF_PARAM_SET_ELEMENT_ID        4
-#define C_CF_PARAM_SET_ELEMENT_LNGTH     6
-
-#define C_TIM_ELEMENT_ID                 5
-#define C_TIM_BITMAP_LENGTH            251
-#define C_TIM_BMCAST_BIT              0x01
-
-#define C_IBSS_ELEMENT_ID                6
-#define C_IBSS_ELEMENT_LENGTH            2
-
-#define C_JAPAN_CALL_SIGN_ELEMENT_ID    51
-#define C_JAPAN_CALL_SIGN_ELEMENT_LNGTH 12
-
-#define C_DISASSOC_REASON_CODE_LEN       2
-#define C_DISASSOC_REASON_CODE_DEFAULT   8
-
-#define C_CRC_LEN                        4
-#define C_NUM_SUPPORTED_RATES            8 
-/****** IEEE 802.11 mac header for type data packets *************************/
-struct mac_header {
-  UCHAR frame_ctl_1;                          
-  UCHAR frame_ctl_2;
-  UCHAR duration_lsb;
-  UCHAR duration_msb;
-  UCHAR addr_1[ADDRLEN];
-  UCHAR addr_2[ADDRLEN];
-  UCHAR addr_3[ADDRLEN];
-  UCHAR seq_frag_num[2];
-/*  UCHAR addr_4[ADDRLEN]; *//* only present for AP to AP (TO DS and FROM DS */
-};
-/****** IEEE 802.11 frame element structures *********************************/
-struct essid_element
-{
-  UCHAR id;
-  UCHAR length;
-  UCHAR text[C_ESSID_ELEMENT_MAX_LENGTH];
-};
-struct rates_element
-{
-  UCHAR id;
-  UCHAR length;
-  UCHAR value[8];
-};
-struct freq_hop_element
-{
-  UCHAR id;
-  UCHAR length;
-  UCHAR dwell_time[2];
-  UCHAR hop_set;
-  UCHAR hop_pattern;
-  UCHAR hop_index;
-};
-struct tim_element
-{
-  UCHAR id;
-  UCHAR length;
-  UCHAR dtim_count;
-  UCHAR dtim_period;    
-  UCHAR bitmap_control;
-  UCHAR tim[C_TIM_BITMAP_LENGTH];
-};
-struct ibss_element
-{
-  UCHAR id;
-  UCHAR length;
-  UCHAR atim_window[2];
-};
-struct japan_call_sign_element
-{
-  UCHAR id;
-  UCHAR length;
-  UCHAR call_sign[12];
-};
-/****** Beacon message structures ********************************************/
-/* .elements is a large lump of max size because elements are variable size  */
-struct infra_beacon
-{
-    UCHAR timestamp[8];
-    UCHAR beacon_intvl[2];
-    UCHAR capability[2];
-    UCHAR elements[sizeof(struct essid_element) 
-                  + sizeof(struct rates_element)
-                  + sizeof(struct freq_hop_element) 
-                  + sizeof(struct japan_call_sign_element)
-                  + sizeof(struct tim_element)];
-};
-struct adhoc_beacon
-{
-    UCHAR timestamp[8];
-    UCHAR beacon_intvl[2];
-    UCHAR capability[2];
-    UCHAR elements[sizeof(struct essid_element) 
-                  + sizeof(struct rates_element)
-                  + sizeof(struct freq_hop_element) 
-                  + sizeof(struct japan_call_sign_element)
-                  + sizeof(struct ibss_element)];
-};
-/*****************************************************************************/
-/*****************************************************************************/
-/* #define C_MAC_HDR_2_WEP 0x40 */
-/* TX/RX CCS constants */
-#define TX_HEADER_LENGTH 0x1C
-#define RX_MAC_HEADER_LENGTH 0x18
-#define TX_AUTHENTICATE_LENGTH (TX_HEADER_LENGTH + 6)
-#define TX_AUTHENTICATE_LENGTH_MSB (TX_AUTHENTICATE_LENGTH >> 8)
-#define TX_AUTHENTICATE_LENGTH_LSB (TX_AUTHENTICATE_LENGTH & 0xff)
-#define TX_DEAUTHENTICATE_LENGTH (TX_HEADER_LENGTH + 2)
-#define TX_DEAUTHENTICATE_LENGTH_MSB (TX_AUTHENTICATE_LENGTH >> 8)
-#define TX_DEAUTHENTICATE_LENGTH_LSB (TX_AUTHENTICATE_LENGTH & 0xff)
-#define FCS_LEN           4
-
-#define ADHOC                 0
-#define INFRA                 1
-
-#define TYPE_STA              0
-#define TYPE_AP               1
-
-#define PASSIVE_SCAN          1
-#define ACTIVE_SCAN           1
-
-#define PSM_CAM               0
-
-/* Country codes */
-#define USA                   1
-#define EUROPE                2
-#define JAPAN                 3
-#define KOREA                 4
-#define SPAIN                 5
-#define FRANCE                6
-#define ISRAEL                7
-#define AUSTRALIA             8
-#define JAPAN_TEST            9
-
-/* Hop pattern lengths */
-#define USA_HOP_MOD          79 
-#define EUROPE_HOP_MOD       79 
-#define JAPAN_HOP_MOD        23
-#define KOREA_HOP_MOD        23
-#define SPAIN_HOP_MOD        27
-#define FRANCE_HOP_MOD       35
-#define ISRAEL_HOP_MOD       35
-#define AUSTRALIA_HOP_MOD    47
-#define JAPAN_TEST_HOP_MOD   23
-
-#define ESSID_SIZE           32
-/**********************************************************************/
-/* CIS Register Constants */
-#define CIS_OFFSET             0x0f00
-/* Configuration Option Register (0x0F00) */
-#define COR_OFFSET             0x00
-#define COR_SOFT_RESET         0x80
-#define COR_LEVEL_IRQ          0x40
-#define COR_CONFIG_NUM         0x01
-#define COR_DEFAULT            (COR_LEVEL_IRQ | COR_CONFIG_NUM)
-
-/* Card Configuration and Status Register (0x0F01) */
-#define CCSR_OFFSET            0x01
-#define CCSR_HOST_INTR_PENDING 0x01
-#define CCSR_POWER_DOWN        0x04
-
-/* HCS Interrupt Register (0x0F05) */
-#define HCS_INTR_OFFSET        0x05
-/* #define HCS_INTR_OFFSET        0x0A */
-#define HCS_INTR_CLEAR         0x00
-
-/* ECF Interrupt Register (0x0F06) */
-#define ECF_INTR_OFFSET        0x06
-/* #define ECF_INTR_OFFSET        0x0C */
-#define ECF_INTR_SET           0x01
-
-/* Authorization Register 0 (0x0F08) */
-#define AUTH_0_ON              0x57
-
-/* Authorization Register 1 (0x0F09) */
-#define AUTH_1_ON              0x82
-
-/* Program Mode Register (0x0F0A) */
-#define PC2PM                  0x02
-#define PC2CAL                 0x10
-#define PC2MLSE                0x20
-
-/* PC Test Mode Register (0x0F0B) */
-#define PC_TEST_MODE           0x08
-
-/* Frequency Control Word (0x0F10) */
-/* Range 0x02 - 0xA6 */
-
-/* Test Mode Control 1-4 (0x0F14 - 0x0F17) */
-
-/**********************************************************************/
-
-/* Shared RAM Area */
-#define SCB_BASE               0x0000
-#define STATUS_BASE            0x0100
-#define HOST_TO_ECF_BASE       0x0200
-#define ECF_TO_HOST_BASE       0x0300
-#define CCS_BASE               0x0400
-#define RCS_BASE               0x0800
-#define INFRA_TIM_BASE         0x0C00
-#define SSID_LIST_BASE         0x0D00
-#define TX_BUF_BASE            0x1000
-#define RX_BUF_BASE            0x8000
-
-#define NUMBER_OF_CCS    64
-#define NUMBER_OF_RCS    64
-/*#define NUMBER_OF_TX_CCS 14 */
-#define NUMBER_OF_TX_CCS 14
-
-#define TX_BUF_SIZE      (2048 - sizeof(struct tx_msg))
-#define RX_BUFF_END      0x3FFF
-/* Values for buffer_status */
-#define CCS_BUFFER_FREE       0
-#define CCS_BUFFER_BUSY       1
-#define CCS_COMMAND_COMPLETE  2
-#define CCS_COMMAND_FAILED    3
-
-/* Values for cmd */
-#define CCS_DOWNLOAD_STARTUP_PARAMS    1
-#define CCS_UPDATE_PARAMS              2
-#define CCS_REPORT_PARAMS              3
-#define CCS_UPDATE_MULTICAST_LIST      4
-#define CCS_UPDATE_POWER_SAVINGS_MODE  5
-#define CCS_START_NETWORK              6
-#define CCS_JOIN_NETWORK               7
-#define CCS_START_ASSOCIATION          8
-#define CCS_TX_REQUEST                 9
-#define CCS_TEST_MEMORY              0xa
-#define CCS_SHUTDOWN                 0xb
-#define CCS_DUMP_MEMORY              0xc
-#define CCS_START_TIMER              0xe
-#define CCS_LAST_CMD                 CCS_START_TIMER
-
-/* Values for link field */
-#define CCS_END_LIST                 0xff
-
-/* values for buffer_status field */
-#define RCS_BUFFER_FREE       0
-#define RCS_BUFFER_BUSY       1
-#define RCS_COMPLETE          2
-#define RCS_FAILED            3
-#define RCS_BUFFER_RELEASE    0xFF
-
-/* values for interrupt_id field */
-#define PROCESS_RX_PACKET           0x80 /* */
-#define REJOIN_NET_COMPLETE         0x81 /* RCS ID: Rejoin Net Complete */
-#define ROAMING_INITIATED           0x82 /* RCS ID: Roaming Initiated   */
-#define JAPAN_CALL_SIGN_RXD         0x83 /* RCS ID: New Japan Call Sign */
-
-/*****************************************************************************/
-/* Memory types for dump memory command */
-#define C_MEM_PROG  0
-#define C_MEM_XDATA 1
-#define C_MEM_SFR   2
-#define C_MEM_IDATA 3
-
-/*** Return values for hw_xmit **********/
-#define XMIT_OK        (0)
-#define XMIT_MSG_BAD   (-1)
-#define XMIT_NO_CCS    (-2)
-#define XMIT_NO_INTR   (-3)
-#define XMIT_NEED_AUTH (-4)
-
-/*** Values for card status */
-#define CARD_INSERTED       (0)
-
-#define CARD_AWAITING_PARAM (1)
-#define CARD_INIT_ERROR     (11)
-
-#define CARD_DL_PARAM       (2)
-#define CARD_DL_PARAM_ERROR (12)
-
-#define CARD_DOING_ACQ      (3)
-
-#define CARD_ACQ_COMPLETE   (4)
-#define CARD_ACQ_FAILED     (14)
-
-#define CARD_AUTH_COMPLETE  (5)
-#define CARD_AUTH_REFUSED   (15)
-
-#define CARD_ASSOC_COMPLETE (6)
-#define CARD_ASSOC_FAILED   (16)
-
-/*** Values for authentication_state ***********************************/
-#define UNAUTHENTICATED     (0)
-#define AWAITING_RESPONSE   (1)
-#define AUTHENTICATED       (2)
-#define NEED_TO_AUTH        (3)
-
-/*** Values for authentication type ************************************/
-#define OPEN_AUTH_REQUEST   (1)
-#define OPEN_AUTH_RESPONSE  (2)
-#define BROADCAST_DEAUTH    (0xc0)
-/*** Values for timer functions ****************************************/
-#define TODO_NOTHING              (0)
-#define TODO_VERIFY_DL_START      (-1)
-#define TODO_START_NET            (-2)
-#define TODO_JOIN_NET             (-3)
-#define TODO_AUTHENTICATE_TIMEOUT (-4)
-#define TODO_SEND_CCS             (-5)
-/***********************************************************************/
-/* Parameter passing structure for update/report parameter CCS's */
-struct object_id {
-    void          *object_addr;
-    unsigned char object_length;
-};
-
-#define OBJID_network_type            0
-#define OBJID_acting_as_ap_status     1
-#define OBJID_current_ess_id          2
-#define OBJID_scanning_mode           3
-#define OBJID_power_mgt_state         4
-#define OBJID_mac_address             5
-#define OBJID_frag_threshold          6
-#define OBJID_hop_time                7
-#define OBJID_beacon_period           8
-#define OBJID_dtim_period             9
-#define OBJID_retry_max              10
-#define OBJID_ack_timeout            11
-#define OBJID_sifs                   12
-#define OBJID_difs                   13
-#define OBJID_pifs                   14
-#define OBJID_rts_threshold          15
-#define OBJID_scan_dwell_time        16
-#define OBJID_max_scan_dwell_time    17
-#define OBJID_assoc_resp_timeout     18
-#define OBJID_adhoc_scan_cycle_max   19
-#define OBJID_infra_scan_cycle_max   20
-#define OBJID_infra_super_cycle_max  21
-#define OBJID_promiscuous_mode       22
-#define OBJID_unique_word            23
-#define OBJID_slot_time              24
-#define OBJID_roaming_low_snr        25
-#define OBJID_low_snr_count_thresh   26
-#define OBJID_infra_missed_bcn       27
-#define OBJID_adhoc_missed_bcn       28
-#define OBJID_curr_country_code      29
-#define OBJID_hop_pattern            30
-#define OBJID_reserved               31
-#define OBJID_cw_max_msb             32
-#define OBJID_cw_min_msb             33
-#define OBJID_noise_filter_gain      34
-#define OBJID_noise_limit_offset     35
-#define OBJID_det_rssi_thresh_offset 36
-#define OBJID_med_busy_thresh_offset 37
-#define OBJID_det_sync_thresh        38
-#define OBJID_test_mode              39
-#define OBJID_test_min_chan_num      40
-#define OBJID_test_max_chan_num      41
-#define OBJID_allow_bcast_ID_prbrsp  42
-#define OBJID_privacy_must_start     43
-#define OBJID_privacy_can_join       44
-#define OBJID_basic_rate_set         45
-
-/**** Configuration/Status/Control Area ***************************/
-/*    System Control Block (SCB) Area
- *    Located at Shared RAM offset 0
- */
-struct scb {
-    UCHAR ccs_index;
-    UCHAR rcs_index;
-};
-
-/****** Status area at Shared RAM offset 0x0100 ******************************/
-struct status {
-    UCHAR mrx_overflow_for_host;         /* 0=ECF may write, 1=host may write*/
-    UCHAR mrx_checksum_error_for_host;   /* 0=ECF may write, 1=host may write*/
-    UCHAR rx_hec_error_for_host;         /* 0=ECF may write, 1=host may write*/
-    UCHAR reserved1;
-    short mrx_overflow;                  /* ECF increments on rx overflow    */
-    short mrx_checksum_error;            /* ECF increments on rx CRC error   */
-    short rx_hec_error;                  /* ECF incs on mac header CRC error */
-    UCHAR rxnoise;                       /* Average RSL measurement          */
-};
-
-/****** Host-to-ECF Data Area at Shared RAM offset 0x200 *********************/
-struct host_to_ecf_area {
-    
-};
-
-/****** ECF-to-Host Data Area at Shared RAM offset 0x0300 ********************/
-struct startup_res_518 {
-    UCHAR startup_word;
-    UCHAR station_addr[ADDRLEN];
-    UCHAR calc_prog_chksum;
-    UCHAR calc_cis_chksum;
-    UCHAR ecf_spare[7];
-    UCHAR japan_call_sign[12];
-};
-
-struct startup_res_6 {
-    UCHAR startup_word;
-    UCHAR station_addr[ADDRLEN];
-    UCHAR reserved;
-    UCHAR supp_rates[8];
-    UCHAR japan_call_sign[12];
-    UCHAR calc_prog_chksum;
-    UCHAR calc_cis_chksum;
-    UCHAR firmware_version[3];
-    UCHAR asic_version;
-    UCHAR tib_length;
-};
-
-struct start_join_net_params {
-    UCHAR net_type;
-    UCHAR ssid[ESSID_SIZE];
-    UCHAR reserved;
-    UCHAR privacy_can_join;
-};
-
-/****** Command Control Structure area at Shared ram offset 0x0400 ***********/
-/* Structures for command specific parameters (ccs.var) */
-struct update_param_cmd {
-    UCHAR object_id;
-    UCHAR number_objects;
-    UCHAR failure_cause;
-};
-struct report_param_cmd {
-    UCHAR object_id;
-    UCHAR number_objects;
-    UCHAR failure_cause;
-    UCHAR length;
-};
-struct start_network_cmd {
-    UCHAR update_param;
-    UCHAR bssid[ADDRLEN];
-    UCHAR net_initiated;
-    UCHAR net_default_tx_rate;
-    UCHAR encryption;
-};
-struct join_network_cmd {
-    UCHAR update_param;
-    UCHAR bssid[ADDRLEN];
-    UCHAR net_initiated;
-    UCHAR net_default_tx_rate;
-    UCHAR encryption;
-};
-struct tx_requested_cmd {
- 
-    UCHAR tx_data_ptr[2];
-    UCHAR tx_data_length[2];
-    UCHAR host_reserved[2];
-    UCHAR reserved[3];
-    UCHAR tx_rate;
-    UCHAR pow_sav_mode;
-    UCHAR retries;
-    UCHAR antenna;
-};
-struct tx_requested_cmd_4 {
- 
-    UCHAR tx_data_ptr[2];
-    UCHAR tx_data_length[2];
-    UCHAR dest_addr[ADDRLEN];
-    UCHAR pow_sav_mode;
-    UCHAR retries;
-    UCHAR station_id;
-};
-struct memory_dump_cmd {
-    UCHAR memory_type;
-    UCHAR memory_ptr[2];
-    UCHAR length;
-};
-struct update_association_cmd {
-    UCHAR status;
-    UCHAR aid[2];
-};
-struct start_timer_cmd {
-    UCHAR duration[2];
-};
-
-struct ccs {
-    UCHAR buffer_status;                 /* 0 = buffer free, 1 = buffer busy */
-                                         /* 2 = command complete, 3 = failed */
-    UCHAR cmd;                           /* command to ECF                   */
-    UCHAR link;                          /* link to next CCS, FF=end of list */
-    /* command specific parameters      */
-    union {
-        char reserved[13];
-        struct update_param_cmd update_param;
-        struct report_param_cmd report_param;
-        UCHAR nummulticast;
-        UCHAR mode;
-        struct start_network_cmd start_network;
-        struct join_network_cmd join_network;
-        struct tx_requested_cmd tx_request;
-        struct memory_dump_cmd memory_dump;
-        struct update_association_cmd update_assoc;
-        struct start_timer_cmd start_timer;
-    } var;
-};
-
-/*****************************************************************************/
-/* Transmit buffer structures */
-struct tib_structure {
-    UCHAR ccs_index;
-    UCHAR psm;
-    UCHAR pass_fail;
-    UCHAR retry_count;
-    UCHAR max_retries;
-    UCHAR frags_remaining;
-    UCHAR no_rb;
-    UCHAR rts_reqd;
-    UCHAR csma_tx_cntrl_2;
-    UCHAR sifs_tx_cntrl_2;
-    UCHAR tx_dma_addr_1[2];
-    UCHAR tx_dma_addr_2[2];
-    UCHAR var_dur_2mhz[2];
-    UCHAR var_dur_1mhz[2];
-    UCHAR max_dur_2mhz[2];
-    UCHAR max_dur_1mhz[2];
-    UCHAR hdr_len;
-    UCHAR max_frag_len[2];
-    UCHAR var_len[2];
-    UCHAR phy_hdr_4;
-    UCHAR mac_hdr_1;
-    UCHAR mac_hdr_2;
-    UCHAR sid[2];
-};
-
-struct phy_header {
-    UCHAR sfd[2];
-    UCHAR hdr_3;
-    UCHAR hdr_4;
-};
-struct rx_msg {
-    struct mac_header mac;
-    UCHAR  var[1];
-};
-
-struct tx_msg {
-    struct tib_structure tib;
-    struct phy_header phy;
-    struct mac_header mac;
-    UCHAR  var[1];
-};
-
-/****** ECF Receive Control Stucture (RCS) Area at Shared RAM offset 0x0800  */
-/* Structures for command specific parameters (rcs.var) */
-struct rx_packet_cmd {
-    UCHAR rx_data_ptr[2];
-    UCHAR rx_data_length[2];
-    UCHAR rx_sig_lev;
-    UCHAR next_frag_rcs_index;
-    UCHAR totalpacketlength[2];
-};
-struct rejoin_net_cmplt_cmd {
-    UCHAR reserved;
-    UCHAR bssid[ADDRLEN];
-};
-struct japan_call_sign_rxd {
-    UCHAR rxd_call_sign[8];
-    UCHAR reserved[5];
-};
-
-struct rcs {
-    UCHAR buffer_status;
-    UCHAR interrupt_id;
-    UCHAR link_field;
-    /* command specific parameters      */
-    union {
-        UCHAR reserved[13]; 
-        struct rx_packet_cmd rx_packet;
-        struct rejoin_net_cmplt_cmd rejoin_net_complete;
-        struct japan_call_sign_rxd japan_call_sign;
-    } var;
-};
-
-/****** Startup parameter structures for both versions of firmware ***********/
-struct b4_startup_params {
-    UCHAR a_network_type;                /* C_ADHOC, C_INFRA                 */
-    UCHAR a_acting_as_ap_status;         /* C_TYPE_STA, C_TYPE_AP            */
-    UCHAR a_current_ess_id[ESSID_SIZE];  /* Null terminated unless 32 long   */
-    UCHAR a_scanning_mode;               /* passive 0, active 1              */
-    UCHAR a_power_mgt_state;             /* CAM 0,                           */
-    UCHAR a_mac_addr[ADDRLEN];           /*                                  */
-    UCHAR a_frag_threshold[2];           /* 512                              */
-    UCHAR a_hop_time[2];                 /* 16k * 2**n, n=0-4 in Kus         */
-    UCHAR a_beacon_period[2];            /* n * a_hop_time  in Kus           */
-    UCHAR a_dtim_period;                 /* in beacons                       */
-    UCHAR a_retry_max;                   /*                                  */
-    UCHAR a_ack_timeout;                 /*                                  */
-    UCHAR a_sifs;                        /*                                  */
-    UCHAR a_difs;                        /*                                  */
-    UCHAR a_pifs;                        /*                                  */
-    UCHAR a_rts_threshold[2];            /*                                  */
-    UCHAR a_scan_dwell_time[2];          /*                                  */
-    UCHAR a_max_scan_dwell_time[2];      /*                                  */
-    UCHAR a_assoc_resp_timeout_thresh;   /*                                  */
-    UCHAR a_adhoc_scan_cycle_max;        /*                                  */
-    UCHAR a_infra_scan_cycle_max;        /*                                  */
-    UCHAR a_infra_super_scan_cycle_max;  /*                                  */
-    UCHAR a_promiscuous_mode;            /*                                  */
-    UCHAR a_unique_word[2];              /*                                  */
-    UCHAR a_slot_time;                   /*                                  */
-    UCHAR a_roaming_low_snr_thresh;      /*                                  */
-    UCHAR a_low_snr_count_thresh;        /*                                  */
-    UCHAR a_infra_missed_bcn_thresh;     /*                                  */
-    UCHAR a_adhoc_missed_bcn_thresh;     /*                                  */
-    UCHAR a_curr_country_code;           /* C_USA                            */
-    UCHAR a_hop_pattern;                 /*                                  */
-    UCHAR a_hop_pattern_length;          /*                                  */
-/* b4 - b5 differences start here */
-    UCHAR a_cw_max;                      /*                                  */
-    UCHAR a_cw_min;                      /*                                  */
-    UCHAR a_noise_filter_gain;           /*                                  */
-    UCHAR a_noise_limit_offset;          /*                                  */
-    UCHAR a_det_rssi_thresh_offset;      /*                                  */
-    UCHAR a_med_busy_thresh_offset;      /*                                  */
-    UCHAR a_det_sync_thresh;             /*                                  */
-    UCHAR a_test_mode;                   /*                                  */
-    UCHAR a_test_min_chan_num;           /*                                  */
-    UCHAR a_test_max_chan_num;           /*                                  */
-    UCHAR a_rx_tx_delay;                 /*                                  */
-    UCHAR a_current_bss_id[ADDRLEN];     /*                                  */
-    UCHAR a_hop_set;                     /*                                  */
-};
-struct b5_startup_params {
-    UCHAR a_network_type;                /* C_ADHOC, C_INFRA                 */
-    UCHAR a_acting_as_ap_status;         /* C_TYPE_STA, C_TYPE_AP            */
-    UCHAR a_current_ess_id[ESSID_SIZE];  /* Null terminated unless 32 long   */
-    UCHAR a_scanning_mode;               /* passive 0, active 1              */
-    UCHAR a_power_mgt_state;             /* CAM 0,                           */
-    UCHAR a_mac_addr[ADDRLEN];           /*                                  */
-    UCHAR a_frag_threshold[2];           /* 512                              */
-    UCHAR a_hop_time[2];                 /* 16k * 2**n, n=0-4 in Kus         */
-    UCHAR a_beacon_period[2];            /* n * a_hop_time  in Kus           */
-    UCHAR a_dtim_period;                 /* in beacons                       */
-    UCHAR a_retry_max;                   /* 4                                */
-    UCHAR a_ack_timeout;                 /*                                  */
-    UCHAR a_sifs;                        /*                                  */
-    UCHAR a_difs;                        /*                                  */
-    UCHAR a_pifs;                        /*                                  */
-    UCHAR a_rts_threshold[2];            /*                                  */
-    UCHAR a_scan_dwell_time[2];          /*                                  */
-    UCHAR a_max_scan_dwell_time[2];      /*                                  */
-    UCHAR a_assoc_resp_timeout_thresh;   /*                                  */
-    UCHAR a_adhoc_scan_cycle_max;        /*                                  */
-    UCHAR a_infra_scan_cycle_max;        /*                                  */
-    UCHAR a_infra_super_scan_cycle_max;  /*                                  */
-    UCHAR a_promiscuous_mode;            /*                                  */
-    UCHAR a_unique_word[2];              /*                                  */
-    UCHAR a_slot_time;                   /*                                  */
-    UCHAR a_roaming_low_snr_thresh;      /*                                  */
-    UCHAR a_low_snr_count_thresh;        /*                                  */
-    UCHAR a_infra_missed_bcn_thresh;     /*                                  */
-    UCHAR a_adhoc_missed_bcn_thresh;     /*                                  */
-    UCHAR a_curr_country_code;           /* C_USA                            */
-    UCHAR a_hop_pattern;                 /*                                  */
-    UCHAR a_hop_pattern_length;          /*                                  */
-/* b4 - b5 differences start here */
-    UCHAR a_cw_max[2];                   /*                                  */
-    UCHAR a_cw_min[2];                   /*                                  */
-    UCHAR a_noise_filter_gain;           /*                                  */
-    UCHAR a_noise_limit_offset;          /*                                  */
-    UCHAR a_det_rssi_thresh_offset;      /*                                  */
-    UCHAR a_med_busy_thresh_offset;      /*                                  */
-    UCHAR a_det_sync_thresh;             /*                                  */
-    UCHAR a_test_mode;                   /*                                  */
-    UCHAR a_test_min_chan_num;           /*                                  */
-    UCHAR a_test_max_chan_num;           /*                                  */
-    UCHAR a_allow_bcast_SSID_probe_rsp;
-    UCHAR a_privacy_must_start;
-    UCHAR a_privacy_can_join;
-    UCHAR a_basic_rate_set[8];
-};
-
-/*****************************************************************************/
-#define RAY_IOCG_PARMS (SIOCDEVPRIVATE)
-#define RAY_IOCS_PARMS (SIOCDEVPRIVATE + 1)
-#define RAY_DO_CMD     (SIOCDEVPRIVATE + 2)
-
-/****** ethernet <-> 802.11 translation **************************************/
-typedef struct snaphdr_t
-{
-  UCHAR   dsap;
-  UCHAR   ssap;
-  UCHAR   ctrl;
-  UCHAR   org[3];
-  UCHAR   ethertype[2];
-} snaphdr_t;
-
-#define BRIDGE_ENCAP  0xf80000
-#define RFC1042_ENCAP 0
-#define SNAP_ID       0x0003aaaa
-#define RAY_IPX_TYPE  0x8137
-#define APPLEARP_TYPE 0x80f3
-/*****************************************************************************/
-#endif /* #ifndef RAYLINK_H */
diff -Nru a/drivers/net/setup.c b/drivers/net/setup.c
--- a/drivers/net/setup.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/net/setup.c	Sun Feb 23 22:25:26 2003
@@ -14,10 +14,6 @@
   
 extern int dmascc_init(void);
 
-extern int awc4500_pci_probe(void);
-extern int awc4500_isa_probe(void);
-extern int awc4500_pnp_probe(void);
-extern int awc4500_365_probe(void);
 extern int arcnet_init(void); 
 extern int scc_enet_init(void); 
 extern int fec_enet_init(void); 
@@ -79,23 +75,6 @@
 	{lmc_setup, 0},
 #endif
 	 
-/*
-*
-*	Wireless non-HAM
-*
-*/
-#ifdef CONFIG_AIRONET4500_NONCS
-
-#ifdef CONFIG_AIRONET4500_PCI
-	{awc4500_pci_probe,0},
-#endif
-
-#ifdef CONFIG_AIRONET4500_PNP
-	{awc4500_pnp_probe,0},
-#endif
-
-#endif
-
 /*
  *	Token Ring Drivers
  */  
diff -Nru a/drivers/net/sis900.c b/drivers/net/sis900.c
--- a/drivers/net/sis900.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/net/sis900.c	Sun Feb 23 22:25:24 2003
@@ -526,7 +526,7 @@
 			mii_status = mdio_read(net_dev, phy_addr, MII_STATUS);
 
 		if (mii_status == 0xffff || mii_status == 0x0000)
-			/* the mii is not accessable, try next one */
+			/* the mii is not accessible, try next one */
 			continue;
 		
 		if ((mii_phy = kmalloc(sizeof(struct mii_phy), GFP_KERNEL)) == NULL) {
diff -Nru a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
--- a/drivers/net/sk98lin/skge.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/net/sk98lin/skge.c	Sun Feb 23 22:25:22 2003
@@ -2516,7 +2516,7 @@
 		/*
 		 * Do not set the Limit to 0, because this could cause
 		 * wrap around with ReQueue'ed buffers (a buffer could
-		 * be requeued in the same position, made accessable to
+		 * be requeued in the same position, made accessible to
 		 * the hardware, and the hardware could change its
 		 * contents!
 		 */
diff -Nru a/drivers/net/sk98lin/skgeinit.c b/drivers/net/sk98lin/skgeinit.c
--- a/drivers/net/sk98lin/skgeinit.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/net/sk98lin/skgeinit.c	Sun Feb 23 22:25:24 2003
@@ -181,7 +181,7 @@
  *
  *	Revision 1.21  1998/10/20 12:11:56  malthoff
  *	Don't dendy the Queue config if the size of the unused
- *	rx qeueu is zero.
+ *	rx queue is zero.
  *
  *	Revision 1.20  1998/10/19 07:27:58  malthoff
  *	SkGeInitRamIface() is public to be called by diagnostics.
@@ -1781,7 +1781,7 @@
  * Returns:
  *	0:	success
  *	1:	Number of MACs exceeds SK_MAX_MACS	( after level 1)
- *	2:	Adapter not present or not accessable
+ *	2:	Adapter not present or not accessible
  *	3:	Illegal initialization level
  *	4:	Initialization Level 1 Call missing
  *	5:	Unexpected PHY type detected
@@ -1808,7 +1808,7 @@
 		/* Initialization Level 1 */
 		RetVal = SkGeInit1(pAC, IoC);
 
-		/* Check if the adapter seems to be accessable */
+		/* Check if the adapter seems to be accessible */
 		SK_OUT32(IoC, B2_IRQM_INI, 0x11335577L);
 		SK_IN32(IoC, B2_IRQM_INI, &DWord);
 		SK_OUT32(IoC, B2_IRQM_INI, 0x00000000L);
diff -Nru a/drivers/net/skfp/pmf.c b/drivers/net/skfp/pmf.c
--- a/drivers/net/skfp/pmf.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/net/skfp/pmf.c	Sun Feb 23 22:25:26 2003
@@ -122,7 +122,7 @@
 
 	/*
 	 * PRIVATE EXTENSIONS
-	 * only accessable locally to get/set passwd
+	 * only accessible locally to get/set passwd
 	 */
 	{ SMT_P10F0,AC_GR,	MOFFSA(fddiPRPMFPasswd),	"8"	} ,
 	{ SMT_P10F1,AC_GR,	MOFFSS(fddiPRPMFStation),	"8"	} ,
@@ -211,7 +211,7 @@
 
 	/*
 	 * PRIVATE EXTENSIONS
-	 * only accessable locally to get/set TMIN
+	 * only accessible locally to get/set TMIN
 	 */
 	{ SMT_P20F0,AC_NA						} ,
 	{ SMT_P20F1,AC_GR,	MOFFMS(fddiMACT_Min),		"lT"	} ,
diff -Nru a/drivers/net/strip.c b/drivers/net/strip.c
--- a/drivers/net/strip.c	Sun Feb 23 22:25:25 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,2877 +0,0 @@
-/*
- * Copyright 1996 The Board of Trustees of The Leland Stanford
- * Junior University. All Rights Reserved.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies.  Stanford University
- * makes no representations about the suitability of this
- * software for any purpose.  It is provided "as is" without
- * express or implied warranty.
- *
- * strip.c	This module implements Starmode Radio IP (STRIP)
- *		for kernel-based devices like TTY.  It interfaces between a
- *		raw TTY, and the kernel's INET protocol layers (via DDI).
- *
- * Version:	@(#)strip.c	1.3	July 1997
- *
- * Author:	Stuart Cheshire <cheshire@cs.stanford.edu>
- *
- * Fixes:	v0.9 12th Feb 1996 (SC)
- *		New byte stuffing (2+6 run-length encoding)
- *		New watchdog timer task
- *		New Protocol key (SIP0)
- *		
- *		v0.9.1 3rd March 1996 (SC)
- *		Changed to dynamic device allocation -- no more compile
- *		time (or boot time) limit on the number of STRIP devices.
- *		
- *		v0.9.2 13th March 1996 (SC)
- *		Uses arp cache lookups (but doesn't send arp packets yet)
- *		
- *		v0.9.3 17th April 1996 (SC)
- *		Fixed bug where STR_ERROR flag was getting set unneccessarily
- *		(causing otherwise good packets to be unneccessarily dropped)
- *		
- *		v0.9.4 27th April 1996 (SC)
- *		First attempt at using "&COMMAND" Starmode AT commands
- *		
- *		v0.9.5 29th May 1996 (SC)
- *		First attempt at sending (unicast) ARP packets
- *		
- *		v0.9.6 5th June 1996 (Elliot)
- *		Put "message level" tags in every "printk" statement
- *		
- *		v0.9.7 13th June 1996 (laik)
- *		Added support for the /proc fs
- *
- *              v0.9.8 July 1996 (Mema)
- *              Added packet logging
- *
- *              v1.0 November 1996 (SC)
- *              Fixed (severe) memory leaks in the /proc fs code
- *              Fixed race conditions in the logging code
- *
- *              v1.1 January 1997 (SC)
- *              Deleted packet logging (use tcpdump instead)
- *              Added support for Metricom Firmware v204 features
- *              (like message checksums)
- *
- *              v1.2 January 1997 (SC)
- *              Put portables list back in
- *
- *              v1.3 July 1997 (SC)
- *              Made STRIP driver set the radio's baud rate automatically.
- *              It is no longer necessarily to manually set the radio's
- *              rate permanently to 115200 -- the driver handles setting
- *              the rate automatically.
- */
-
-#ifdef MODULE
-static const char StripVersion[] = "1.3-STUART.CHESHIRE-MODULAR";
-#else
-static const char StripVersion[] = "1.3-STUART.CHESHIRE";
-#endif
-
-#define TICKLE_TIMERS 0
-#define EXT_COUNTERS 1
-
-
-/************************************************************************/
-/* Header files								*/
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/init.h>
-#include <asm/system.h>
-#include <asm/uaccess.h>
-#include <asm/bitops.h>
-
-/*
- * isdigit() and isspace() use the ctype[] array, which is not available
- * to kernel modules.  If compiling as a module,  use  a local definition
- * of isdigit() and isspace() until  _ctype is added to ksyms.
- */
-#ifdef MODULE
-# define isdigit(c) ('0' <= (c) && (c)  <= '9')
-# define isspace(c) ((c) == ' ' || (c)  == '\t')
-#else
-# include <linux/ctype.h>
-#endif
-
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/interrupt.h>
-#include <linux/in.h>
-#include <linux/tty.h>
-#include <linux/errno.h>
-#include <linux/netdevice.h>
-#include <linux/inetdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/if_arp.h>
-#include <linux/if_strip.h>
-#include <linux/proc_fs.h>
-#include <linux/serial.h>
-#include <linux/serialP.h>
-#include <net/arp.h>
-
-#include <linux/ip.h>
-#include <linux/tcp.h>
-#include <linux/time.h>
-
-
-/************************************************************************/
-/* Useful structures and definitions					*/
-
-/*
- * A MetricomKey identifies the protocol being carried inside a Metricom
- * Starmode packet.
- */
-
-typedef union
-{
-    __u8 c[4];
-    __u32 l;
-} MetricomKey;
-
-/*
- * An IP address can be viewed as four bytes in memory (which is what it is) or as
- * a single 32-bit long (which is convenient for assignment, equality testing etc.)
- */
-
-typedef union
-{
-    __u8 b[4];
-    __u32 l;
-} IPaddr;
-
-/*
- * A MetricomAddressString is used to hold a printable representation of
- * a Metricom address.
- */
-
-typedef struct
-{
-    __u8 c[24];
-} MetricomAddressString;
-
-/* Encapsulation can expand packet of size x to 65/64x + 1
- * Sent packet looks like "<CR>*<address>*<key><encaps payload><CR>"
- *                           1 1   1-18  1  4         ?         1
- * eg.                     <CR>*0000-1234*SIP0<encaps payload><CR>
- * We allow 31 bytes for the stars, the key, the address and the <CR>s
- */
-#define STRIP_ENCAP_SIZE(X) (32 + (X)*65L/64L)
-
-/*
- * A STRIP_Header is never really sent over the radio, but making a dummy
- * header for internal use within the kernel that looks like an Ethernet
- * header makes certain other software happier. For example, tcpdump
- * already understands Ethernet headers.
- */
-
-typedef struct
-{
-    MetricomAddress dst_addr;		/* Destination address, e.g. "0000-1234"   */
-    MetricomAddress src_addr;		/* Source address, e.g. "0000-5678"        */
-    unsigned short  protocol;		/* The protocol type, using Ethernet codes */
-} STRIP_Header;
-
-typedef struct
-{
-    char c[60];
-} MetricomNode;
-
-#define NODE_TABLE_SIZE 32
-typedef struct
-{
-    struct timeval timestamp;
-    int            num_nodes;
-    MetricomNode   node[NODE_TABLE_SIZE];
-} MetricomNodeTable;
-
-enum { FALSE = 0, TRUE = 1 };
-
-/*
- * Holds the radio's firmware version.
- */
-typedef struct
-{
-    char c[50];
-} FirmwareVersion;
-
-/*
- * Holds the radio's serial number.
- */
-typedef struct
-{
-    char c[18];
-} SerialNumber;
-
-/*
- * Holds the radio's battery voltage.
- */
-typedef struct
-{
-    char c[11];
-} BatteryVoltage;
-
-typedef struct
-{
-    char c[8];
-} char8;
-
-enum
-{
-    NoStructure = 0,		/* Really old firmware */
-    StructuredMessages = 1,	/* Parsable AT response msgs */
-    ChecksummedMessages = 2	/* Parsable AT response msgs with checksums */
-} FirmwareLevel;
-
-struct strip
-{
-    int magic;
-    /*
-     * These are pointers to the malloc()ed frame buffers.
-     */
-
-    unsigned char     *rx_buff;			/* buffer for received IP packet*/
-    unsigned char     *sx_buff;			/* buffer for received serial data*/
-    int                sx_count;		/* received serial data counter */
-    int                sx_size;			/* Serial buffer size		*/
-    unsigned char     *tx_buff;			/* transmitter buffer           */
-    unsigned char     *tx_head;			/* pointer to next byte to XMIT */
-    int                tx_left;			/* bytes left in XMIT queue     */
-    int                tx_size;			/* Serial buffer size		*/
-
-    /*
-     * STRIP interface statistics.
-     */
-
-    unsigned long      rx_packets;		/* inbound frames counter	*/
-    unsigned long      tx_packets;		/* outbound frames counter	*/
-    unsigned long      rx_errors;		/* Parity, etc. errors		*/
-    unsigned long      tx_errors;		/* Planned stuff		*/
-    unsigned long      rx_dropped;		/* No memory for skb		*/
-    unsigned long      tx_dropped;		/* When MTU change		*/
-    unsigned long      rx_over_errors;		/* Frame bigger then STRIP buf. */
-
-    unsigned long      pps_timer;		/* Timer to determine pps	*/
-    unsigned long      rx_pps_count;		/* Counter to determine pps	*/
-    unsigned long      tx_pps_count;		/* Counter to determine pps	*/
-    unsigned long      sx_pps_count;		/* Counter to determine pps	*/
-    unsigned long      rx_average_pps;		/* rx packets per second * 8	*/
-    unsigned long      tx_average_pps;		/* tx packets per second * 8	*/
-    unsigned long      sx_average_pps;		/* sent packets per second * 8	*/
-
-#ifdef EXT_COUNTERS
-    unsigned long      rx_bytes;                /* total received bytes */
-    unsigned long      tx_bytes;                /* total received bytes */
-    unsigned long      rx_rbytes;               /* bytes thru radio i/f */
-    unsigned long      tx_rbytes;               /* bytes thru radio i/f */
-    unsigned long      rx_sbytes;               /* tot bytes thru serial i/f */
-    unsigned long      tx_sbytes;               /* tot bytes thru serial i/f */
-    unsigned long      rx_ebytes;               /* tot stat/err bytes */
-    unsigned long      tx_ebytes;               /* tot stat/err bytes */
-#endif
-
-    /*
-     * Internal variables.
-     */
-
-    struct strip      *next;			/* The next struct in the list	*/
-    struct strip     **referrer;		/* The pointer that points to us*/
-    int                discard;			/* Set if serial error		*/
-    int                working;			/* Is radio working correctly?	*/
-    int                firmware_level;		/* Message structuring level	*/
-    int                next_command;		/* Next periodic command	*/
-    unsigned int       user_baud;		/* The user-selected baud rate  */
-    int                mtu;			/* Our mtu (to spot changes!)	*/
-    long               watchdog_doprobe;	/* Next time to test the radio	*/
-    long               watchdog_doreset;	/* Time to do next reset	*/
-    long               gratuitous_arp;		/* Time to send next ARP refresh*/
-    long               arp_interval;		/* Next ARP interval		*/
-    struct timer_list  idle_timer;		/* For periodic wakeup calls	*/
-    MetricomAddress    true_dev_addr;		/* True address of radio	*/
-    int                manual_dev_addr;		/* Hack: See note below         */
-
-    FirmwareVersion    firmware_version;	/* The radio's firmware version */
-    SerialNumber       serial_number;		/* The radio's serial number    */
-    BatteryVoltage     battery_voltage;		/* The radio's battery voltage  */
-
-    /*
-     * Other useful structures.
-     */
-
-    struct tty_struct *tty;			/* ptr to TTY structure		*/
-    struct net_device      dev;			/* Our device structure		*/
-
-    /*
-     * Neighbour radio records
-     */
-
-    MetricomNodeTable  portables;
-    MetricomNodeTable  poletops;
-};
-
-/*
- * Note: manual_dev_addr hack
- * 
- * It is not possible to change the hardware address of a Metricom radio,
- * or to send packets with a user-specified hardware source address, thus
- * trying to manually set a hardware source address is a questionable
- * thing to do.  However, if the user *does* manually set the hardware
- * source address of a STRIP interface, then the kernel will believe it,
- * and use it in certain places. For example, the hardware address listed
- * by ifconfig will be the manual address, not the true one.
- * (Both addresses are listed in /proc/net/strip.)
- * Also, ARP packets will be sent out giving the user-specified address as
- * the source address, not the real address. This is dangerous, because
- * it means you won't receive any replies -- the ARP replies will go to
- * the specified address, which will be some other radio. The case where
- * this is useful is when that other radio is also connected to the same
- * machine. This allows you to connect a pair of radios to one machine,
- * and to use one exclusively for inbound traffic, and the other
- * exclusively for outbound traffic. Pretty neat, huh?
- * 
- * Here's the full procedure to set this up:
- * 
- * 1. "slattach" two interfaces, e.g. st0 for outgoing packets,
- *    and st1 for incoming packets
- * 
- * 2. "ifconfig" st0 (outbound radio) to have the hardware address
- *    which is the real hardware address of st1 (inbound radio).
- *    Now when it sends out packets, it will masquerade as st1, and
- *    replies will be sent to that radio, which is exactly what we want.
- * 
- * 3. Set the route table entry ("route add default ..." or
- *    "route add -net ...", as appropriate) to send packets via the st0
- *    interface (outbound radio). Do not add any route which sends packets
- *    out via the st1 interface -- that radio is for inbound traffic only.
- * 
- * 4. "ifconfig" st1 (inbound radio) to have hardware address zero.
- *    This tells the STRIP driver to "shut down" that interface and not
- *    send any packets through it. In particular, it stops sending the
- *    periodic gratuitous ARP packets that a STRIP interface normally sends.
- *    Also, when packets arrive on that interface, it will search the
- *    interface list to see if there is another interface who's manual
- *    hardware address matches its own real address (i.e. st0 in this
- *    example) and if so it will transfer ownership of the skbuff to
- *    that interface, so that it looks to the kernel as if the packet
- *    arrived on that interface. This is necessary because when the
- *    kernel sends an ARP packet on st0, it expects to get a reply on
- *    st0, and if it sees the reply come from st1 then it will ignore
- *    it (to be accurate, it puts the entry in the ARP table, but
- *    labelled in such a way that st0 can't use it).
- * 
- * Thanks to Petros Maniatis for coming up with the idea of splitting
- * inbound and outbound traffic between two interfaces, which turned
- * out to be really easy to implement, even if it is a bit of a hack.
- * 
- * Having set a manual address on an interface, you can restore it
- * to automatic operation (where the address is automatically kept
- * consistent with the real address of the radio) by setting a manual
- * address of all ones, e.g. "ifconfig st0 hw strip FFFFFFFFFFFF"
- * This 'turns off' manual override mode for the device address.
- * 
- * Note: The IEEE 802 headers reported in tcpdump will show the *real*
- * radio addresses the packets were sent and received from, so that you
- * can see what is really going on with packets, and which interfaces
- * they are really going through.
- */
-
-
-/************************************************************************/
-/* Constants								*/
-
-/*
- * CommandString1 works on all radios
- * Other CommandStrings are only used with firmware that provides structured responses.
- * 
- * ats319=1 Enables Info message for node additions and deletions
- * ats319=2 Enables Info message for a new best node
- * ats319=4 Enables checksums
- * ats319=8 Enables ACK messages
- */
-
-static const int MaxCommandStringLength = 32;
-static const int CompatibilityCommand = 1;
-
-static const char CommandString0[] = "*&COMMAND*ATS319=7";	/* Turn on checksums & info messages */
-static const char CommandString1[] = "*&COMMAND*ATS305?";	/* Query radio name */
-static const char CommandString2[] = "*&COMMAND*ATS325?";	/* Query battery voltage */
-static const char CommandString3[] = "*&COMMAND*ATS300?";	/* Query version information */
-static const char CommandString4[] = "*&COMMAND*ATS311?";	/* Query poletop list */
-static const char CommandString5[] = "*&COMMAND*AT~LA";		/* Query portables list */
-typedef struct { const char *string; long length; } StringDescriptor;
-
-static const StringDescriptor CommandString[] =
-    {
-    { CommandString0, sizeof(CommandString0)-1 },
-    { CommandString1, sizeof(CommandString1)-1 },
-    { CommandString2, sizeof(CommandString2)-1 },
-    { CommandString3, sizeof(CommandString3)-1 },
-    { CommandString4, sizeof(CommandString4)-1 },
-    { CommandString5, sizeof(CommandString5)-1 }
-    };
-
-#define GOT_ALL_RADIO_INFO(S)      \
-    ((S)->firmware_version.c[0] && \
-     (S)->battery_voltage.c[0]  && \
-     memcmp(&(S)->true_dev_addr, zero_address.c, sizeof(zero_address)))
-
-static const char            hextable[16]      = "0123456789ABCDEF";
-
-static const MetricomAddress zero_address;
-static const MetricomAddress broadcast_address = { { 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF } };
-
-static const MetricomKey     SIP0Key           = { { "SIP0" } };
-static const MetricomKey     ARP0Key           = { { "ARP0" } };
-static const MetricomKey     ATR_Key           = { { "ATR " } };
-static const MetricomKey     ACK_Key           = { { "ACK_" } };
-static const MetricomKey     INF_Key           = { { "INF_" } };
-static const MetricomKey     ERR_Key           = { { "ERR_" } };
-
-static const long            MaxARPInterval    = 60 * HZ;          /* One minute */
-
-/*
- * Maximum Starmode packet length is 1183 bytes. Allowing 4 bytes for
- * protocol key, 4 bytes for checksum, one byte for CR, and 65/64 expansion
- * for STRIP encoding, that translates to a maximum payload MTU of 1155.
- * Note: A standard NFS 1K data packet is a total of 0x480 (1152) bytes
- * long, including IP header, UDP header, and NFS header. Setting the STRIP
- * MTU to 1152 allows us to send default sized NFS packets without fragmentation.
- */
-static const unsigned short  MAX_SEND_MTU          = 1152;
-static const unsigned short  MAX_RECV_MTU          = 1500; /* Hoping for Ethernet sized packets in the future! */
-static const unsigned short  DEFAULT_STRIP_MTU      = 1152;
-static const int             STRIP_MAGIC            = 0x5303;
-static const long            LongTime               = 0x7FFFFFFF;
-
-
-/************************************************************************/
-/* Global variables							*/
-
-static struct strip *struct_strip_list;
-
-
-/************************************************************************/
-/* Macros								*/
-
-/* Returns TRUE if text T begins with prefix P */
-#define has_prefix(T,L,P) (((L) >= sizeof(P)-1) && !strncmp((T), (P), sizeof(P)-1))
-
-/* Returns TRUE if text T of length L is equal to string S */
-#define text_equal(T,L,S) (((L) == sizeof(S)-1) && !strncmp((T), (S), sizeof(S)-1))
-
-#define READHEX(X) ((X)>='0' && (X)<='9' ? (X)-'0' :      \
-                    (X)>='a' && (X)<='f' ? (X)-'a'+10 :   \
-                    (X)>='A' && (X)<='F' ? (X)-'A'+10 : 0 )
-
-#define READHEX16(X) ((__u16)(READHEX(X)))
-
-#define READDEC(X) ((X)>='0' && (X)<='9' ? (X)-'0' : 0)
-
-#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
-#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
-#define ELEMENTS_OF(X) (sizeof(X) / sizeof((X)[0]))
-#define ARRAY_END(X) (&((X)[ELEMENTS_OF(X)]))
-
-#define JIFFIE_TO_SEC(X) ((X) / HZ)
-
-
-/************************************************************************/
-/* Utility routines							*/
-
-typedef unsigned long InterruptStatus;
-
-static inline InterruptStatus DisableInterrupts(void)
-{
-    InterruptStatus x;
-    save_flags(x);
-    cli();
-    return(x);
-}
-
-static inline void RestoreInterrupts(InterruptStatus x)
-{
-    restore_flags(x);
-}
-
-static int arp_query(unsigned char *haddr, u32 paddr, struct net_device * dev)
-{
-    struct neighbour *neighbor_entry;
-
-    neighbor_entry = neigh_lookup(&arp_tbl, &paddr, dev);
-
-    if (neighbor_entry != NULL)
-    {
-	neighbor_entry->used = jiffies;
-	if (neighbor_entry->nud_state & NUD_VALID)
-	{
-	    memcpy(haddr, neighbor_entry->ha, dev->addr_len);
-	    return 1;
-	}
-    }
-    return 0;
-}
-
-static void DumpData(char *msg, struct strip *strip_info, __u8 *ptr, __u8 *end)
-{
-    static const int MAX_DumpData = 80;
-    __u8 pkt_text[MAX_DumpData], *p = pkt_text;
-
-    *p++ = '\"';
-
-    while (ptr<end && p < &pkt_text[MAX_DumpData-4])
-    {
-        if (*ptr == '\\')
-        {
-            *p++ = '\\';
-            *p++ = '\\';
-        }
-        else
-        {
-            if (*ptr >= 32 && *ptr <= 126)
-            {
-                *p++ = *ptr;
-            }
-            else
-            {
-                sprintf(p, "\\%02X", *ptr);
-                p+= 3;
-            }
-        }
-        ptr++;
-    }
-
-    if (ptr == end)
-    {
-        *p++ = '\"';
-    }
-
-    *p++ = 0;
-
-    printk(KERN_INFO "%s: %-13s%s\n", strip_info->dev.name, msg, pkt_text);
-}
-
-#if 0
-static void HexDump(char *msg, struct strip *strip_info, __u8 *start, __u8 *end)
-{
-    __u8 *ptr = start;
-    printk(KERN_INFO "%s: %s: %d bytes\n", strip_info->dev.name, msg, end-ptr);
-
-    while (ptr < end)
-    {
-        long offset = ptr - start;
-        __u8 text[80], *p = text;
-        while (ptr < end && p < &text[16*3])
-        {
-            *p++ = hextable[*ptr >> 4];
-            *p++ = hextable[*ptr++ & 0xF];
-            *p++ = ' ';
-        }
-        p[-1] = 0;
-        printk(KERN_INFO "%s: %4lX %s\n", strip_info->dev.name, offset, text);
-    }
-}
-#endif
-
-
-/************************************************************************/
-/* Byte stuffing/unstuffing routines					*/
-
-/* Stuffing scheme:
- * 00    Unused (reserved character)
- * 01-3F Run of 2-64 different characters
- * 40-7F Run of 1-64 different characters plus a single zero at the end
- * 80-BF Run of 1-64 of the same character
- * C0-FF Run of 1-64 zeroes (ASCII 0)
- */
-
-typedef enum
-{
-    Stuff_Diff      = 0x00,
-    Stuff_DiffZero  = 0x40,
-    Stuff_Same      = 0x80,
-    Stuff_Zero      = 0xC0,
-    Stuff_NoCode    = 0xFF,	/* Special code, meaning no code selected */
-
-    Stuff_CodeMask  = 0xC0,
-    Stuff_CountMask = 0x3F,
-    Stuff_MaxCount  = 0x3F,
-    Stuff_Magic     = 0x0D	/* The value we are eliminating */
-} StuffingCode;
-
-/* StuffData encodes the data starting at "src" for "length" bytes.
- * It writes it to the buffer pointed to by "dst" (which must be at least
- * as long as 1 + 65/64 of the input length). The output may be up to 1.6%
- * larger than the input for pathological input, but will usually be smaller.
- * StuffData returns the new value of the dst pointer as its result.
- * "code_ptr_ptr" points to a "__u8 *" which is used to hold encoding state
- * between calls, allowing an encoded packet to be incrementally built up
- * from small parts. On the first call, the "__u8 *" pointed to should be
- * initialized to NULL; between subsequent calls the calling routine should
- * leave the value alone and simply pass it back unchanged so that the
- * encoder can recover its current state.
- */
-
-#define StuffData_FinishBlock(X) \
-(*code_ptr = (X) ^ Stuff_Magic, code = Stuff_NoCode)
-
-static __u8 *StuffData(__u8 *src, __u32 length, __u8 *dst, __u8 **code_ptr_ptr)
-{
-    __u8 *end = src + length;
-    __u8 *code_ptr = *code_ptr_ptr;
-     __u8 code = Stuff_NoCode, count = 0;
-
-    if (!length)
-        return(dst);
-
-    if (code_ptr)
-    {
-        /*
-         * Recover state from last call, if applicable
-         */
-        code  = (*code_ptr ^ Stuff_Magic) & Stuff_CodeMask;
-        count = (*code_ptr ^ Stuff_Magic) & Stuff_CountMask;
-    }
-
-    while (src < end)
-    {
-        switch (code)
-        {
-            /* Stuff_NoCode: If no current code, select one */
-            case Stuff_NoCode:
-                /* Record where we're going to put this code */
-                code_ptr = dst++;
-                count = 0;    /* Reset the count (zero means one instance) */
-                /* Tentatively start a new block */
-                if (*src == 0)
-                {
-                    code = Stuff_Zero;
-                    src++;
-                }
-                else
-                {
-                    code = Stuff_Same;
-                    *dst++ = *src++ ^ Stuff_Magic;
-                }
-                /* Note: We optimistically assume run of same -- */
-                /* which will be fixed later in Stuff_Same */
-                /* if it turns out not to be true. */
-                break;
-
-            /* Stuff_Zero: We already have at least one zero encoded */
-            case Stuff_Zero:
-                /* If another zero, count it, else finish this code block */
-                if (*src == 0)
-                {
-                    count++;
-                    src++;
-                }
-                else
-                {
-                    StuffData_FinishBlock(Stuff_Zero + count);
-                }
-                break;
-
-            /* Stuff_Same: We already have at least one byte encoded */
-            case Stuff_Same:
-                /* If another one the same, count it */
-                if ((*src ^ Stuff_Magic) == code_ptr[1])
-                {
-                    count++;
-                    src++;
-                    break;
-                }
-                /* else, this byte does not match this block. */
-                /* If we already have two or more bytes encoded, finish this code block */
-                if (count)
-                {
-                    StuffData_FinishBlock(Stuff_Same + count);
-                    break;
-                }
-                /* else, we only have one so far, so switch to Stuff_Diff code */
-                code = Stuff_Diff;
-                /* and fall through to Stuff_Diff case below
-                 * Note cunning cleverness here: case Stuff_Diff compares 
-                 * the current character with the previous two to see if it
-                 * has a run of three the same. Won't this be an error if
-                 * there aren't two previous characters stored to compare with?
-                 * No. Because we know the current character is *not* the same
-                 * as the previous one, the first test below will necessarily
-                 * fail and the send half of the "if" won't be executed.
-                 */
-
-            /* Stuff_Diff: We have at least two *different* bytes encoded */
-            case Stuff_Diff:
-                /* If this is a zero, must encode a Stuff_DiffZero, and begin a new block */
-                if (*src == 0)
-                {
-                    StuffData_FinishBlock(Stuff_DiffZero + count);
-                }
-                /* else, if we have three in a row, it is worth starting a Stuff_Same block */
-                else if ((*src ^ Stuff_Magic)==dst[-1] && dst[-1]==dst[-2])
-                {
-                    /* Back off the last two characters we encoded */
-                    code += count-2;
-                    /* Note: "Stuff_Diff + 0" is an illegal code */
-                    if (code == Stuff_Diff + 0)
-                    {
-                        code = Stuff_Same + 0;
-                    }
-                    StuffData_FinishBlock(code);
-                    code_ptr = dst-2;
-                    /* dst[-1] already holds the correct value */
-                    count = 2;        /* 2 means three bytes encoded */
-                    code = Stuff_Same;
-                }
-                /* else, another different byte, so add it to the block */
-                else
-                {
-                    *dst++ = *src ^ Stuff_Magic;
-                    count++;
-                }
-                src++;    /* Consume the byte */
-                break;
-        }
-        if (count == Stuff_MaxCount)
-        {
-            StuffData_FinishBlock(code + count);
-        }
-    }
-    if (code == Stuff_NoCode)
-    {
-        *code_ptr_ptr = NULL;
-    }
-    else
-    {
-        *code_ptr_ptr = code_ptr;
-        StuffData_FinishBlock(code + count);
-    }
-    return(dst);
-}
-
-/*
- * UnStuffData decodes the data at "src", up to (but not including) "end".
- * It writes the decoded data into the buffer pointed to by "dst", up to a
- * maximum of "dst_length", and returns the new value of "src" so that a
- * follow-on call can read more data, continuing from where the first left off.
- * 
- * There are three types of results:
- * 1. The source data runs out before extracting "dst_length" bytes:
- *    UnStuffData returns NULL to indicate failure.
- * 2. The source data produces exactly "dst_length" bytes:
- *    UnStuffData returns new_src = end to indicate that all bytes were consumed.
- * 3. "dst_length" bytes are extracted, with more remaining.
- *    UnStuffData returns new_src < end to indicate that there are more bytes
- *    to be read.
- * 
- * Note: The decoding may be destructive, in that it may alter the source
- * data in the process of decoding it (this is necessary to allow a follow-on
- * call to resume correctly).
- */
-
-static __u8 *UnStuffData(__u8 *src, __u8 *end, __u8 *dst, __u32 dst_length)
-{
-    __u8 *dst_end = dst + dst_length;
-    /* Sanity check */
-    if (!src || !end || !dst || !dst_length)
-        return(NULL);
-    while (src < end && dst < dst_end)
-    {
-        int count = (*src ^ Stuff_Magic) & Stuff_CountMask;
-        switch ((*src ^ Stuff_Magic) & Stuff_CodeMask)
-        {
-            case Stuff_Diff:
-                if (src+1+count >= end)
-                    return(NULL);
-                do
-                {
-                    *dst++ = *++src ^ Stuff_Magic;
-                }
-                while(--count >= 0 && dst < dst_end);
-                if (count < 0)
-                    src += 1;
-                else
-                {
-                    if (count == 0)
-                        *src = Stuff_Same ^ Stuff_Magic;
-                    else
-                        *src = (Stuff_Diff + count) ^ Stuff_Magic;
-                }
-                break;
-            case Stuff_DiffZero:
-                if (src+1+count >= end)
-                    return(NULL);
-                do
-                {
-                    *dst++ = *++src ^ Stuff_Magic;
-                }
-                while(--count >= 0 && dst < dst_end);
-                if (count < 0)
-                    *src = Stuff_Zero ^ Stuff_Magic;
-                else
-                    *src = (Stuff_DiffZero + count) ^ Stuff_Magic;
-                break;
-            case Stuff_Same:
-                if (src+1 >= end)
-                    return(NULL);
-                do
-                {
-                    *dst++ = src[1] ^ Stuff_Magic;
-                }
-                while(--count >= 0 && dst < dst_end);
-                if (count < 0)
-                    src += 2;
-                else
-                    *src = (Stuff_Same + count) ^ Stuff_Magic;
-                break;
-            case Stuff_Zero:
-                do
-                {
-                    *dst++ = 0;
-                }
-                while(--count >= 0 && dst < dst_end);
-                if (count < 0)
-                    src += 1;
-                else
-                    *src = (Stuff_Zero + count) ^ Stuff_Magic;
-                break;
-        }
-    }
-    if (dst < dst_end)
-        return(NULL);
-    else
-        return(src);
-}
-
-
-/************************************************************************/
-/* General routines for STRIP						*/
-
-/*
- * get_baud returns the current baud rate, as one of the constants defined in
- * termbits.h
- * If the user has issued a baud rate override using the 'setserial' command
- * and the logical current rate is set to 38.4, then the true baud rate
- * currently in effect (57.6 or 115.2) is returned.
- */
-static unsigned int get_baud(struct tty_struct *tty)
-    {
-    if (!tty || !tty->termios) return(0);
-    if ((tty->termios->c_cflag & CBAUD) == B38400 && tty->driver_data)
-        {
-        struct async_struct *info = (struct async_struct *)tty->driver_data;
-        if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI ) return(B57600);
-        if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) return(B115200);
-        }
-    return(tty->termios->c_cflag & CBAUD);
-    }
-
-/*
- * set_baud sets the baud rate to the rate defined by baudcode
- * Note: The rate B38400 should be avoided, because the user may have
- * issued a 'setserial' speed override to map that to a different speed.
- * We could achieve a true rate of 38400 if we needed to by cancelling
- * any user speed override that is in place, but that might annoy the
- * user, so it is simplest to just avoid using 38400.
- */
-static void set_baud(struct tty_struct *tty, unsigned int baudcode)
-    {
-    struct termios old_termios = *(tty->termios);
-    tty->termios->c_cflag &= ~CBAUD; /* Clear the old baud setting */
-    tty->termios->c_cflag |= baudcode; /* Set the new baud setting */
-    tty->driver.set_termios(tty, &old_termios);
-    }
-
-/*
- * Convert a string to a Metricom Address.
- */
-
-#define IS_RADIO_ADDRESS(p) (                                                 \
-  isdigit((p)[0]) && isdigit((p)[1]) && isdigit((p)[2]) && isdigit((p)[3]) && \
-  (p)[4] == '-' &&                                                            \
-  isdigit((p)[5]) && isdigit((p)[6]) && isdigit((p)[7]) && isdigit((p)[8])    )
-
-static int string_to_radio_address(MetricomAddress *addr, __u8 *p)
-{
-    if (!IS_RADIO_ADDRESS(p)) return(1);
-    addr->c[0] = 0;
-    addr->c[1] = 0;
-    addr->c[2] = READHEX(p[0]) << 4 | READHEX(p[1]);
-    addr->c[3] = READHEX(p[2]) << 4 | READHEX(p[3]);
-    addr->c[4] = READHEX(p[5]) << 4 | READHEX(p[6]);
-    addr->c[5] = READHEX(p[7]) << 4 | READHEX(p[8]);
-    return(0);
-}
-
-/*
- * Convert a Metricom Address to a string.
- */
-
-static __u8 *radio_address_to_string(const MetricomAddress *addr, MetricomAddressString *p)
-{
-    sprintf(p->c, "%02X%02X-%02X%02X", addr->c[2], addr->c[3], addr->c[4], addr->c[5]);
-    return(p->c);
-}
-
-/*
- * Note: Must make sure sx_size is big enough to receive a stuffed
- * MAX_RECV_MTU packet. Additionally, we also want to ensure that it's
- * big enough to receive a large radio neighbour list (currently 4K).
- */
-
-static int allocate_buffers(struct strip *strip_info)
-{
-    struct net_device *dev = &strip_info->dev;
-    int sx_size    = MAX(STRIP_ENCAP_SIZE(MAX_RECV_MTU), 4096);
-    int tx_size    = STRIP_ENCAP_SIZE(dev->mtu) + MaxCommandStringLength;
-    __u8 *r = kmalloc(MAX_RECV_MTU, GFP_ATOMIC);
-    __u8 *s = kmalloc(sx_size,      GFP_ATOMIC);
-    __u8 *t = kmalloc(tx_size,      GFP_ATOMIC);
-    if (r && s && t)
-    {
-        strip_info->rx_buff = r;
-        strip_info->sx_buff = s;
-        strip_info->tx_buff = t;
-        strip_info->sx_size = sx_size;
-        strip_info->tx_size = tx_size;
-        strip_info->mtu     = dev->mtu;
-        return(1);
-    }
-    if (r) kfree(r);
-    if (s) kfree(s);
-    if (t) kfree(t);
-    return(0);
-}
-
-/*
- * MTU has been changed by the IP layer. Unfortunately we are not told
- * about this, but we spot it ourselves and fix things up. We could be in
- * an upcall from the tty driver, or in an ip packet queue.
- */
-
-static void strip_changedmtu(struct strip *strip_info)
-{
-    int old_mtu           = strip_info->mtu;
-    struct net_device *dev    = &strip_info->dev;
-    unsigned char *orbuff = strip_info->rx_buff;
-    unsigned char *osbuff = strip_info->sx_buff;
-    unsigned char *otbuff = strip_info->tx_buff;
-    InterruptStatus intstat;
-
-    if (dev->mtu > MAX_SEND_MTU)
-    {
-        printk(KERN_ERR "%s: MTU exceeds maximum allowable (%d), MTU change cancelled.\n",
-            strip_info->dev.name, MAX_SEND_MTU);
-        dev->mtu = old_mtu;
-        return;
-    }
-
-    /*
-     * Have to disable interrupts here because we're reallocating and resizing
-     * the serial buffers, and we can't have data arriving in them while we're
-     * moving them around in memory. This may cause data to be lost on the serial
-     * port, but hopefully people won't change MTU that often.
-     * Also note, this may not work on a symmetric multi-processor system.
-     */
-    intstat = DisableInterrupts();
-
-    if (!allocate_buffers(strip_info))
-    {
-        RestoreInterrupts(intstat);
-        printk(KERN_ERR "%s: unable to grow strip buffers, MTU change cancelled.\n",
-            strip_info->dev.name);
-        dev->mtu = old_mtu;
-        return;
-    }
-
-    if (strip_info->sx_count)
-    {
-        if (strip_info->sx_count <= strip_info->sx_size)
-            memcpy(strip_info->sx_buff, osbuff, strip_info->sx_count);
-        else
-        {
-            strip_info->discard = strip_info->sx_count;
-            strip_info->rx_over_errors++;
-        }
-    }
-
-    if (strip_info->tx_left)
-    {
-        if (strip_info->tx_left <= strip_info->tx_size)
-            memcpy(strip_info->tx_buff, strip_info->tx_head, strip_info->tx_left);
-        else
-        {
-            strip_info->tx_left = 0;
-            strip_info->tx_dropped++;
-        }
-    }
-    strip_info->tx_head = strip_info->tx_buff;
-
-    RestoreInterrupts(intstat);
-
-    printk(KERN_NOTICE "%s: strip MTU changed fom %d to %d.\n",
-        strip_info->dev.name, old_mtu, strip_info->mtu);
-
-    if (orbuff) kfree(orbuff);
-    if (osbuff) kfree(osbuff);
-    if (otbuff) kfree(otbuff);
-}
-
-static void strip_unlock(struct strip *strip_info)
-{
-    /*
-     * Set the timer to go off in one second.
-     */
-    strip_info->idle_timer.expires = jiffies + 1*HZ;
-    add_timer(&strip_info->idle_timer);
-    netif_wake_queue(&strip_info->dev);
-}
-
-
-/************************************************************************/
-/* Callback routines for exporting information through /proc		*/
-
-/*
- * This function updates the total amount of data printed so far. It then
- * determines if the amount of data printed into a buffer  has reached the
- * offset requested. If it hasn't, then the buffer is shifted over so that
- * the next bit of data can be printed over the old bit. If the total
- * amount printed so far exceeds the total amount requested, then this
- * function returns 1, otherwise 0.
- */
-static int 
-shift_buffer(char *buffer, int requested_offset, int requested_len,
-             int *total, int *slop, char **buf)
-{
-    int printed;
-
-    /* printk(KERN_DEBUG "shift: buffer: %d o: %d l: %d t: %d buf: %d\n",
-           (int) buffer, requested_offset, requested_len, *total,
-           (int) *buf); */
-    printed = *buf - buffer;
-    if (*total + printed <= requested_offset) {
-        *total += printed;
-        *buf = buffer;
-    }
-    else {
-        if (*total < requested_offset) {
-            *slop = requested_offset - *total;
-        }
-        *total = requested_offset + printed - *slop;
-    }
-    if (*total > requested_offset + requested_len) {
-        return 1;
-    }
-    else {
-        return 0;
-    }
-}
-
-/*
- * This function calculates the actual start of the requested data
- * in the buffer. It also calculates actual length of data returned,
- * which could be less that the amount of data requested.
- */
-static int
-calc_start_len(char *buffer, char **start, int requested_offset,
-               int requested_len, int total, char *buf)
-{
-    int return_len, buffer_len;
-
-    buffer_len = buf - buffer;
-    if (buffer_len >= 4095) {
- 	printk(KERN_ERR "STRIP: exceeded /proc buffer size\n");
-    }
-
-    /*
-     * There may be bytes before and after the
-     * chunk that was actually requested.
-     */
-    return_len = total - requested_offset;
-    if (return_len < 0) {
-        return_len = 0;
-    }
-    *start = buf - return_len;
-    if (return_len > requested_len) {
-        return_len = requested_len;
-    }
-    /* printk(KERN_DEBUG "return_len: %d\n", return_len); */
-    return return_len;
-}
-
-/*
- * If the time is in the near future, time_delta prints the number of
- * seconds to go into the buffer and returns the address of the buffer.
- * If the time is not in the near future, it returns the address of the
- * string "Not scheduled" The buffer must be long enough to contain the
- * ascii representation of the number plus 9 charactes for the " seconds"
- * and the null character.
- */
-static char *time_delta(char buffer[], long time)
-{
-    time -= jiffies;
-    if (time > LongTime / 2) return("Not scheduled");
-    if(time < 0) time = 0;  /* Don't print negative times */
-    sprintf(buffer, "%ld seconds", time / HZ);
-    return(buffer);
-}
-
-static int sprintf_neighbours(char *buffer, MetricomNodeTable *table, char *title)
-{
-    /* We wrap this in a do/while loop, so if the table changes */
-    /* while we're reading it, we just go around and try again. */
-    struct timeval t;
-    char *ptr;
-    do
-        {
-        int i;
-        t = table->timestamp;
-        ptr = buffer;
-        if (table->num_nodes) ptr += sprintf(ptr, "\n %s\n", title);
-        for (i=0; i<table->num_nodes; i++)
-            {
-            InterruptStatus intstat = DisableInterrupts();
-            MetricomNode node = table->node[i];
-            RestoreInterrupts(intstat);
-            ptr += sprintf(ptr, "  %s\n", node.c);
-            }
-        } while (table->timestamp.tv_sec != t.tv_sec || table->timestamp.tv_usec != t.tv_usec);
-    return ptr - buffer;
-}
-
-/*
- * This function prints radio status information into the specified buffer.
- * I think the buffer size is 4K, so this routine should never print more
- * than 4K of data into it. With the maximum of 32 portables and 32 poletops
- * reported, the routine outputs 3107 bytes into the buffer.
- */
-static int
-sprintf_status_info(char *buffer, struct strip *strip_info)
-{
-    char temp[32];
-    char *p = buffer;
-    MetricomAddressString addr_string;
-
-    /* First, we must copy all of our data to a safe place, */
-    /* in case a serial interrupt comes in and changes it.  */
-    InterruptStatus intstat = DisableInterrupts();
-    int                tx_left             = strip_info->tx_left;
-    unsigned long      rx_average_pps      = strip_info->rx_average_pps;
-    unsigned long      tx_average_pps      = strip_info->tx_average_pps;
-    unsigned long      sx_average_pps      = strip_info->sx_average_pps;
-    int                working             = strip_info->working;
-    int                firmware_level      = strip_info->firmware_level;
-    long               watchdog_doprobe    = strip_info->watchdog_doprobe;
-    long               watchdog_doreset    = strip_info->watchdog_doreset;
-    long               gratuitous_arp      = strip_info->gratuitous_arp;
-    long               arp_interval        = strip_info->arp_interval;
-    FirmwareVersion    firmware_version    = strip_info->firmware_version;
-    SerialNumber       serial_number       = strip_info->serial_number;
-    BatteryVoltage     battery_voltage     = strip_info->battery_voltage;
-    char*              if_name             = strip_info->dev.name;
-    MetricomAddress    true_dev_addr       = strip_info->true_dev_addr;
-    MetricomAddress    dev_dev_addr        = *(MetricomAddress*)strip_info->dev.dev_addr;
-    int                manual_dev_addr     = strip_info->manual_dev_addr;
-#ifdef EXT_COUNTERS
-    unsigned long      rx_bytes            = strip_info->rx_bytes;
-    unsigned long      tx_bytes            = strip_info->tx_bytes;
-    unsigned long      rx_rbytes           = strip_info->rx_rbytes;
-    unsigned long      tx_rbytes           = strip_info->tx_rbytes;
-    unsigned long      rx_sbytes           = strip_info->rx_sbytes;
-    unsigned long      tx_sbytes           = strip_info->tx_sbytes;
-    unsigned long      rx_ebytes           = strip_info->rx_ebytes;
-    unsigned long      tx_ebytes           = strip_info->tx_ebytes;
-#endif
-    RestoreInterrupts(intstat);
-
-    p += sprintf(p, "\nInterface name\t\t%s\n", if_name);
-    p += sprintf(p, " Radio working:\t\t%s\n", working ? "Yes" : "No");
-    radio_address_to_string(&true_dev_addr, &addr_string);
-    p += sprintf(p, " Radio address:\t\t%s\n", addr_string.c);
-    if (manual_dev_addr)
-    {
-        radio_address_to_string(&dev_dev_addr, &addr_string);
-        p += sprintf(p, " Device address:\t%s\n", addr_string.c);
-    }
-    p += sprintf(p, " Firmware version:\t%s", !working        ? "Unknown" :
-                                              !firmware_level ? "Should be upgraded" :
-                                              firmware_version.c);
-    if (firmware_level >= ChecksummedMessages) p += sprintf(p, " (Checksums Enabled)");
-    p += sprintf(p, "\n");
-    p += sprintf(p, " Serial number:\t\t%s\n", serial_number.c);
-    p += sprintf(p, " Battery voltage:\t%s\n", battery_voltage.c);
-    p += sprintf(p, " Transmit queue (bytes):%d\n", tx_left);
-    p += sprintf(p, " Receive packet rate:   %ld packets per second\n", rx_average_pps / 8);
-    p += sprintf(p, " Transmit packet rate:  %ld packets per second\n", tx_average_pps / 8);
-    p += sprintf(p, " Sent packet rate:      %ld packets per second\n", sx_average_pps / 8);
-    p += sprintf(p, " Next watchdog probe:\t%s\n", time_delta(temp, watchdog_doprobe));
-    p += sprintf(p, " Next watchdog reset:\t%s\n", time_delta(temp, watchdog_doreset));
-    p += sprintf(p, " Next gratuitous ARP:\t");
-
-    if (!memcmp(strip_info->dev.dev_addr, zero_address.c, sizeof(zero_address)))
-        p += sprintf(p, "Disabled\n");
-    else
-    {
-        p += sprintf(p, "%s\n", time_delta(temp, gratuitous_arp));
-        p += sprintf(p, " Next ARP interval:\t%ld seconds\n", JIFFIE_TO_SEC(arp_interval));
-    }
-
-    if (working)
-        {
-#ifdef EXT_COUNTERS
-          p += sprintf(p, "\n");
-          p += sprintf(p, " Total bytes:         \trx:\t%lu\ttx:\t%lu\n", rx_bytes, tx_bytes);
-          p += sprintf(p, "  thru radio:         \trx:\t%lu\ttx:\t%lu\n", rx_rbytes, tx_rbytes);
-          p += sprintf(p, "  thru serial port:   \trx:\t%lu\ttx:\t%lu\n", rx_sbytes, tx_sbytes);
-          p += sprintf(p, " Total stat/err bytes:\trx:\t%lu\ttx:\t%lu\n", rx_ebytes, tx_ebytes);
-#endif
-        p += sprintf_neighbours(p, &strip_info->poletops, "Poletops:");
-        p += sprintf_neighbours(p, &strip_info->portables, "Portables:");
-        }
-
-    return p - buffer;
-}
-
-/*
- * This function is exports status information from the STRIP driver through
- * the /proc file system.
- */
-
-static int get_status_info(char *buffer, char **start, off_t req_offset, int req_len)
-{
-    int           total = 0, slop = 0;
-    struct strip *strip_info = struct_strip_list;
-    char         *buf = buffer;
-
-    buf += sprintf(buf, "strip_version: %s\n", StripVersion);
-    if (shift_buffer(buffer, req_offset, req_len, &total, &slop, &buf)) goto exit;
-
-    while (strip_info != NULL)
-        {
-        buf += sprintf_status_info(buf, strip_info);
-        if (shift_buffer(buffer, req_offset, req_len, &total, &slop, &buf)) break;
-        strip_info = strip_info->next;
-        }
-    exit:
-    return(calc_start_len(buffer, start, req_offset, req_len, total, buf));
-}
-
-/************************************************************************/
-/* Sending routines							*/
-
-static void ResetRadio(struct strip *strip_info)
-{
-    struct tty_struct *tty = strip_info->tty;
-    static const char init[] = "ate0q1dt**starmode\r**";
-    StringDescriptor s = { init, sizeof(init)-1 };
-
-    /* 
-     * If the radio isn't working anymore,
-     * we should clear the old status information.
-     */
-    if (strip_info->working)
-    {
-        printk(KERN_INFO "%s: No response: Resetting radio.\n", strip_info->dev.name);
-        strip_info->firmware_version.c[0] = '\0';
-        strip_info->serial_number.c[0] = '\0';
-        strip_info->battery_voltage.c[0] = '\0';
-        strip_info->portables.num_nodes = 0;
-        do_gettimeofday(&strip_info->portables.timestamp);
-        strip_info->poletops.num_nodes = 0;
-        do_gettimeofday(&strip_info->poletops.timestamp);
-    }
-
-    strip_info->pps_timer      = jiffies;
-    strip_info->rx_pps_count   = 0;
-    strip_info->tx_pps_count   = 0;
-    strip_info->sx_pps_count   = 0;
-    strip_info->rx_average_pps = 0;
-    strip_info->tx_average_pps = 0;
-    strip_info->sx_average_pps = 0;
-
-    /* Mark radio address as unknown */
-    *(MetricomAddress*)&strip_info->true_dev_addr = zero_address;
-    if (!strip_info->manual_dev_addr)
-        *(MetricomAddress*)strip_info->dev.dev_addr = zero_address;
-    strip_info->working = FALSE;
-    strip_info->firmware_level = NoStructure;
-    strip_info->next_command   = CompatibilityCommand;
-    strip_info->watchdog_doprobe = jiffies + 10 * HZ;
-    strip_info->watchdog_doreset = jiffies + 1 * HZ;
-
-    /* If the user has selected a baud rate above 38.4 see what magic we have to do */
-    if (strip_info->user_baud > B38400)
-        {
-        /*
-         * Subtle stuff: Pay attention :-)
-         * If the serial port is currently at the user's selected (>38.4) rate,
-         * then we temporarily switch to 19.2 and issue the ATS304 command
-         * to tell the radio to switch to the user's selected rate.
-         * If the serial port is not currently at that rate, that means we just
-         * issued the ATS304 command last time through, so this time we restore
-         * the user's selected rate and issue the normal starmode reset string.
-         */
-        if (strip_info->user_baud == get_baud(tty))
-	    {
-	    static const char b0[] = "ate0q1s304=57600\r";
-	    static const char b1[] = "ate0q1s304=115200\r";
-	    static const StringDescriptor baudstring[2] =
-                { { b0, sizeof(b0)-1 }, { b1, sizeof(b1)-1 } };
-	    set_baud(tty, B19200);
-	    if      (strip_info->user_baud == B57600 ) s = baudstring[0];
-	    else if (strip_info->user_baud == B115200) s = baudstring[1];
-	    else s = baudstring[1]; /* For now */
-	    }
-        else set_baud(tty, strip_info->user_baud);
-        }
-
-    tty->driver.write(tty, 0, s.string, s.length);
-#ifdef EXT_COUNTERS
-    strip_info->tx_ebytes += s.length;
-#endif
-}
-
-/*
- * Called by the driver when there's room for more data.  If we have
- * more packets to send, we send them here.
- */
-
-static void strip_write_some_more(struct tty_struct *tty)
-{
-    struct strip *strip_info = (struct strip *) tty->disc_data;
-
-    /* First make sure we're connected. */
-    if (!strip_info || strip_info->magic != STRIP_MAGIC || 
-    	!netif_running(&strip_info->dev))
-        return;
-
-    if (strip_info->tx_left > 0)
-    {
-        /*
-         * If some data left, send it
-         * Note: There's a kernel design bug here. The write_wakeup routine has to
-         * know how many bytes were written in the previous call, but the number of
-         * bytes written is returned as the result of the tty->driver.write call,
-         * and there's no guarantee that the tty->driver.write routine will have
-         * returned before the write_wakeup routine is invoked. If the PC has fast
-         * Serial DMA hardware, then it's quite possible that the write could complete
-         * almost instantaneously, meaning that my write_wakeup routine could be
-         * called immediately, before tty->driver.write has had a chance to return
-         * the number of bytes that it wrote. In an attempt to guard against this,
-         * I disable interrupts around the call to tty->driver.write, although even
-         * this might not work on a symmetric multi-processor system.
-         */
-        InterruptStatus intstat = DisableInterrupts();
-        int num_written = tty->driver.write(tty, 0, strip_info->tx_head, strip_info->tx_left);
-        strip_info->tx_left -= num_written;
-        strip_info->tx_head += num_written;
-#ifdef EXT_COUNTERS
-        strip_info->tx_sbytes += num_written;
-#endif
-        RestoreInterrupts(intstat);
-    }
-    else            /* Else start transmission of another packet */
-    {
-        tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
-        strip_unlock(strip_info);
-    }
-}
-
-static __u8 *add_checksum(__u8 *buffer, __u8 *end)
-{
-    __u16 sum = 0;
-    __u8 *p = buffer;
-    while (p < end) sum += *p++;
-    end[3] = hextable[sum & 0xF]; sum >>= 4;
-    end[2] = hextable[sum & 0xF]; sum >>= 4;
-    end[1] = hextable[sum & 0xF]; sum >>= 4;
-    end[0] = hextable[sum & 0xF];
-    return(end+4);
-}
-
-static unsigned char *strip_make_packet(unsigned char *buffer, struct strip *strip_info, struct sk_buff *skb)
-{
-    __u8           *ptr = buffer;
-    __u8           *stuffstate = NULL;
-    STRIP_Header   *header     = (STRIP_Header *)skb->data;
-    MetricomAddress haddr      = header->dst_addr;
-    int             len        = skb->len - sizeof(STRIP_Header);
-    MetricomKey     key;
-
-    /*HexDump("strip_make_packet", strip_info, skb->data, skb->data + skb->len);*/
-
-    if      (header->protocol == htons(ETH_P_IP))  key = SIP0Key;
-    else if (header->protocol == htons(ETH_P_ARP)) key = ARP0Key;
-    else
-    {
-        printk(KERN_ERR "%s: strip_make_packet: Unknown packet type 0x%04X\n",
-            strip_info->dev.name, ntohs(header->protocol));
-        return(NULL);
-    }
-
-    if (len > strip_info->mtu)
-    {
-        printk(KERN_ERR "%s: Dropping oversized transmit packet: %d bytes\n",
-            strip_info->dev.name, len);
-        return(NULL);
-    }
-
-    /*
-     * If we're sending to ourselves, discard the packet.
-     * (Metricom radios choke if they try to send a packet to their own address.)
-     */
-    if (!memcmp(haddr.c, strip_info->true_dev_addr.c, sizeof(haddr)))
-    {
-        printk(KERN_ERR "%s: Dropping packet addressed to self\n", strip_info->dev.name);
-        return(NULL);
-    }
-
-    /*
-     * If this is a broadcast packet, send it to our designated Metricom
-     * 'broadcast hub' radio (First byte of address being 0xFF means broadcast)
-     */
-    if (haddr.c[0] == 0xFF)
-    {
-	u32 brd = 0;
- 	struct in_device *in_dev = in_dev_get(&strip_info->dev);
-	if (in_dev == NULL)
-		return NULL;
-	read_lock(&in_dev->lock);
-	if (in_dev->ifa_list)
-		brd = in_dev->ifa_list->ifa_broadcast;
-	read_unlock(&in_dev->lock);
-	in_dev_put(in_dev);
-
-	/* arp_query returns 1 if it succeeds in looking up the address, 0 if it fails */
-        if (!arp_query(haddr.c, brd, &strip_info->dev))
-        {
-            printk(KERN_ERR "%s: Unable to send packet (no broadcast hub configured)\n",
-                strip_info->dev.name);
-            return(NULL);
-        }
-	/*
-	 * If we are the broadcast hub, don't bother sending to ourselves.
-	 * (Metricom radios choke if they try to send a packet to their own address.)
-	 */
-        if (!memcmp(haddr.c, strip_info->true_dev_addr.c, sizeof(haddr))) return(NULL);
-    }
-
-    *ptr++ = 0x0D;
-    *ptr++ = '*';
-    *ptr++ = hextable[haddr.c[2] >> 4];
-    *ptr++ = hextable[haddr.c[2] & 0xF];
-    *ptr++ = hextable[haddr.c[3] >> 4];
-    *ptr++ = hextable[haddr.c[3] & 0xF];
-    *ptr++ = '-';
-    *ptr++ = hextable[haddr.c[4] >> 4];
-    *ptr++ = hextable[haddr.c[4] & 0xF];
-    *ptr++ = hextable[haddr.c[5] >> 4];
-    *ptr++ = hextable[haddr.c[5] & 0xF];
-    *ptr++ = '*';
-    *ptr++ = key.c[0];
-    *ptr++ = key.c[1];
-    *ptr++ = key.c[2];
-    *ptr++ = key.c[3];
-
-    ptr = StuffData(skb->data + sizeof(STRIP_Header), len, ptr, &stuffstate);
-
-    if (strip_info->firmware_level >= ChecksummedMessages) ptr = add_checksum(buffer+1, ptr);
-
-    *ptr++ = 0x0D;
-    return(ptr);
-}
-
-static void strip_send(struct strip *strip_info, struct sk_buff *skb)
-{
-    MetricomAddress haddr;
-    unsigned char *ptr = strip_info->tx_buff;
-    int doreset = (long)jiffies - strip_info->watchdog_doreset >= 0;
-    int doprobe = (long)jiffies - strip_info->watchdog_doprobe >= 0 && !doreset;
-    u32 addr, brd;
-
-    /*
-     * 1. If we have a packet, encapsulate it and put it in the buffer
-     */
-    if (skb)
-    {
-        char *newptr = strip_make_packet(ptr, strip_info, skb);
-        strip_info->tx_pps_count++;
-        if (!newptr) strip_info->tx_dropped++;
-        else
-        {
-            ptr = newptr;
-            strip_info->sx_pps_count++;
-            strip_info->tx_packets++;        /* Count another successful packet */
-#ifdef EXT_COUNTERS
-            strip_info->tx_bytes += skb->len;
-            strip_info->tx_rbytes += ptr - strip_info->tx_buff;
-#endif
-            /*DumpData("Sending:", strip_info, strip_info->tx_buff, ptr);*/
-            /*HexDump("Sending", strip_info, strip_info->tx_buff, ptr);*/
-        }
-    }
-
-    /*
-     * 2. If it is time for another tickle, tack it on, after the packet
-     */
-    if (doprobe)
-    {
-        StringDescriptor ts = CommandString[strip_info->next_command];
-#if TICKLE_TIMERS
-        {
-        struct timeval tv;
-        do_gettimeofday(&tv);
-        printk(KERN_INFO "**** Sending tickle string %d      at %02d.%06d\n",
-            strip_info->next_command, tv.tv_sec % 100, tv.tv_usec);
-        }
-#endif
-        if (ptr == strip_info->tx_buff) *ptr++ = 0x0D;
-
-        *ptr++ = '*'; /* First send "**" to provoke an error message */
-        *ptr++ = '*';
-
-        /* Then add the command */
-        memcpy(ptr, ts.string, ts.length);
-
-        /* Add a checksum ? */
-        if (strip_info->firmware_level < ChecksummedMessages) ptr += ts.length;
-        else ptr = add_checksum(ptr, ptr + ts.length);
-
-        *ptr++ = 0x0D; /* Terminate the command with a <CR> */
-
-        /* Cycle to next periodic command? */
-        if (strip_info->firmware_level >= StructuredMessages)
-                if (++strip_info->next_command >= ELEMENTS_OF(CommandString))
-                        strip_info->next_command = 0;
-#ifdef EXT_COUNTERS
-        strip_info->tx_ebytes += ts.length;
-#endif
-        strip_info->watchdog_doprobe = jiffies + 10 * HZ;
-        strip_info->watchdog_doreset = jiffies + 1 * HZ;
-        /*printk(KERN_INFO "%s: Routine radio test.\n", strip_info->dev.name);*/
-    }
-
-    /*
-     * 3. Set up the strip_info ready to send the data (if any).
-     */
-    strip_info->tx_head = strip_info->tx_buff;
-    strip_info->tx_left = ptr - strip_info->tx_buff;
-    strip_info->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP);
-
-    /*
-     * 4. Debugging check to make sure we're not overflowing the buffer.
-     */
-    if (strip_info->tx_size - strip_info->tx_left < 20)
-        printk(KERN_ERR "%s: Sending%5d bytes;%5d bytes free.\n", strip_info->dev.name,
-            strip_info->tx_left, strip_info->tx_size - strip_info->tx_left);
-
-    /*
-     * 5. If watchdog has expired, reset the radio. Note: if there's data waiting in
-     * the buffer, strip_write_some_more will send it after the reset has finished
-     */
-    if (doreset) { ResetRadio(strip_info); return; }
-
-    if (1) {
-	    struct in_device *in_dev = in_dev_get(&strip_info->dev);
-	    brd = addr = 0;
-	    if (in_dev) {
-		    read_lock(&in_dev->lock);
-		    if (in_dev->ifa_list) {
-			    brd = in_dev->ifa_list->ifa_broadcast;
-			    addr = in_dev->ifa_list->ifa_local;
-		    }
-		    read_unlock(&in_dev->lock);
-		    in_dev_put(in_dev);
-	    }
-    }
-    
-
-    /*
-     * 6. If it is time for a periodic ARP, queue one up to be sent.
-     * We only do this if:
-     *  1. The radio is working
-     *  2. It's time to send another periodic ARP
-     *  3. We really know what our address is (and it is not manually set to zero)
-     *  4. We have a designated broadcast address configured
-     * If we queue up an ARP packet when we don't have a designated broadcast
-     * address configured, then the packet will just have to be discarded in
-     * strip_make_packet. This is not fatal, but it causes misleading information
-     * to be displayed in tcpdump. tcpdump will report that periodic APRs are
-     * being sent, when in fact they are not, because they are all being dropped
-     * in the strip_make_packet routine.
-     */
-    if (strip_info->working && (long)jiffies - strip_info->gratuitous_arp >= 0 &&
-        memcmp(strip_info->dev.dev_addr, zero_address.c, sizeof(zero_address)) &&
-        arp_query(haddr.c, brd, &strip_info->dev))
-    {
-        /*printk(KERN_INFO "%s: Sending gratuitous ARP with interval %ld\n",
-            strip_info->dev.name, strip_info->arp_interval / HZ);*/
-        strip_info->gratuitous_arp = jiffies + strip_info->arp_interval;
-        strip_info->arp_interval *= 2;
-        if (strip_info->arp_interval > MaxARPInterval)
-            strip_info->arp_interval = MaxARPInterval;
-	if (addr)
-	    arp_send(
-		ARPOP_REPLY, ETH_P_ARP,
-		addr, /* Target address of ARP packet is our address */
-		&strip_info->dev,	       /* Device to send packet on */
-		addr, /* Source IP address this ARP packet comes from */
-		NULL,			       /* Destination HW address is NULL (broadcast it) */
-		strip_info->dev.dev_addr,      /* Source HW address is our HW address */
-		strip_info->dev.dev_addr);     /* Target HW address is our HW address (redundant) */
-    }
-
-    /*
-     * 7. All ready. Start the transmission
-     */
-    strip_write_some_more(strip_info->tty);
-}
-
-/* Encapsulate a datagram and kick it into a TTY queue. */
-static int strip_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-    struct strip *strip_info = (struct strip *)(dev->priv);
-
-    if (!netif_running(dev))
-    {
-        printk(KERN_ERR "%s: xmit call when iface is down\n", dev->name);
-        return(1);
-    }
-
-    netif_stop_queue(dev);
-    
-    del_timer(&strip_info->idle_timer);
-
-    /* See if someone has been ifconfigging */
-    if (strip_info->mtu != strip_info->dev.mtu)
-        strip_changedmtu(strip_info);
-
-    if (jiffies - strip_info->pps_timer > HZ)
-    {
-        unsigned long t = jiffies - strip_info->pps_timer;
-        unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t/2) / t;
-        unsigned long tx_pps_count = (strip_info->tx_pps_count * HZ * 8 + t/2) / t;
-        unsigned long sx_pps_count = (strip_info->sx_pps_count * HZ * 8 + t/2) / t;
-
-        strip_info->pps_timer = jiffies;
-        strip_info->rx_pps_count = 0;
-        strip_info->tx_pps_count = 0;
-        strip_info->sx_pps_count = 0;
-
-        strip_info->rx_average_pps = (strip_info->rx_average_pps + rx_pps_count + 1) / 2;
-        strip_info->tx_average_pps = (strip_info->tx_average_pps + tx_pps_count + 1) / 2;
-        strip_info->sx_average_pps = (strip_info->sx_average_pps + sx_pps_count + 1) / 2;
-
-        if (rx_pps_count / 8 >= 10)
-            printk(KERN_INFO "%s: WARNING: Receiving %ld packets per second.\n",
-                strip_info->dev.name, rx_pps_count / 8);
-        if (tx_pps_count / 8 >= 10)
-            printk(KERN_INFO "%s: WARNING: Tx        %ld packets per second.\n",
-                strip_info->dev.name, tx_pps_count / 8);
-        if (sx_pps_count / 8 >= 10)
-            printk(KERN_INFO "%s: WARNING: Sending   %ld packets per second.\n",
-                strip_info->dev.name, sx_pps_count / 8);
-    }
-
-    strip_send(strip_info, skb);
-
-    if (skb)
-    	dev_kfree_skb(skb);
-    return(0);
-}
-
-/*
- * IdleTask periodically calls strip_xmit, so even when we have no IP packets
- * to send for an extended period of time, the watchdog processing still gets
- * done to ensure that the radio stays in Starmode
- */
-
-static void strip_IdleTask(unsigned long parameter)
-{
-    strip_xmit(NULL, (struct net_device *)parameter);
-}
-
-/*
- * Create the MAC header for an arbitrary protocol layer
- *
- * saddr!=NULL        means use this specific address (n/a for Metricom)
- * saddr==NULL        means use default device source address
- * daddr!=NULL        means use this destination address
- * daddr==NULL        means leave destination address alone
- *                 (e.g. unresolved arp -- kernel will call
- *                 rebuild_header later to fill in the address)
- */
-
-static int strip_header(struct sk_buff *skb, struct net_device *dev,
-        unsigned short type, void *daddr, void *saddr, unsigned len)
-{
-    struct strip *strip_info = (struct strip *)(dev->priv);
-    STRIP_Header *header = (STRIP_Header *)skb_push(skb, sizeof(STRIP_Header));
-
-    /*printk(KERN_INFO "%s: strip_header 0x%04X %s\n", dev->name, type,
-        type == ETH_P_IP ? "IP" : type == ETH_P_ARP ? "ARP" : "");*/
-
-    header->src_addr = strip_info->true_dev_addr;
-    header->protocol = htons(type);
-
-    /*HexDump("strip_header", (struct strip *)(dev->priv), skb->data, skb->data + skb->len);*/
-
-    if (!daddr) return(-dev->hard_header_len);
-
-    header->dst_addr = *(MetricomAddress*)daddr;
-    return(dev->hard_header_len);
-}
-
-/*
- * Rebuild the MAC header. This is called after an ARP
- * (or in future other address resolution) has completed on this
- * sk_buff. We now let ARP fill in the other fields.
- * I think this should return zero if packet is ready to send,
- * or non-zero if it needs more time to do an address lookup
- */
-
-static int strip_rebuild_header(struct sk_buff *skb)
-{
-#ifdef CONFIG_INET
-    STRIP_Header *header = (STRIP_Header *) skb->data;
-
-    /* Arp find returns zero if if knows the address, */
-    /* or if it doesn't know the address it sends an ARP packet and returns non-zero */
-    return arp_find(header->dst_addr.c, skb)? 1 : 0;
-#else
-    return 0;
-#endif
-}
-
-
-/************************************************************************/
-/* Receiving routines							*/
-
-static int strip_receive_room(struct tty_struct *tty)
-{
-    return 0x10000;  /* We can handle an infinite amount of data. :-) */
-}
-
-/*
- * This function parses the response to the ATS300? command,
- * extracting the radio version and serial number.
- */
-static void get_radio_version(struct strip *strip_info, __u8 *ptr, __u8 *end)
-{
-    __u8 *p, *value_begin, *value_end;
-    int len;
-    
-    /* Determine the beginning of the second line of the payload */
-    p = ptr;
-    while (p < end && *p != 10) p++;
-    if (p >= end) return;
-    p++;
-    value_begin = p;
-    
-    /* Determine the end of line */
-    while (p < end && *p != 10) p++;
-    if (p >= end) return;
-    value_end = p;
-    p++;
-     
-    len = value_end - value_begin;
-    len = MIN(len, sizeof(FirmwareVersion) - 1);
-    if (strip_info->firmware_version.c[0] == 0)
-        printk(KERN_INFO "%s: Radio Firmware: %.*s\n",
-            strip_info->dev.name, len, value_begin);
-    sprintf(strip_info->firmware_version.c, "%.*s", len, value_begin);
-    
-    /* Look for the first colon */
-    while (p < end && *p != ':') p++;
-    if (p >= end) return;
-    /* Skip over the space */
-    p += 2;
-    len = sizeof(SerialNumber) - 1;
-    if (p + len <= end) {
-        sprintf(strip_info->serial_number.c, "%.*s", len, p);
-    }
-    else {
-     	printk(KERN_DEBUG "STRIP: radio serial number shorter (%d) than expected (%d)\n",
-     	       end - p, len);
-    }
-}
-
-/*
- * This function parses the response to the ATS325? command,
- * extracting the radio battery voltage.
- */
-static void get_radio_voltage(struct strip *strip_info, __u8 *ptr, __u8 *end)
-{
-    int len;
-
-    len = sizeof(BatteryVoltage) - 1;
-    if (ptr + len <= end) {
-        sprintf(strip_info->battery_voltage.c, "%.*s", len, ptr);
-    }
-    else {
- 	printk(KERN_DEBUG "STRIP: radio voltage string shorter (%d) than expected (%d)\n",
- 	       end - ptr, len);
-    }
-}
-
-/*
- * This function parses the responses to the AT~LA and ATS311 commands,
- * which list the radio's neighbours.
- */
-static void get_radio_neighbours(MetricomNodeTable *table, __u8 *ptr, __u8 *end)
-{
-    table->num_nodes = 0;
-    while (ptr < end && table->num_nodes < NODE_TABLE_SIZE)
-        {
-        MetricomNode *node = &table->node[table->num_nodes++];
-        char *dst = node->c, *limit = dst + sizeof(*node) - 1;
-        while (ptr < end && *ptr <= 32) ptr++;
-        while (ptr < end && dst < limit && *ptr != 10) *dst++ = *ptr++;
-        *dst++ = 0;
-        while (ptr < end && ptr[-1] != 10) ptr++;
-        }
-    do_gettimeofday(&table->timestamp);
-}
-
-static int get_radio_address(struct strip *strip_info, __u8 *p)
-{
-    MetricomAddress addr;
-
-    if (string_to_radio_address(&addr, p)) return(1);
-
-    /* See if our radio address has changed */
-    if (memcmp(strip_info->true_dev_addr.c, addr.c, sizeof(addr)))
-    {
-        MetricomAddressString addr_string;
-        radio_address_to_string(&addr, &addr_string);
-        printk(KERN_INFO "%s: Radio address = %s\n", strip_info->dev.name, addr_string.c);
-        strip_info->true_dev_addr = addr;
-        if (!strip_info->manual_dev_addr) *(MetricomAddress*)strip_info->dev.dev_addr = addr;
-        /* Give the radio a few seconds to get its head straight, then send an arp */
-        strip_info->gratuitous_arp = jiffies + 15 * HZ;
-        strip_info->arp_interval = 1 * HZ;
-    }
-    return(0);
-}
-
-static int verify_checksum(struct strip *strip_info)
-{
-    __u8 *p = strip_info->sx_buff;
-    __u8 *end = strip_info->sx_buff + strip_info->sx_count - 4;
-    u_short sum = (READHEX16(end[0]) << 12) | (READHEX16(end[1]) << 8) |
-                  (READHEX16(end[2]) <<  4) | (READHEX16(end[3]));
-    while (p < end) sum -= *p++;
-    if (sum == 0 && strip_info->firmware_level == StructuredMessages)
-    {
-        strip_info->firmware_level = ChecksummedMessages;
-        printk(KERN_INFO "%s: Radio provides message checksums\n", strip_info->dev.name);
-    }
-    return(sum == 0);
-}
-
-static void RecvErr(char *msg, struct strip *strip_info)
-{
-    __u8 *ptr = strip_info->sx_buff;
-    __u8 *end = strip_info->sx_buff + strip_info->sx_count;
-    DumpData(msg, strip_info, ptr, end);
-    strip_info->rx_errors++;
-}
-
-static void RecvErr_Message(struct strip *strip_info, __u8 *sendername, const __u8 *msg, u_long len)
-{
-    if (has_prefix(msg, len, "001")) /* Not in StarMode! */
-    {
-        RecvErr("Error Msg:", strip_info);
-        printk(KERN_INFO "%s: Radio %s is not in StarMode\n",
-            strip_info->dev.name, sendername);
-    }
-
-    else if (has_prefix(msg, len, "002")) /* Remap handle */
-    {
-	/* We ignore "Remap handle" messages for now */
-    }
-
-    else if (has_prefix(msg, len, "003")) /* Can't resolve name */
-    {
-        RecvErr("Error Msg:", strip_info);
-        printk(KERN_INFO "%s: Destination radio name is unknown\n",
-            strip_info->dev.name);
-    }
-
-    else if (has_prefix(msg, len, "004")) /* Name too small or missing */
-    {
-        strip_info->watchdog_doreset = jiffies + LongTime;
-#if TICKLE_TIMERS
-        {
-        struct timeval tv;
-        do_gettimeofday(&tv);
-        printk(KERN_INFO "**** Got ERR_004 response         at %02d.%06d\n",
-            tv.tv_sec % 100, tv.tv_usec);
-        }
-#endif
-        if (!strip_info->working)
-        {
-            strip_info->working = TRUE;
-            printk(KERN_INFO "%s: Radio now in starmode\n", strip_info->dev.name);
-            /*
-             * If the radio has just entered a working state, we should do our first
-             * probe ASAP, so that we find out our radio address etc. without delay.
-             */
-            strip_info->watchdog_doprobe = jiffies;
-        }
-        if (strip_info->firmware_level == NoStructure && sendername)
-        {
-            strip_info->firmware_level = StructuredMessages;
-            strip_info->next_command   = 0; /* Try to enable checksums ASAP */
-            printk(KERN_INFO "%s: Radio provides structured messages\n", strip_info->dev.name);
-        }
-        if (strip_info->firmware_level >= StructuredMessages)
-        {
-            /*
-             * If this message has a valid checksum on the end, then the call to verify_checksum
-             * will elevate the firmware_level to ChecksummedMessages for us. (The actual return
-             * code from verify_checksum is ignored here.)
-             */
-            verify_checksum(strip_info);
-            /*
-             * If the radio has structured messages but we don't yet have all our information about it,
-             * we should do probes without delay, until we have gathered all the information
-             */
-            if (!GOT_ALL_RADIO_INFO(strip_info)) strip_info->watchdog_doprobe = jiffies;
-        }
-    }
-
-    else if (has_prefix(msg, len, "005")) /* Bad count specification */
-        RecvErr("Error Msg:", strip_info);
-
-    else if (has_prefix(msg, len, "006")) /* Header too big */
-        RecvErr("Error Msg:", strip_info);
-
-    else if (has_prefix(msg, len, "007")) /* Body too big */
-    {
-        RecvErr("Error Msg:", strip_info);
-        printk(KERN_ERR "%s: Error! Packet size too big for radio.\n",
-            strip_info->dev.name);
-    }
-
-    else if (has_prefix(msg, len, "008")) /* Bad character in name */
-    {
-        RecvErr("Error Msg:", strip_info);
-        printk(KERN_ERR "%s: Radio name contains illegal character\n",
-            strip_info->dev.name);
-    }
-
-    else if (has_prefix(msg, len, "009")) /* No count or line terminator */
-        RecvErr("Error Msg:", strip_info);
-
-    else if (has_prefix(msg, len, "010")) /* Invalid checksum */
-        RecvErr("Error Msg:", strip_info);
-
-    else if (has_prefix(msg, len, "011")) /* Checksum didn't match */
-        RecvErr("Error Msg:", strip_info);
-
-    else if (has_prefix(msg, len, "012")) /* Failed to transmit packet */
-        RecvErr("Error Msg:", strip_info);
-
-    else
-        RecvErr("Error Msg:", strip_info);
-}
-
-static void process_AT_response(struct strip *strip_info, __u8 *ptr, __u8 *end)
-{
-    u_long len;
-    __u8 *p = ptr;
-    while (p < end && p[-1] != 10) p++; /* Skip past first newline character */
-    /* Now ptr points to the AT command, and p points to the text of the response. */
-    len = p-ptr;
-
-#if TICKLE_TIMERS
-    {
-    struct timeval tv;
-    do_gettimeofday(&tv);
-    printk(KERN_INFO "**** Got AT response %.7s      at %02d.%06d\n",
-        ptr, tv.tv_sec % 100, tv.tv_usec);
-    }
-#endif
-
-    if      (has_prefix(ptr, len, "ATS300?" )) get_radio_version(strip_info, p, end);
-    else if (has_prefix(ptr, len, "ATS305?" )) get_radio_address(strip_info, p);
-    else if (has_prefix(ptr, len, "ATS311?" )) get_radio_neighbours(&strip_info->poletops, p, end);
-    else if (has_prefix(ptr, len, "ATS319=7")) verify_checksum(strip_info);
-    else if (has_prefix(ptr, len, "ATS325?" )) get_radio_voltage(strip_info, p, end);
-    else if (has_prefix(ptr, len, "AT~LA"   )) get_radio_neighbours(&strip_info->portables, p, end);
-    else                                       RecvErr("Unknown AT Response:", strip_info);
-}
-
-static void process_ACK(struct strip *strip_info, __u8 *ptr, __u8 *end)
-{
-    /* Currently we don't do anything with ACKs from the radio */
-}
-
-static void process_Info(struct strip *strip_info, __u8 *ptr, __u8 *end)
-{
-    if (ptr+16 > end) RecvErr("Bad Info Msg:", strip_info);
-}
-
-static struct net_device *get_strip_dev(struct strip *strip_info)
-{
-    /* If our hardware address is *manually set* to zero, and we know our */
-    /* real radio hardware address, try to find another strip device that has been */
-    /* manually set to that address that we can 'transfer ownership' of this packet to  */
-    if (strip_info->manual_dev_addr &&
-        !memcmp(strip_info->dev.dev_addr, zero_address.c, sizeof(zero_address)) &&
-        memcmp(&strip_info->true_dev_addr, zero_address.c, sizeof(zero_address)))
-    {
-        struct net_device *dev;
-	read_lock_bh(&dev_base_lock);
-	dev = dev_base;
-        while (dev)
-        {
-            if (dev->type == strip_info->dev.type &&
-                !memcmp(dev->dev_addr, &strip_info->true_dev_addr, sizeof(MetricomAddress)))
-            {
-                printk(KERN_INFO "%s: Transferred packet ownership to %s.\n",
-                    strip_info->dev.name, dev->name);
-		read_unlock_bh(&dev_base_lock);
-                return(dev);
-            }
-            dev = dev->next;
-        }
-	read_unlock_bh(&dev_base_lock);
-    }
-    return(&strip_info->dev);
-}
-
-/*
- * Send one completely decapsulated datagram to the next layer.
- */
-
-static void deliver_packet(struct strip *strip_info, STRIP_Header *header, __u16 packetlen)
-{
-    struct sk_buff *skb = dev_alloc_skb(sizeof(STRIP_Header) + packetlen);
-    if (!skb)
-    {
-        printk(KERN_ERR "%s: memory squeeze, dropping packet.\n", strip_info->dev.name);
-        strip_info->rx_dropped++;
-    }
-    else
-    {
-        memcpy(skb_put(skb, sizeof(STRIP_Header)), header, sizeof(STRIP_Header));
-        memcpy(skb_put(skb, packetlen), strip_info->rx_buff, packetlen);
-        skb->dev      = get_strip_dev(strip_info);
-        skb->protocol = header->protocol;
-        skb->mac.raw  = skb->data;
-
-        /* Having put a fake header on the front of the sk_buff for the */
-        /* benefit of tools like tcpdump, skb_pull now 'consumes' that  */
-        /* fake header before we hand the packet up to the next layer.  */
-        skb_pull(skb, sizeof(STRIP_Header));
-
-        /* Finally, hand the packet up to the next layer (e.g. IP or ARP, etc.) */
-        strip_info->rx_packets++;
-        strip_info->rx_pps_count++;
-#ifdef EXT_COUNTERS
-        strip_info->rx_bytes += packetlen;
-#endif
-        skb->dev->last_rx = jiffies;
-        netif_rx(skb);
-    }
-}
-
-static void process_IP_packet(struct strip *strip_info, STRIP_Header *header, __u8 *ptr, __u8 *end)
-{
-    __u16 packetlen;
-
-    /* Decode start of the IP packet header */
-    ptr = UnStuffData(ptr, end, strip_info->rx_buff, 4);
-    if (!ptr)
-    {
-        RecvErr("IP Packet too short", strip_info);
-        return;
-    }
-
-    packetlen = ((__u16)strip_info->rx_buff[2] << 8) | strip_info->rx_buff[3];
-
-    if (packetlen > MAX_RECV_MTU)
-    {
-        printk(KERN_INFO "%s: Dropping oversized received IP packet: %d bytes\n",
-            strip_info->dev.name, packetlen);
-        strip_info->rx_dropped++;
-        return;
-    }
-
-    /*printk(KERN_INFO "%s: Got %d byte IP packet\n", strip_info->dev.name, packetlen);*/
-
-    /* Decode remainder of the IP packet */
-    ptr = UnStuffData(ptr, end, strip_info->rx_buff+4, packetlen-4);
-    if (!ptr)
-    {
-        RecvErr("IP Packet too short", strip_info);
-        return;
-    }
-
-    if (ptr < end)
-    {
-        RecvErr("IP Packet too long", strip_info);
-        return;
-    }
-
-    header->protocol = htons(ETH_P_IP);
-
-    deliver_packet(strip_info, header, packetlen);
-}
-
-static void process_ARP_packet(struct strip *strip_info, STRIP_Header *header, __u8 *ptr, __u8 *end)
-{
-    __u16 packetlen;
-    struct arphdr *arphdr = (struct arphdr *)strip_info->rx_buff;
-
-    /* Decode start of the ARP packet */
-    ptr = UnStuffData(ptr, end, strip_info->rx_buff, 8);
-    if (!ptr)
-    {
-        RecvErr("ARP Packet too short", strip_info);
-        return;
-    }
-
-    packetlen = 8 + (arphdr->ar_hln + arphdr->ar_pln) * 2;
-
-    if (packetlen > MAX_RECV_MTU)
-    {
-        printk(KERN_INFO "%s: Dropping oversized received ARP packet: %d bytes\n",
-            strip_info->dev.name, packetlen);
-        strip_info->rx_dropped++;
-        return;
-    }
-
-    /*printk(KERN_INFO "%s: Got %d byte ARP %s\n",
-        strip_info->dev.name, packetlen,
-        ntohs(arphdr->ar_op) == ARPOP_REQUEST ? "request" : "reply");*/
-
-    /* Decode remainder of the ARP packet */
-    ptr = UnStuffData(ptr, end, strip_info->rx_buff+8, packetlen-8);
-    if (!ptr)
-    {
-        RecvErr("ARP Packet too short", strip_info);
-        return;
-    }
-
-    if (ptr < end)
-    {
-        RecvErr("ARP Packet too long", strip_info);
-        return;
-    }
-
-    header->protocol = htons(ETH_P_ARP);
-
-    deliver_packet(strip_info, header, packetlen);
-}
-
-/*
- * process_text_message processes a <CR>-terminated block of data received
- * from the radio that doesn't begin with a '*' character. All normal
- * Starmode communication messages with the radio begin with a '*',
- * so any text that does not indicates a serial port error, a radio that
- * is in Hayes command mode instead of Starmode, or a radio with really
- * old firmware that doesn't frame its Starmode responses properly.
- */
-static void process_text_message(struct strip *strip_info)
-{
-    __u8 *msg = strip_info->sx_buff;
-    int len   = strip_info->sx_count;
-
-    /* Check for anything that looks like it might be our radio name */
-    /* (This is here for backwards compatibility with old firmware)  */
-    if (len == 9 && get_radio_address(strip_info, msg) == 0) return;
-
-    if (text_equal(msg, len, "OK"      )) return; /* Ignore 'OK' responses from prior commands */
-    if (text_equal(msg, len, "ERROR"   )) return; /* Ignore 'ERROR' messages */
-    if (has_prefix(msg, len, "ate0q1"  )) return; /* Ignore character echo back from the radio */
-
-    /* Catch other error messages */
-    /* (This is here for backwards compatibility with old firmware) */
-    if (has_prefix(msg, len, "ERR_")) { RecvErr_Message(strip_info, NULL, &msg[4], len-4); return; }
-    
-    RecvErr("No initial *", strip_info);
-}
-
-/*
- * process_message processes a <CR>-terminated block of data received
- * from the radio. If the radio is not in Starmode or has old firmware,
- * it may be a line of text in response to an AT command. Ideally, with
- * a current radio that's properly in Starmode, all data received should
- * be properly framed and checksummed radio message blocks, containing
- * either a starmode packet, or a other communication from the radio
- * firmware, like "INF_" Info messages and &COMMAND responses.
- */
-static void process_message(struct strip *strip_info)
-{
-    STRIP_Header header = { zero_address, zero_address, 0 };
-    __u8 *ptr = strip_info->sx_buff;
-    __u8 *end = strip_info->sx_buff + strip_info->sx_count;
-    __u8 sendername[32], *sptr = sendername;
-    MetricomKey key;
-
-    /*HexDump("Receiving", strip_info, ptr, end);*/
-
-    /* Check for start of address marker, and then skip over it */
-    if (*ptr == '*') ptr++;
-    else { process_text_message(strip_info); return; }
-
-    /* Copy out the return address */
-    while (ptr < end && *ptr != '*' && sptr < ARRAY_END(sendername)-1) *sptr++ = *ptr++;
-    *sptr = 0;                /* Null terminate the sender name */
-
-    /* Check for end of address marker, and skip over it */
-    if (ptr >= end || *ptr != '*')
-    {
-        RecvErr("No second *", strip_info);
-        return;
-    }
-    ptr++; /* Skip the second '*' */
-
-    /* If the sender name is "&COMMAND", ignore this 'packet'       */
-    /* (This is here for backwards compatibility with old firmware) */
-    if (!strcmp(sendername, "&COMMAND"))
-    {
-        strip_info->firmware_level = NoStructure;
-        strip_info->next_command   = CompatibilityCommand;
-        return;
-    }
-
-    if (ptr+4 > end)
-    {
-        RecvErr("No proto key", strip_info);
-        return;
-    }
-
-    /* Get the protocol key out of the buffer */
-    key.c[0] = *ptr++;
-    key.c[1] = *ptr++;
-    key.c[2] = *ptr++;
-    key.c[3] = *ptr++;
-
-    /* If we're using checksums, verify the checksum at the end of the packet */
-    if (strip_info->firmware_level >= ChecksummedMessages)
-    {
-        end -= 4;	/* Chop the last four bytes off the packet (they're the checksum) */
-        if (ptr > end)
-        {
-            RecvErr("Missing Checksum", strip_info);
-            return;
-        }
-        if (!verify_checksum(strip_info))
-        {
-            RecvErr("Bad Checksum", strip_info);
-            return;
-        }
-    }
-
-    /*printk(KERN_INFO "%s: Got packet from \"%s\".\n", strip_info->dev.name, sendername);*/
-
-    /*
-     * Fill in (pseudo) source and destination addresses in the packet.
-     * We assume that the destination address was our address (the radio does not
-     * tell us this). If the radio supplies a source address, then we use it.
-     */
-    header.dst_addr = strip_info->true_dev_addr;
-    string_to_radio_address(&header.src_addr, sendername);
-
-#ifdef EXT_COUNTERS
-    if      (key.l == SIP0Key.l) {
-      strip_info->rx_rbytes += (end - ptr);
-      process_IP_packet(strip_info, &header, ptr, end);
-    } else if (key.l == ARP0Key.l) {
-      strip_info->rx_rbytes += (end - ptr);
-      process_ARP_packet(strip_info, &header, ptr, end);
-    } else if (key.l == ATR_Key.l) {
-      strip_info->rx_ebytes += (end - ptr);
-      process_AT_response(strip_info, ptr, end);
-    } else if (key.l == ACK_Key.l) {
-      strip_info->rx_ebytes += (end - ptr);
-      process_ACK(strip_info, ptr, end);
-    } else if (key.l == INF_Key.l) {
-      strip_info->rx_ebytes += (end - ptr);
-      process_Info(strip_info, ptr, end);
-    } else if (key.l == ERR_Key.l) {
-      strip_info->rx_ebytes += (end - ptr);
-      RecvErr_Message(strip_info, sendername, ptr, end-ptr);
-    } else RecvErr("Unrecognized protocol key", strip_info);
-#else
-    if      (key.l == SIP0Key.l) process_IP_packet  (strip_info, &header, ptr, end);
-    else if (key.l == ARP0Key.l) process_ARP_packet (strip_info, &header, ptr, end);
-    else if (key.l == ATR_Key.l) process_AT_response(strip_info, ptr, end);
-    else if (key.l == ACK_Key.l) process_ACK        (strip_info, ptr, end);
-    else if (key.l == INF_Key.l) process_Info       (strip_info, ptr, end);
-    else if (key.l == ERR_Key.l) RecvErr_Message    (strip_info, sendername, ptr, end-ptr);
-    else                         RecvErr("Unrecognized protocol key", strip_info);
-#endif
-}
-
-#define TTYERROR(X) ((X) == TTY_BREAK   ? "Break"            : \
-                     (X) == TTY_FRAME   ? "Framing Error"    : \
-                     (X) == TTY_PARITY  ? "Parity Error"     : \
-                     (X) == TTY_OVERRUN ? "Hardware Overrun" : "Unknown Error")
-
-/*
- * Handle the 'receiver data ready' interrupt.
- * This function is called by the 'tty_io' module in the kernel when
- * a block of STRIP data has been received, which can now be decapsulated
- * and sent on to some IP layer for further processing.
- */
-
-static void
-strip_receive_buf(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
-{
-    struct strip *strip_info = (struct strip *) tty->disc_data;
-    const unsigned char *end = cp + count;
-
-    if (!strip_info || strip_info->magic != STRIP_MAGIC 
-    	|| !netif_running(&strip_info->dev))
-        return;
-
-    /* Argh! mtu change time! - costs us the packet part received at the change */
-    if (strip_info->mtu != strip_info->dev.mtu)
-        strip_changedmtu(strip_info);
-
-#if 0
-    {
-    struct timeval tv;
-    do_gettimeofday(&tv);
-    printk(KERN_INFO "**** strip_receive_buf: %3d bytes at %02d.%06d\n",
-        count, tv.tv_sec % 100, tv.tv_usec);
-    }
-#endif
-
-#ifdef EXT_COUNTERS
-    strip_info->rx_sbytes += count;
-#endif
-
-    /* Read the characters out of the buffer */
-    while (cp < end)
-    {
-        if (fp && *fp) printk(KERN_INFO "%s: %s on serial port\n", strip_info->dev.name, TTYERROR(*fp));
-        if (fp && *fp++ && !strip_info->discard) /* If there's a serial error, record it */
-        {
-            /* If we have some characters in the buffer, discard them */
-            strip_info->discard = strip_info->sx_count;
-            strip_info->rx_errors++;
-        }
-
-        /* Leading control characters (CR, NL, Tab, etc.) are ignored */
-        if (strip_info->sx_count > 0 || *cp >= ' ')
-        {
-            if (*cp == 0x0D)                /* If end of packet, decide what to do with it */
-            {
-                if (strip_info->sx_count > 3000)
-                    printk(KERN_INFO "%s: Cut a %d byte packet (%d bytes remaining)%s\n",
-                        strip_info->dev.name, strip_info->sx_count, end-cp-1,
-                        strip_info->discard ? " (discarded)" : "");
-                if (strip_info->sx_count > strip_info->sx_size)
-                {
-                    strip_info->rx_over_errors++;
-                    printk(KERN_INFO "%s: sx_buff overflow (%d bytes total)\n",
-                           strip_info->dev.name, strip_info->sx_count);
-                }
-                else if (strip_info->discard)
-                    printk(KERN_INFO "%s: Discarding bad packet (%d/%d)\n",
-                        strip_info->dev.name, strip_info->discard, strip_info->sx_count);
-                else process_message(strip_info);
-                strip_info->discard = 0;
-                strip_info->sx_count = 0;
-            }
-            else
-            {
-                /* Make sure we have space in the buffer */
-                if (strip_info->sx_count < strip_info->sx_size)
-                    strip_info->sx_buff[strip_info->sx_count] = *cp;
-                strip_info->sx_count++;
-            }
-        }
-        cp++;
-    }
-}
-
-
-/************************************************************************/
-/* General control routines						*/
-
-static int set_mac_address(struct strip *strip_info, MetricomAddress *addr)
-{
-    /*
-     * We're using a manually specified address if the address is set
-     * to anything other than all ones. Setting the address to all ones
-     * disables manual mode and goes back to automatic address determination
-     * (tracking the true address that the radio has).
-     */
-    strip_info->manual_dev_addr = memcmp(addr->c, broadcast_address.c, sizeof(broadcast_address));
-    if (strip_info->manual_dev_addr)
-         *(MetricomAddress*)strip_info->dev.dev_addr = *addr;
-    else *(MetricomAddress*)strip_info->dev.dev_addr = strip_info->true_dev_addr;
-    return 0;
-}
-
-static int dev_set_mac_address(struct net_device *dev, void *addr)
-{
-    struct strip *strip_info = (struct strip *)(dev->priv);
-    struct sockaddr *sa = addr;
-    printk(KERN_INFO "%s: strip_set_dev_mac_address called\n", dev->name);
-    set_mac_address(strip_info, (MetricomAddress *)sa->sa_data);
-    return 0;
-}
-
-static struct net_device_stats *strip_get_stats(struct net_device *dev)
-{
-    static struct net_device_stats stats;
-    struct strip *strip_info = (struct strip *)(dev->priv);
-
-    memset(&stats, 0, sizeof(struct net_device_stats));
-
-    stats.rx_packets     = strip_info->rx_packets;
-    stats.tx_packets     = strip_info->tx_packets;
-    stats.rx_dropped     = strip_info->rx_dropped;
-    stats.tx_dropped     = strip_info->tx_dropped;
-    stats.tx_errors      = strip_info->tx_errors;
-    stats.rx_errors      = strip_info->rx_errors;
-    stats.rx_over_errors = strip_info->rx_over_errors;
-    return(&stats);
-}
-
-
-/************************************************************************/
-/* Opening and closing							*/
-
-/*
- * Here's the order things happen:
- * When the user runs "slattach -p strip ..."
- *  1. The TTY module calls strip_open
- *  2. strip_open calls strip_alloc
- *  3.                  strip_alloc calls register_netdev
- *  4.                  register_netdev calls strip_dev_init
- *  5. then strip_open finishes setting up the strip_info
- *
- * When the user runs "ifconfig st<x> up address netmask ..."
- *  6. strip_open_low gets called
- *
- * When the user runs "ifconfig st<x> down"
- *  7. strip_close_low gets called
- *
- * When the user kills the slattach process
- *  8. strip_close gets called
- *  9. strip_close calls dev_close
- * 10. if the device is still up, then dev_close calls strip_close_low
- * 11. strip_close calls strip_free
- */
-
-/* Open the low-level part of the STRIP channel. Easy! */
-
-static int strip_open_low(struct net_device *dev)
-{
-    struct strip *strip_info = (struct strip *)(dev->priv);
-#if 0
-    struct in_device *in_dev = dev->ip_ptr;
-#endif
-
-    if (strip_info->tty == NULL)
-        return(-ENODEV);
-
-    if (!allocate_buffers(strip_info))
-        return(-ENOMEM);
-
-    strip_info->sx_count = 0;
-    strip_info->tx_left  = 0;
-
-    strip_info->discard  = 0;
-    strip_info->working  = FALSE;
-    strip_info->firmware_level = NoStructure;
-    strip_info->next_command   = CompatibilityCommand;
-    strip_info->user_baud      = get_baud(strip_info->tty);
-
-#if 0
-    /*
-     * Needed because address '0' is special
-     *
-     * --ANK Needed it or not needed, it does not matter at all.
-     *	     Make it at user level, guys.
-     */
-
-    if (in_dev->ifa_list->ifa_address == 0)
-        in_dev->ifa_list->ifa_address = ntohl(0xC0A80001);
-#endif
-    printk(KERN_INFO "%s: Initializing Radio.\n", strip_info->dev.name);
-    ResetRadio(strip_info);
-    strip_info->idle_timer.expires = jiffies + 1*HZ;
-    add_timer(&strip_info->idle_timer);
-    netif_wake_queue(dev);
-    return(0);
-}
-
-
-/*
- * Close the low-level part of the STRIP channel. Easy!
- */
-
-static int strip_close_low(struct net_device *dev)
-{
-    struct strip *strip_info = (struct strip *)(dev->priv);
-
-    if (strip_info->tty == NULL)
-        return -EBUSY;
-    strip_info->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
-
-    netif_stop_queue(dev);
-    
-    /*
-     * Free all STRIP frame buffers.
-     */
-    if (strip_info->rx_buff)
-    {
-        kfree(strip_info->rx_buff);
-        strip_info->rx_buff = NULL;
-    }
-    if (strip_info->sx_buff)
-    {
-        kfree(strip_info->sx_buff);
-        strip_info->sx_buff = NULL;
-    }
-    if (strip_info->tx_buff)
-    {
-        kfree(strip_info->tx_buff);
-        strip_info->tx_buff = NULL;
-    }
-    del_timer(&strip_info->idle_timer);
-    return 0;
-}
-
-/*
- * This routine is called by DDI when the
- * (dynamically assigned) device is registered
- */
-
-static int strip_dev_init(struct net_device *dev)
-{
-    /*
-     * Finish setting up the DEVICE info.
-     */
-
-    dev->trans_start        = 0;
-    dev->last_rx            = 0;
-    dev->tx_queue_len       = 30;         /* Drop after 30 frames queued */
-
-    dev->flags              = 0;
-    dev->mtu                = DEFAULT_STRIP_MTU;
-    dev->type               = ARPHRD_METRICOM;        /* dtang */
-    dev->hard_header_len    = sizeof(STRIP_Header);
-    /*
-     *  dev->priv             Already holds a pointer to our struct strip
-     */
-
-    *(MetricomAddress*)&dev->broadcast = broadcast_address;
-    dev->dev_addr[0]        = 0;
-    dev->addr_len           = sizeof(MetricomAddress);
-
-    /*
-     * Pointers to interface service routines.
-     */
-
-    dev->open               = strip_open_low;
-    dev->stop               = strip_close_low;
-    dev->hard_start_xmit    = strip_xmit;
-    dev->hard_header        = strip_header;
-    dev->rebuild_header     = strip_rebuild_header;
-    dev->set_mac_address    = dev_set_mac_address;
-    dev->get_stats          = strip_get_stats;
-    return 0;
-}
-
-/*
- * Free a STRIP channel.
- */
-
-static void strip_free(struct strip *strip_info)
-{
-    *(strip_info->referrer) = strip_info->next;
-    if (strip_info->next)
-        strip_info->next->referrer = strip_info->referrer;
-    strip_info->magic = 0;
-    kfree(strip_info);
-}
-
-/*
- * Allocate a new free STRIP channel
- */
-
-static struct strip *strip_alloc(void)
-{
-    int channel_id = 0;
-    struct strip **s = &struct_strip_list;
-    struct strip *strip_info = (struct strip *)
-        kmalloc(sizeof(struct strip), GFP_KERNEL);
-
-    if (!strip_info)
-        return(NULL);        /* If no more memory, return */
-
-    /*
-     * Clear the allocated memory
-     */
-
-    memset(strip_info, 0, sizeof(struct strip));
-
-    /*
-     * Search the list to find where to put our new entry
-     * (and in the process decide what channel number it is
-     * going to be)
-     */
-
-    while (*s && (*s)->dev.base_addr == channel_id)
-    {
-        channel_id++;
-        s = &(*s)->next;
-    }
-
-    /*
-     * Fill in the link pointers
-     */
-
-    strip_info->next = *s;
-    if (*s)
-        (*s)->referrer = &strip_info->next;
-    strip_info->referrer = s;
-    *s = strip_info;
-
-    strip_info->magic = STRIP_MAGIC;
-    strip_info->tty   = NULL;
-
-    strip_info->gratuitous_arp   = jiffies + LongTime;
-    strip_info->arp_interval     = 0;
-    init_timer(&strip_info->idle_timer);
-    strip_info->idle_timer.data     = (long)&strip_info->dev;
-    strip_info->idle_timer.function = strip_IdleTask;
-
-    /* Note: strip_info->if_name is currently 8 characters long */
-    sprintf(strip_info->dev.name, "st%d", channel_id);
-    strip_info->dev.base_addr    = channel_id;
-    strip_info->dev.priv         = (void*)strip_info;
-    strip_info->dev.next         = NULL;
-    strip_info->dev.init         = strip_dev_init;
-
-    return(strip_info);
-}
-
-/*
- * Open the high-level part of the STRIP channel.
- * This function is called by the TTY module when the
- * STRIP line discipline is called for.  Because we are
- * sure the tty line exists, we only have to link it to
- * a free STRIP channel...
- */
-
-static int strip_open(struct tty_struct *tty)
-{
-    struct strip *strip_info = (struct strip *) tty->disc_data;
-
-    /*
-     * First make sure we're not already connected.
-     */
-
-    if (strip_info && strip_info->magic == STRIP_MAGIC)
-        return -EEXIST;
-
-    /*
-     * OK.  Find a free STRIP channel to use.
-     */
-    if ((strip_info = strip_alloc()) == NULL)
-        return -ENFILE;
-
-    /*
-     * Register our newly created device so it can be ifconfig'd
-     * strip_dev_init() will be called as a side-effect
-     */
-
-    if (register_netdev(&strip_info->dev) != 0)
-    {
-        printk(KERN_ERR "strip: register_netdev() failed.\n");
-        strip_free(strip_info);
-        return -ENFILE;
-    }
-
-    strip_info->tty = tty;
-    tty->disc_data = strip_info;
-    if (tty->driver.flush_buffer)
-        tty->driver.flush_buffer(tty);
-    if (tty->ldisc.flush_buffer)
-        tty->ldisc.flush_buffer(tty);
-
-    /*
-     * Restore default settings
-     */
-
-    strip_info->dev.type = ARPHRD_METRICOM;    /* dtang */
-
-    /*
-     * Set tty options
-     */
-
-    tty->termios->c_iflag |= IGNBRK |IGNPAR;/* Ignore breaks and parity errors. */
-    tty->termios->c_cflag |= CLOCAL;    /* Ignore modem control signals. */
-    tty->termios->c_cflag &= ~HUPCL;    /* Don't close on hup */
-
-    MOD_INC_USE_COUNT;
-
-    printk(KERN_INFO "STRIP: device \"%s\" activated\n", strip_info->dev.name);
-
-    /*
-     * Done.  We have linked the TTY line to a channel.
-     */
-    return(strip_info->dev.base_addr);
-}
-
-/*
- * Close down a STRIP channel.
- * This means flushing out any pending queues, and then restoring the
- * TTY line discipline to what it was before it got hooked to STRIP
- * (which usually is TTY again).
- */
-
-static void strip_close(struct tty_struct *tty)
-{
-    struct strip *strip_info = (struct strip *) tty->disc_data;
-
-    /*
-     * First make sure we're connected.
-     */
-
-    if (!strip_info || strip_info->magic != STRIP_MAGIC)
-        return;
-
-    unregister_netdev(&strip_info->dev);
-
-    tty->disc_data = 0;
-    strip_info->tty = NULL;
-    printk(KERN_INFO "STRIP: device \"%s\" closed down\n", strip_info->dev.name);
-    strip_free(strip_info);
-    tty->disc_data = NULL;
-    MOD_DEC_USE_COUNT;
-}
-
-
-/************************************************************************/
-/* Perform I/O control calls on an active STRIP channel.		*/
-
-static int strip_ioctl(struct tty_struct *tty, struct file *file,
-    unsigned int cmd, unsigned long arg)
-{
-    struct strip *strip_info = (struct strip *) tty->disc_data;
-
-    /*
-     * First make sure we're connected.
-     */
-
-    if (!strip_info || strip_info->magic != STRIP_MAGIC)
-        return -EINVAL;
-
-    switch(cmd)
-    {
-        case SIOCGIFNAME:
-	    return copy_to_user((void*)arg, strip_info->dev.name,
-				strlen(strip_info->dev.name) + 1) ? 
-		-EFAULT : 0;
-	    break;
-        case SIOCSIFHWADDR:
-            {
-            MetricomAddress addr;
-            printk(KERN_INFO "%s: SIOCSIFHWADDR\n", strip_info->dev.name);
-	    return copy_from_user(&addr, (void*)arg, sizeof(MetricomAddress)) ?
-		-EFAULT : set_mac_address(strip_info, &addr);
-	    break;
-	    }
-        /*
-         * Allow stty to read, but not set, the serial port
-         */
-
-        case TCGETS:
-        case TCGETA:
-            return n_tty_ioctl(tty, (struct file *) file, cmd,
-                (unsigned long) arg);
-	    break;
-        default:
-            return -ENOIOCTLCMD;
-	    break;
-    }
-}
-
-
-/************************************************************************/
-/* Initialization							*/
-
-static struct tty_ldisc strip_ldisc = {
-	.magic		= TTY_LDISC_MAGIC,
-	.name		= "strip",
-	.open		= strip_open,
-	.close		= strip_close,
-	.ioctl		= strip_ioctl,
-	.receive_buf	= strip_receive_buf,
-	.receive_room	= strip_receive_room,
-	.write_wakeup	= strip_write_some_more,
-};
-
-/*
- * Initialize the STRIP driver.
- * This routine is called at boot time, to bootstrap the multi-channel
- * STRIP driver
- */
-
-static char signon[] __initdata = KERN_INFO "STRIP: Version %s (unlimited channels)\n";
-
-static int __init strip_init_driver(void)
-{
-    int status;
-
-    printk(signon, StripVersion);
-
-    /*
-     * Fill in our line protocol discipline, and register it
-     */
-    if ((status = tty_register_ldisc(N_STRIP, &strip_ldisc)))
-        printk(KERN_ERR "STRIP: can't register line discipline (err = %d)\n", status);
-
-    /*
-     * Register the status file with /proc
-     */
-    proc_net_create("strip", S_IFREG | S_IRUGO, get_status_info);
-
-    return status;
-}
-module_init(strip_init_driver);
-
-static const char signoff[] __exitdata = KERN_INFO "STRIP: Module Unloaded\n";
-
-static void __exit strip_exit_driver(void)
-{
-    int i;
-    while (struct_strip_list)
-        strip_free(struct_strip_list);
-
-    /* Unregister with the /proc/net file here. */
-    proc_net_remove("strip");
-
-    if ((i = tty_register_ldisc(N_STRIP, NULL)))
-        printk(KERN_ERR "STRIP: can't unregister line discipline (err = %d)\n", i);
-
-    printk(signoff);
-}
-module_exit(strip_exit_driver);
-
-MODULE_AUTHOR("Stuart Cheshire <cheshire@cs.stanford.edu>");
-MODULE_DESCRIPTION("Starmode Radio IP (STRIP) Device Driver");
-MODULE_LICENSE("Dual BSD/GPL");
-
-MODULE_SUPPORTED_DEVICE("Starmode Radio IP (STRIP) modem");
-
diff -Nru a/drivers/net/tc35815.c b/drivers/net/tc35815.c
--- a/drivers/net/tc35815.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/net/tc35815.c	Sun Feb 23 22:25:21 2003
@@ -1227,7 +1227,7 @@
 		lp->rfd_cur = next_rfd;
 	}
 
-	/* re-enable BL/FDA Exhaust interupts. */
+	/* re-enable BL/FDA Exhaust interrupts. */
 	if (fd_free_count) {
 		tc_writel(tc_readl(&tr->Int_En) | Int_FDAExEn, &tr->Int_En);
 		if (buf_free_count)
diff -Nru a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
--- a/drivers/net/tulip/dmfe.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/net/tulip/dmfe.c	Sun Feb 23 22:25:26 2003
@@ -1337,7 +1337,7 @@
 
 /*
  *	Send a setup frame for DM9132
- *	This setup frame initilize DM910X addres filter mode
+ *	This setup frame initilize DM910X address filter mode
 */
 
 static void dm9132_id_table(struct DEVICE *dev, int mc_cnt)
@@ -1380,7 +1380,7 @@
 
 /*
  *	Send a setup frame for DM9102/DM9102A
- *	This setup frame initilize DM910X addres filter mode
+ *	This setup frame initilize DM910X address filter mode
  */
 
 static void send_filter_frame(struct DEVICE *dev, int mc_cnt)
@@ -1673,11 +1673,11 @@
 		phy_write_1bit(ioaddr, PHY_DATA_0);
 		phy_write_1bit(ioaddr, PHY_DATA_1);
 
-		/* Send Phy addres */
+		/* Send Phy address */
 		for (i = 0x10; i > 0; i = i >> 1)
 			phy_write_1bit(ioaddr, phy_addr & i ? PHY_DATA_1 : PHY_DATA_0);
 
-		/* Send register addres */
+		/* Send register address */
 		for (i = 0x10; i > 0; i = i >> 1)
 			phy_write_1bit(ioaddr, offset & i ? PHY_DATA_1 : PHY_DATA_0);
 
@@ -1722,11 +1722,11 @@
 		phy_write_1bit(ioaddr, PHY_DATA_1);
 		phy_write_1bit(ioaddr, PHY_DATA_0);
 
-		/* Send Phy addres */
+		/* Send Phy address */
 		for (i = 0x10; i > 0; i = i >> 1)
 			phy_write_1bit(ioaddr, phy_addr & i ? PHY_DATA_1 : PHY_DATA_0);
 
-		/* Send register addres */
+		/* Send register address */
 		for (i = 0x10; i > 0; i = i >> 1)
 			phy_write_1bit(ioaddr, offset & i ? PHY_DATA_1 : PHY_DATA_0);
 
diff -Nru a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c
--- a/drivers/net/tulip/interrupt.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/net/tulip/interrupt.c	Sun Feb 23 22:25:22 2003
@@ -501,7 +501,7 @@
 					   dev->name, csr5);
 #ifdef CONFIG_NET_HW_FLOWCONTROL
                         if (tp->fc_bit && (test_bit(tp->fc_bit, &netdev_fc_xoff)))
-                          if (net_ratelimit()) printk("BUG!! enabling interupt when FC off (timerintr.) \n");
+                          if (net_ratelimit()) printk("BUG!! enabling interrupt when FC off (timerintr.) \n");
 #endif
 			outl(tulip_tbl[tp->chip_id].valid_intrs, ioaddr + CSR7);
 			tp->ttimer = 0;
diff -Nru a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
--- a/drivers/net/wireless/Kconfig	Sun Feb 23 22:25:22 2003
+++ b/drivers/net/wireless/Kconfig	Sun Feb 23 22:25:22 2003
@@ -1,6 +1,73 @@
 #
 # Wireless LAN device configuration
 #
+
+menu "Wireless LAN (non-hamradio)"
+	depends on NETDEVICES
+
+config NET_RADIO
+	bool "Wireless LAN (non-hamradio)"
+	---help---
+	  Support for wireless LANs and everything having to do with radio,
+	  but not with amateur radio or FM broadcasting.
+
+	  Saying Y here also enables the Wireless Extensions (creates
+	  /proc/net/wireless and enables ifconfig access). The Wireless
+	  Extension is a generic API allowing a driver to expose to the user
+	  space configuration and statistics specific to common Wireless LANs.
+	  The beauty of it is that a single set of tool can support all the
+	  variations of Wireless LANs, regardless of their type (as long as
+	  the driver supports Wireless Extension). Another advantage is that
+	  these parameters may be changed on the fly without restarting the
+	  driver (or Linux). If you wish to use Wireless Extensions with
+	  wireless PCMCIA (PC-) cards, you need to say Y here; you can fetch
+	  the tools from
+	  <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>.
+
+	  Some user-level drivers for scarab devices which don't require
+	  special kernel support are available from
+	  <ftp://shadow.cabi.net/pub/Linux/>.
+
+config STRIP
+	tristate "STRIP (Metricom starmode radio IP)"
+	depends on NET_RADIO && INET
+	---help---
+	  Say Y if you have a Metricom radio and intend to use Starmode Radio
+	  IP. STRIP is a radio protocol developed for the MosquitoNet project
+	  (on the WWW at <http://mosquitonet.stanford.edu/>) to send Internet
+	  traffic using Metricom radios.  Metricom radios are small, battery
+	  powered, 100kbit/sec packet radio transceivers, about the size and
+	  weight of a cellular telephone. (You may also have heard them called
+	  "Metricom modems" but we avoid the term "modem" because it misleads
+	  many people into thinking that you can plug a Metricom modem into a
+	  phone line and use it as a modem.)
+
+	  You can use STRIP on any Linux machine with a serial port, although
+	  it is obviously most useful for people with laptop computers. If you
+	  think you might get a Metricom radio in the future, there is no harm
+	  in saying Y to STRIP now, except that it makes the kernel a bit
+	  bigger.
+
+	  You can also compile this as a module ( = code which can be inserted
+	  in and removed from the running kernel whenever you want), say M
+	  here and read <file:Documentation/modules.txt>.  The module will be
+	  called strip.
+
+config ARLAN
+	tristate "Aironet Arlan 655 & IC2200 DS support"
+	depends on NET_RADIO && ISA
+	---help---
+	  Aironet makes Arlan, a class of wireless LAN adapters. These use the
+	  www.Telxon.com chip, which is also used on several similar cards.
+	  This driver is tested on the 655 and IC2200 series cards. Look at
+	  <http://www.ylenurme.ee/~elmer/655/> for the latest information.
+
+	  The driver is built as two modules, arlan and arlan-proc. The latter
+	  is the /proc interface and is not needed most of time.
+
+	  On some computers the card ends up in non-valid state after some
+	  time. Use a ping-reset script to clear it.
+
 comment "Wireless ISA/PCI cards support"
 	depends on NET_RADIO && (ISA || PCI || ALL_PPC || PCMCIA)
 
@@ -182,9 +249,39 @@
 	  for location).  You also want to check out the PCMCIA-HOWTO,
 	  available from <http://www.linuxdoc.org/docs.html#howto>.
 
+config NET_PCMCIA_RADIO
+	bool "PCMCIA Wireless LAN"
+	depends on NET_PCMCIA
+	help
+	  Say Y here if you would like to use a PCMCIA (PC-card) device to
+	  connect to a wireless local area network. Then say Y to the driver
+	  for your particular card below.
+
+	  To use your PC-cards, you will need supporting software from David
+	  Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>
+	  for location). You also want to check out the PCMCIA-HOWTO,
+	  available from <http://www.linuxdoc.org/docs.html#howto>.
+
+config PCMCIA_RAYCS
+	tristate "Aviator/Raytheon 2.4MHz wireless support"
+	depends on NET_PCMCIA_RADIO && PCMCIA
+	---help---
+	  Say Y here if you intend to attach an Aviator/Raytheon PCMCIA
+	  (PC-card) wireless Ethernet networking card to your computer.
+	  Please read the file <file:Documentation/networking/ray_cs.txt> for
+	  details.
+
+	  This driver is also available as a module ( = code which can be
+	  inserted in and removed from the running kernel whenever you want).
+	  The module will be called ray_cs.  If you want to compile it as a
+	  module, say M here and read <file:Documentation/modules.txt>.  If
+	  unsure, say N.
+
 # yes, this works even when no drivers are selected
 config NET_WIRELESS
 	bool
 	depends on NET_RADIO && (ISA || PCI || ALL_PPC || PCMCIA)
 	default y
+
+endmenu
 
diff -Nru a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
--- a/drivers/net/wireless/Makefile	Sun Feb 23 22:25:27 2003
+++ b/drivers/net/wireless/Makefile	Sun Feb 23 22:25:27 2003
@@ -2,6 +2,9 @@
 # Makefile for the Linux Wireless network device drivers.
 #
 
+obj-$(CONFIG_STRIP) += strip.o
+obj-$(CONFIG_ARLAN) += arlan.o arlan-proc.o
+
 # Obsolete cards
 obj-$(CONFIG_WAVELAN)		+= wavelan.o
 obj-$(CONFIG_PCMCIA_NETWAVE)	+= netwave_cs.o
@@ -15,3 +18,7 @@
 
 obj-$(CONFIG_AIRO)		+= airo.o
 obj-$(CONFIG_AIRO_CS)		+= airo_cs.o airo.o
+
+# 16-bit wireless PCMCIA client drivers
+obj-$(CONFIG_PCMCIA_RAYCS)	+= ray_cs.o
+
diff -Nru a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
--- a/drivers/net/wireless/airo.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/net/wireless/airo.c	Sun Feb 23 22:25:22 2003
@@ -4002,6 +4002,10 @@
 {
 	struct net_device *dev;
 
+	if (pci_enable_device(pdev))
+		return -ENODEV;
+	pci_set_master(pdev);
+
 	dev = init_airo_card(pdev->irq,	pdev->resource[2].start, 0);
 	if (!dev)
 		return -ENODEV;
diff -Nru a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c
--- a/drivers/net/wireless/airport.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/net/wireless/airport.c	Sun Feb 23 22:25:26 2003
@@ -267,7 +267,6 @@
 MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
 MODULE_DESCRIPTION("Driver for the Apple Airport wireless card.");
 MODULE_LICENSE("Dual MPL/GPL");
-EXPORT_NO_SYMBOLS;
 
 static int __init
 init_airport(void)
diff -Nru a/drivers/net/wireless/arlan-proc.c b/drivers/net/wireless/arlan-proc.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/wireless/arlan-proc.c	Sun Feb 23 22:25:24 2003
@@ -0,0 +1,1274 @@
+#include <linux/config.h>
+#include "arlan.h"
+
+#include <linux/sysctl.h>
+
+#ifdef CONFIG_PROC_FS
+
+
+#include <linux/version.h>
+
+/* void enableReceive(struct net_device* dev);
+*/
+
+
+
+#define ARLAN_STR_SIZE 	0x2ff0
+#define DEV_ARLAN_INFO 	1
+#define DEV_ARLAN 	1
+#define SARLG(type,var) {\
+	pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n", #var, READSHMB(priva->card->var));	\
+	}
+
+#define SARLBN(type,var,nn) {\
+	pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x",#var);\
+	for (i=0; i < nn; i++ ) pos += sprintf(arlan_drive_info+pos, "%02x",READSHMB(priva->card->var[i]));\
+	pos += sprintf(arlan_drive_info+pos, "\n");	\
+	}
+
+#define SARLBNpln(type,var,nn) {\
+	for (i=0; i < nn; i++ ) pos += sprintf(arlan_drive_info+pos, "%02x",READSHMB(priva->card->var[i]));\
+	}
+
+#define SARLSTR(var,nn) {\
+	char tmpStr[400];\
+	int  tmpLn = nn;\
+	if (nn > 399 ) tmpLn = 399; \
+	memcpy(tmpStr,(char *) priva->conf->var,tmpLn);\
+	tmpStr[tmpLn] = 0; \
+	pos += sprintf(arlan_drive_info+pos, "%s\t=\t%s \n",#var,priva->conf->var);\
+	}
+
+#define SARLUC(var)  	SARLG(u_char, var)
+#define SARLUCN(var,nn) SARLBN(u_char,var, nn)
+#define SARLUS(var)	SARLG(u_short, var)
+#define SARLUSN(var,nn)	SARLBN(u_short,var, nn)
+#define SARLUI(var)	SARLG(u_int, var)
+
+#define SARLUSA(var) {\
+	u_short tmpVar;\
+	memcpy(&tmpVar, (short *) priva->conf->var,2); \
+	pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n",#var, tmpVar);\
+}
+
+#define SARLUIA(var) {\
+	u_int tmpVar;\
+	memcpy(&tmpVar, (int* )priva->conf->var,4); \
+	pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n",#var, tmpVar);\
+}
+
+
+static const char *arlan_diagnostic_info_string(struct net_device *dev)
+{
+
+	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
+	u_char diagnosticInfo;
+
+	READSHM(diagnosticInfo, arlan->diagnosticInfo, u_char);
+
+	switch (diagnosticInfo)
+	{
+		case 0xFF:
+			return "Diagnostic info is OK";
+		case 0xFE:
+			return "ERROR EPROM Checksum error ";
+		case 0xFD:
+			return "ERROR Local Ram Test Failed ";
+		case 0xFC:
+			return "ERROR SCC failure ";
+		case 0xFB:
+			return "ERROR BackBone failure ";
+		case 0xFA:
+			return "ERROR tranceiver not found ";
+		case 0xF9:
+			return "ERROR no more address space ";
+		case 0xF8:
+			return "ERROR Checksum error  ";
+		case 0xF7:
+			return "ERROR Missing SS Code";
+		case 0xF6:
+			return "ERROR Invalid config format";
+		case 0xF5:
+			return "ERROR Reserved errorcode F5";
+		case 0xF4:
+			return "ERROR Invalid spreading code/channel number";
+		case 0xF3:
+			return "ERROR Load Code Error";
+		case 0xF2:
+			return "ERROR Reserver errorcode F2 ";
+		case 0xF1:
+			return "ERROR Invalid command receivec by LAN card ";
+		case 0xF0:
+			return "ERROR Invalid parameter found in command ";
+		case 0xEF:
+			return "ERROR On-chip timer failure ";
+		case 0xEE:
+			return "ERROR T410 timer failure ";
+		case 0xED:
+			return "ERROR Too Many TxEnable commands ";
+		case 0xEC:
+			return "ERROR EEPROM error on radio module ";
+		default:
+			return "ERROR unknown Diagnostic info reply code ";
+	  }
+};
+
+static const char *arlan_hardware_type_string(struct net_device *dev)
+{
+	u_char hardwareType;
+	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
+
+	READSHM(hardwareType, arlan->hardwareType, u_char);
+	switch (hardwareType)
+	{
+		case 0x00:
+			return "type A450";
+		case 0x01:
+			return "type A650 ";
+		case 0x04:
+			return "type TMA coproc";
+		case 0x0D:
+			return "type A650E ";
+		case 0x18:
+			return "type TMA coproc Australian";
+		case 0x19:
+			return "type A650A ";
+		case 0x26:
+			return "type TMA coproc European";
+		case 0x2E:
+			return "type A655 ";
+		case 0x2F:
+			return "type A655A ";
+		case 0x30:
+			return "type A655E ";
+		case 0x0B:
+			return "type A670 ";
+		case 0x0C:
+			return "type A670E ";
+		case 0x2D:
+			return "type A670A ";
+		case 0x0F:
+			return "type A411T";
+		case 0x16:
+			return "type A411TA";
+		case 0x1B:
+			return "type A440T";
+		case 0x1C:
+			return "type A412T";
+		case 0x1E:
+			return "type A412TA";
+		case 0x22:
+			return "type A411TE";
+		case 0x24:
+			return "type A412TE";
+		case 0x27:
+			return "type A671T ";
+		case 0x29:
+			return "type A671TA ";
+		case 0x2B:
+			return "type A671TE ";
+		case 0x31:
+			return "type A415T ";
+		case 0x33:
+			return "type A415TA ";
+		case 0x35:
+			return "type A415TE ";
+		case 0x37:
+			return "type A672";
+		case 0x39:
+			return "type A672A ";
+		case 0x3B:
+			return "type A672T";
+		case 0x6B:
+			return "type IC2200";
+		default:
+			return "type A672T";
+	}
+}
+#ifdef ARLAN_DEBUGGING
+static void arlan_print_diagnostic_info(struct net_device *dev)
+{
+	int i;
+	u_char diagnosticInfo;
+	u_short diagnosticOffset;
+	u_char hardwareType;
+	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
+
+	//  ARLAN_DEBUG_ENTRY("arlan_print_diagnostic_info");
+
+	if (READSHMB(arlan->configuredStatusFlag) == 0)
+		printk("Arlan: Card NOT configured\n");
+	else
+		printk("Arlan: Card is configured\n");
+
+	READSHM(diagnosticInfo, arlan->diagnosticInfo, u_char);
+	READSHM(diagnosticOffset, arlan->diagnosticOffset, u_short);
+
+	printk(KERN_INFO "%s\n", arlan_diagnostic_info_string(dev));
+
+	if (diagnosticInfo != 0xff)
+		printk("%s arlan: Diagnostic Offset %d \n", dev->name, diagnosticOffset);
+
+	printk("arlan: LAN CODE ID = ");
+	for (i = 0; i < 6; i++)
+		DEBUGSHM(1, "%03d:", arlan->lanCardNodeId[i], u_char);
+	printk("\n");
+
+	printk("arlan: Arlan BroadCast address  = ");
+	for (i = 0; i < 6; i++)
+		DEBUGSHM(1, "%03d:", arlan->broadcastAddress[i], u_char);
+	printk("\n");
+
+	READSHM(hardwareType, arlan->hardwareType, u_char);
+	printk(KERN_INFO "%s\n", arlan_hardware_type_string(dev));
+
+
+	DEBUGSHM(1, "arlan: channelNumber=%d\n", arlan->channelNumber, u_char);
+	DEBUGSHM(1, "arlan: channelSet=%d\n", arlan->channelSet, u_char);
+	DEBUGSHM(1, "arlan: spreadingCode=%d\n", arlan->spreadingCode, u_char);
+	DEBUGSHM(1, "arlan: radioNodeId=%d\n", arlan->radioNodeId, u_short);
+	DEBUGSHM(1, "arlan: SID	=%d\n", arlan->SID, u_short);
+	DEBUGSHM(1, "arlan: rxOffset=%d\n", arlan->rxOffset, u_short);
+
+	DEBUGSHM(1, "arlan: registration mode is %d\n", arlan->registrationMode, u_char);
+
+	printk("arlan: name= ");
+	IFDEBUG(1)
+	
+	for (i = 0; i < 16; i++)
+	{
+		char c;
+		READSHM(c, arlan->name[i], char);
+		if (c)
+			printk("%c", c);
+	}
+	printk("\n");
+
+//   ARLAN_DEBUG_EXIT("arlan_print_diagnostic_info");
+
+}
+
+
+/******************************		TEST 	MEMORY	**************/
+
+static int arlan_hw_test_memory(struct net_device *dev)
+{
+	u_char *ptr;
+	int i;
+	int memlen = sizeof(struct arlan_shmem) - 0xF;	/* avoid control register */
+	volatile char *arlan_mem = (char *) (dev->mem_start);
+	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
+	char pattern;
+
+	ptr = NULL;
+
+	/* hold card in reset state */
+	setHardwareReset(dev);
+
+	/* test memory */
+	pattern = 0;
+	for (i = 0; i < memlen; i++)
+		WRITESHM(arlan_mem[i], ((u_char) pattern++), u_char);
+
+	pattern = 0;
+	for (i = 0; i < memlen; i++)
+	{
+		char res;
+		READSHM(res, arlan_mem[i], char);
+		if (res != pattern++)
+		{
+			printk(KERN_ERR "Arlan driver memory test 1 failed \n");
+			return -1;
+		}
+	}
+
+	pattern = 0;
+	for (i = 0; i < memlen; i++)
+		WRITESHM(arlan_mem[i], ~(pattern++), char);
+
+	pattern = 0;
+	for (i = 0; i < memlen; i++)
+	{
+		char res;
+		READSHM(res, arlan_mem[i], char);
+		if (res != ~(pattern++))
+		{
+			printk(KERN_ERR "Arlan driver memory test 2 failed \n");
+			return -1;
+		}
+	}
+
+	/* zero memory */
+	for (i = 0; i < memlen; i++)
+		WRITESHM(arlan_mem[i], 0x00, char);
+
+	IFDEBUG(1) printk(KERN_INFO "Arlan: memory tests ok\n");
+
+	/* set reset flag and then release reset */
+	WRITESHM(arlan->resetFlag, 0xff, u_char);
+
+	clearChannelAttention(dev);
+	clearHardwareReset(dev);
+
+	/* wait for reset flag to become zero, we'll wait for two seconds */
+	if (arlan_command(dev, ARLAN_COMMAND_LONG_WAIT_NOW))
+	{
+		printk(KERN_ERR "%s arlan: failed to come back from memory test\n", dev->name);
+		return -1;
+	}
+	return 0;
+}
+
+static int arlan_setup_card_by_book(struct net_device *dev)
+{
+	u_char irqLevel, configuredStatusFlag;
+	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
+
+//	ARLAN_DEBUG_ENTRY("arlan_setup_card");
+
+	READSHM(configuredStatusFlag, arlan->configuredStatusFlag, u_char);
+
+	IFDEBUG(10)
+	if (configuredStatusFlag != 0)
+		IFDEBUG(10) printk("arlan: CARD IS CONFIGURED\n");
+	else
+		IFDEBUG(10) printk("arlan: card is NOT configured\n");
+
+	if (testMemory || (READSHMB(arlan->diagnosticInfo) != 0xff))
+		if (arlan_hw_test_memory(dev))
+			return -1;
+
+	DEBUGSHM(4, "arlan configuredStatus = %d \n", arlan->configuredStatusFlag, u_char);
+	DEBUGSHM(4, "arlan driver diagnostic: 0x%2x\n", arlan->diagnosticInfo, u_char);
+
+	/* issue nop command - no interrupt */
+	arlan_command(dev, ARLAN_COMMAND_NOOP);
+	if (arlan_command(dev, ARLAN_COMMAND_WAIT_NOW) != 0)
+		return -1;
+
+	IFDEBUG(50) printk("1st Noop successfully executed !!\n");
+
+	/* try to turn on the arlan interrupts */
+	clearClearInterrupt(dev);
+	setClearInterrupt(dev);
+	setInterruptEnable(dev);
+
+	/* issue nop command - with interrupt */
+
+	arlan_command(dev, ARLAN_COMMAND_NOOPINT);
+	if (arlan_command(dev, ARLAN_COMMAND_WAIT_NOW) != 0)
+		return -1;
+
+
+	IFDEBUG(50) printk("2nd Noop successfully executed !!\n");
+
+	READSHM(irqLevel, arlan->irqLevel, u_char)
+	
+	if (irqLevel != dev->irq)
+	{
+		IFDEBUG(1) printk(KERN_WARNING "arlan dip switches set irq to %d\n", irqLevel);
+		printk(KERN_WARNING "device driver irq set to %d - does not match\n", dev->irq);
+		dev->irq = irqLevel;
+	}
+	else
+		IFDEBUG(2) printk("irq level is OK\n");
+
+
+	IFDEBUG(3) arlan_print_diagnostic_info(dev);
+
+	arlan_command(dev, ARLAN_COMMAND_CONF);
+
+	READSHM(configuredStatusFlag, arlan->configuredStatusFlag, u_char);
+	if (configuredStatusFlag == 0)
+	{
+		printk(KERN_WARNING "arlan configure failed\n");
+		return -1;
+	}
+	arlan_command(dev, ARLAN_COMMAND_LONG_WAIT_NOW);
+	arlan_command(dev, ARLAN_COMMAND_RX);
+	arlan_command(dev, ARLAN_COMMAND_LONG_WAIT_NOW);
+	printk(KERN_NOTICE "%s: arlan driver version %s loaded\n",
+	       dev->name, arlan_version);
+
+//	ARLAN_DEBUG_EXIT("arlan_setup_card");
+
+	return 0;		/* no errors */
+}
+#endif
+
+#ifdef ARLAN_PROC_INTERFACE
+#ifdef ARLAN_PROC_SHM_DUMP
+
+static char arlan_drive_info[ARLAN_STR_SIZE] = "A655\n\0";
+
+static int arlan_sysctl_info(ctl_table * ctl, int write, struct file *filp,
+		      void *buffer, size_t * lenp)
+{
+	int i;
+	int retv, pos, devnum;
+	struct arlan_private *priva = NULL;
+	struct net_device *dev;
+	pos = 0;
+	if (write)
+	{
+		printk("wrirte: ");
+		for (i = 0; i < 100; i++)
+			printk("adi %x \n", arlan_drive_info[i]);
+	}
+	if (ctl->procname == NULL || arlan_drive_info == NULL)
+	{
+		printk(KERN_WARNING " procname is NULL in sysctl_table or arlan_drive_info is NULL \n at arlan module\n ");
+		return -1;
+	}
+	devnum = ctl->procname[5] - '0';
+	if (devnum < 0 || devnum > MAX_ARLANS - 1)
+	{
+		printk(KERN_WARNING "too strange devnum in procfs parse\n ");
+		return -1;
+	}
+	else if (arlan_device[devnum] == NULL)
+	{
+		if (ctl->procname)
+			pos += sprintf(arlan_drive_info + pos, "\t%s\n\n", ctl->procname);
+		pos += sprintf(arlan_drive_info + pos, "No device found here \n");
+		goto final;
+	}
+	else
+		priva = arlan_device[devnum]->priv;
+
+	if (priva == NULL)
+	{
+		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
+		return -1;
+	}
+	dev = arlan_device[devnum];
+
+	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
+
+	pos = sprintf(arlan_drive_info, "Arlan  info \n");
+	/* Header Signature */
+	SARLSTR(textRegion, 48);
+	SARLUC(resetFlag);
+	pos += sprintf(arlan_drive_info + pos, "diagnosticInfo\t=\t%s \n", arlan_diagnostic_info_string(dev));
+	SARLUC(diagnosticInfo);
+	SARLUS(diagnosticOffset);
+	SARLUCN(_1, 12);
+	SARLUCN(lanCardNodeId, 6);
+	SARLUCN(broadcastAddress, 6);
+	pos += sprintf(arlan_drive_info + pos, "hardwareType =\t  %s \n", arlan_hardware_type_string(dev));
+	SARLUC(hardwareType);
+	SARLUC(majorHardwareVersion);
+	SARLUC(minorHardwareVersion);
+	SARLUC(radioModule);
+	SARLUC(defaultChannelSet);
+	SARLUCN(_2, 47);
+
+	/* Control/Status Block - 0x0080 */
+	SARLUC(interruptInProgress);
+	SARLUC(cntrlRegImage);
+
+	SARLUCN(_3, 14);
+	SARLUC(commandByte);
+	SARLUCN(commandParameter, 15);
+
+	/* Receive Status - 0x00a0 */
+	SARLUC(rxStatus);
+	SARLUC(rxFrmType);
+	SARLUS(rxOffset);
+	SARLUS(rxLength);
+	SARLUCN(rxSrc, 6);
+	SARLUC(rxBroadcastFlag);
+	SARLUC(rxQuality);
+	SARLUC(scrambled);
+	SARLUCN(_4, 1);
+
+	/* Transmit Status - 0x00b0 */
+	SARLUC(txStatus);
+	SARLUC(txAckQuality);
+	SARLUC(numRetries);
+	SARLUCN(_5, 14);
+	SARLUCN(registeredRouter, 6);
+	SARLUCN(backboneRouter, 6);
+	SARLUC(registrationStatus);
+	SARLUC(configuredStatusFlag);
+	SARLUCN(_6, 1);
+	SARLUCN(ultimateDestAddress, 6);
+	SARLUCN(immedDestAddress, 6);
+	SARLUCN(immedSrcAddress, 6);
+	SARLUS(rxSequenceNumber);
+	SARLUC(assignedLocaltalkAddress);
+	SARLUCN(_7, 27);
+
+	/* System Parameter Block */
+
+	/* - Driver Parameters (Novell Specific) */
+
+	SARLUS(txTimeout);
+	SARLUS(transportTime);
+	SARLUCN(_8, 4);
+
+	/* - Configuration Parameters */
+	SARLUC(irqLevel);
+	SARLUC(spreadingCode);
+	SARLUC(channelSet);
+	SARLUC(channelNumber);
+	SARLUS(radioNodeId);
+	SARLUCN(_9, 2);
+	SARLUC(scramblingDisable);
+	SARLUC(radioType);
+	SARLUS(routerId);
+	SARLUCN(_10, 9);
+	SARLUC(txAttenuation);
+	SARLUIA(systemId);
+	SARLUS(globalChecksum);
+	SARLUCN(_11, 4);
+	SARLUS(maxDatagramSize);
+	SARLUS(maxFrameSize);
+	SARLUC(maxRetries);
+	SARLUC(receiveMode);
+	SARLUC(priority);
+	SARLUC(rootOrRepeater);
+	SARLUCN(specifiedRouter, 6);
+	SARLUS(fastPollPeriod);
+	SARLUC(pollDecay);
+	SARLUSA(fastPollDelay);
+	SARLUC(arlThreshold);
+	SARLUC(arlDecay);
+	SARLUCN(_12, 1);
+	SARLUS(specRouterTimeout);
+	SARLUCN(_13, 5);
+
+	/* Scrambled Area */
+	SARLUIA(SID);
+	SARLUCN(encryptionKey, 12);
+	SARLUIA(_14);
+	SARLUSA(waitTime);
+	SARLUSA(lParameter);
+	SARLUCN(_15, 3);
+	SARLUS(headerSize);
+	SARLUS(sectionChecksum);
+
+	SARLUC(registrationMode);
+	SARLUC(registrationFill);
+	SARLUS(pollPeriod);
+	SARLUS(refreshPeriod);
+	SARLSTR(name, 16);
+	SARLUCN(NID, 6);
+	SARLUC(localTalkAddress);
+	SARLUC(codeFormat);
+	SARLUC(numChannels);
+	SARLUC(channel1);
+	SARLUC(channel2);
+	SARLUC(channel3);
+	SARLUC(channel4);
+	SARLUCN(SSCode, 59);
+
+/*      SARLUCN( _16, 0x140);
+ */
+	/* Statistics Block - 0x0300 */
+	SARLUC(hostcpuLock);
+	SARLUC(lancpuLock);
+	SARLUCN(resetTime, 18);
+	SARLUIA(numDatagramsTransmitted);
+	SARLUIA(numReTransmissions);
+	SARLUIA(numFramesDiscarded);
+	SARLUIA(numDatagramsReceived);
+	SARLUIA(numDuplicateReceivedFrames);
+	SARLUIA(numDatagramsDiscarded);
+	SARLUS(maxNumReTransmitDatagram);
+	SARLUS(maxNumReTransmitFrames);
+	SARLUS(maxNumConsecutiveDuplicateFrames);
+	/* misaligned here so we have to go to characters */
+	SARLUIA(numBytesTransmitted);
+	SARLUIA(numBytesReceived);
+	SARLUIA(numCRCErrors);
+	SARLUIA(numLengthErrors);
+	SARLUIA(numAbortErrors);
+	SARLUIA(numTXUnderruns);
+	SARLUIA(numRXOverruns);
+	SARLUIA(numHoldOffs);
+	SARLUIA(numFramesTransmitted);
+	SARLUIA(numFramesReceived);
+	SARLUIA(numReceiveFramesLost);
+	SARLUIA(numRXBufferOverflows);
+	SARLUIA(numFramesDiscardedAddrMismatch);
+	SARLUIA(numFramesDiscardedSIDMismatch);
+	SARLUIA(numPollsTransmistted);
+	SARLUIA(numPollAcknowledges);
+	SARLUIA(numStatusTimeouts);
+	SARLUIA(numNACKReceived);
+	SARLUS(auxCmd);
+	SARLUCN(dumpPtr, 4);
+	SARLUC(dumpVal);
+	SARLUC(wireTest);
+	
+	/* next 4 seems too long for procfs, over single page ?
+	SARLUCN( _17, 0x86);
+	SARLUCN( txBuffer, 0x800);
+	SARLUCN( rxBuffer,  0x800); 
+	SARLUCN( _18, 0x0bff);
+	 */
+
+	pos += sprintf(arlan_drive_info + pos, "rxRing\t=\t0x");
+	for (i = 0; i < 0x50; i++)
+		pos += sprintf(arlan_drive_info + pos, "%02x", ((char *) priva->conf)[priva->conf->rxOffset + i]);
+	pos += sprintf(arlan_drive_info + pos, "\n");
+
+	SARLUC(configStatus);
+	SARLUC(_22);
+	SARLUC(progIOCtrl);
+	SARLUC(shareMBase);
+	SARLUC(controlRegister);
+
+	pos += sprintf(arlan_drive_info + pos, " total %d chars\n", pos);
+	if (ctl)
+		if (ctl->procname)
+			pos += sprintf(arlan_drive_info + pos, " driver name : %s\n", ctl->procname);
+final:
+	*lenp = pos;
+
+	if (!write)
+		retv = proc_dostring(ctl, write, filp, buffer, lenp);
+	else
+	{
+		*lenp = 0;
+		return -1;
+	}
+	return retv;
+}
+
+
+static int arlan_sysctl_info161719(ctl_table * ctl, int write, struct file *filp,
+			    void *buffer, size_t * lenp)
+{
+	int i;
+	int retv, pos, devnum;
+	struct arlan_private *priva = NULL;
+
+	pos = 0;
+	devnum = ctl->procname[5] - '0';
+	if (arlan_device[devnum] == NULL)
+	{
+		pos += sprintf(arlan_drive_info + pos, "No device found here \n");
+		goto final;
+	}
+	else
+		priva = arlan_device[devnum]->priv;
+	if (priva == NULL)
+	{
+		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
+		return -1;
+	}
+	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
+	SARLUCN(_16, 0xC0);
+	SARLUCN(_17, 0x6A);
+	SARLUCN(_18, 14);
+	SARLUCN(_19, 0x86);
+	SARLUCN(_21, 0x3fd);
+
+final:
+	*lenp = pos;
+	retv = proc_dostring(ctl, write, filp, buffer, lenp);
+	return retv;
+}
+
+static int arlan_sysctl_infotxRing(ctl_table * ctl, int write, struct file *filp,
+			    void *buffer, size_t * lenp)
+{
+	int i;
+	int retv, pos, devnum;
+	struct arlan_private *priva = NULL;
+
+	pos = 0;
+	devnum = ctl->procname[5] - '0';
+	if (arlan_device[devnum] == NULL)
+	{
+		  pos += sprintf(arlan_drive_info + pos, "No device found here \n");
+		  goto final;
+	}
+	else
+		priva = arlan_device[devnum]->priv;
+	if (priva == NULL)
+	{
+		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
+		return -1;
+	}
+	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
+	SARLBNpln(u_char, txBuffer, 0x800);
+final:
+	*lenp = pos;
+	retv = proc_dostring(ctl, write, filp, buffer, lenp);
+	return retv;
+}
+
+static int arlan_sysctl_inforxRing(ctl_table * ctl, int write, struct file *filp,
+			    void *buffer, size_t * lenp)
+{
+	int i;
+	int retv, pos, devnum;
+	struct arlan_private *priva = NULL;
+
+	pos = 0;
+	devnum = ctl->procname[5] - '0';
+	if (arlan_device[devnum] == NULL)
+	{
+		  pos += sprintf(arlan_drive_info + pos, "No device found here \n");
+		  goto final;
+	} else
+		priva = arlan_device[devnum]->priv;
+	if (priva == NULL)
+	{
+		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
+		return -1;
+	}
+	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
+	SARLBNpln(u_char, rxBuffer, 0x800);
+final:
+	*lenp = pos;
+	retv = proc_dostring(ctl, write, filp, buffer, lenp);
+	return retv;
+}
+
+static int arlan_sysctl_info18(ctl_table * ctl, int write, struct file *filp,
+			void *buffer, size_t * lenp)
+{
+	int i;
+	int retv, pos, devnum;
+	struct arlan_private *priva = NULL;
+
+	pos = 0;
+	devnum = ctl->procname[5] - '0';
+	if (arlan_device[devnum] == NULL)
+	{
+		pos += sprintf(arlan_drive_info + pos, "No device found here \n");
+		goto final;
+	}
+	else
+		priva = arlan_device[devnum]->priv;
+	if (priva == NULL)
+	{
+		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
+		return -1;
+	}
+	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));
+	SARLBNpln(u_char, _18, 0x800);
+
+final:
+	*lenp = pos;
+	retv = proc_dostring(ctl, write, filp, buffer, lenp);
+	return retv;
+}
+
+
+#endif				/* #ifdef ARLAN_PROC_SHM_DUMP */
+
+
+static char conf_reset_result[200];
+
+static int arlan_configure(ctl_table * ctl, int write, struct file *filp,
+		    void *buffer, size_t * lenp)
+{
+	int pos = 0;
+	int devnum = ctl->procname[6] - '0';
+	struct arlan_private *priv;
+
+	if (devnum < 0 || devnum > MAX_ARLANS - 1)
+	{
+		  printk(KERN_WARNING "too strange devnum in procfs parse\n ");
+		  return -1;
+	}
+	else if (arlan_device[devnum] != NULL)
+	{
+		  priv = arlan_device[devnum]->priv;
+
+		  arlan_command(arlan_device[devnum], ARLAN_COMMAND_CLEAN_AND_CONF);
+	}
+	else
+		return -1;
+
+	*lenp = pos;
+	return proc_dostring(ctl, write, filp, buffer, lenp);
+}
+
+static int arlan_sysctl_reset(ctl_table * ctl, int write, struct file *filp,
+		       void *buffer, size_t * lenp)
+{
+	int pos = 0;
+	int devnum = ctl->procname[5] - '0';
+	struct arlan_private *priv;
+
+	if (devnum < 0 || devnum > MAX_ARLANS - 1)
+	{
+		  printk(KERN_WARNING "too strange devnum in procfs parse\n ");
+		  return -1;
+	}
+	else if (arlan_device[devnum] != NULL)
+	{
+		priv = arlan_device[devnum]->priv;
+		arlan_command(arlan_device[devnum], ARLAN_COMMAND_CLEAN_AND_RESET);
+
+	} else
+		return -1;
+	*lenp = pos + 3;
+	return proc_dostring(ctl, write, filp, buffer, lenp);
+}
+
+
+/* Place files in /proc/sys/dev/arlan */
+#define CTBLN(num,card,nam) \
+        { .ctl_name = num,\
+          .procname = #nam,\
+          .data = &(arlan_conf[card].nam),\
+          .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec}
+#ifdef ARLAN_DEBUGGING
+
+#define ARLAN_PROC_DEBUG_ENTRIES \
+        { .ctl_name = 48, .procname = "entry_exit_debug",\
+          .data = &arlan_entry_and_exit_debug,\
+          .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec},\
+	{ .ctl_name = 49, .procname = "debug", .data = &arlan_debug,\
+          .maxlen = sizeof(int), .mode = 0600, .proc_handler = &proc_dointvec},
+#else 
+#define ARLAN_PROC_DEBUG_ENTRIES
+#endif
+
+#define ARLAN_SYSCTL_TABLE_TOTAL(cardNo)\
+	CTBLN(1,cardNo,spreadingCode),\
+	CTBLN(2,cardNo, channelNumber),\
+	CTBLN(3,cardNo, scramblingDisable),\
+	CTBLN(4,cardNo, txAttenuation),\
+	CTBLN(5,cardNo, systemId), \
+	CTBLN(6,cardNo, maxDatagramSize),\
+	CTBLN(7,cardNo, maxFrameSize),\
+	CTBLN(8,cardNo, maxRetries),\
+	CTBLN(9,cardNo, receiveMode),\
+	CTBLN(10,cardNo, priority),\
+	CTBLN(11,cardNo, rootOrRepeater),\
+	CTBLN(12,cardNo, SID),\
+	CTBLN(13,cardNo, registrationMode),\
+	CTBLN(14,cardNo, registrationFill),\
+	CTBLN(15,cardNo, localTalkAddress),\
+	CTBLN(16,cardNo, codeFormat),\
+	CTBLN(17,cardNo, numChannels),\
+	CTBLN(18,cardNo, channel1),\
+	CTBLN(19,cardNo, channel2),\
+	CTBLN(20,cardNo, channel3),\
+	CTBLN(21,cardNo, channel4),\
+	CTBLN(22,cardNo, txClear),\
+	CTBLN(23,cardNo, txRetries),\
+	CTBLN(24,cardNo, txRouting),\
+	CTBLN(25,cardNo, txScrambled),\
+	CTBLN(26,cardNo, rxParameter),\
+	CTBLN(27,cardNo, txTimeoutMs),\
+	CTBLN(28,cardNo, waitCardTimeout),\
+	CTBLN(29,cardNo, channelSet), \
+	{.ctl_name = 30, .procname = "name",\
+	 .data = arlan_conf[cardNo].siteName,\
+	 .maxlen = 16, .mode = 0600, .proc_handler = &proc_dostring},\
+	CTBLN(31,cardNo,waitTime),\
+	CTBLN(32,cardNo,lParameter),\
+	CTBLN(33,cardNo,_15),\
+	CTBLN(34,cardNo,headerSize),\
+	CTBLN(35,cardNo,async),\
+	CTBLN(36,cardNo,tx_delay_ms),\
+	CTBLN(37,cardNo,retries),\
+	CTBLN(38,cardNo,ReTransmitPacketMaxSize),\
+	CTBLN(39,cardNo,waitReTransmitPacketMaxSize),\
+	CTBLN(40,cardNo,fastReTransCount),\
+	CTBLN(41,cardNo,driverRetransmissions),\
+	CTBLN(42,cardNo,txAckTimeoutMs),\
+	CTBLN(43,cardNo,registrationInterrupts),\
+	CTBLN(44,cardNo,hardwareType),\
+	CTBLN(45,cardNo,radioType),\
+	CTBLN(46,cardNo,writeEEPROM),\
+	CTBLN(47,cardNo,writeRadioType),\
+	ARLAN_PROC_DEBUG_ENTRIES\
+	CTBLN(50,cardNo,in_speed),\
+	CTBLN(51,cardNo,out_speed),\
+	CTBLN(52,cardNo,in_speed10),\
+	CTBLN(53,cardNo,out_speed10),\
+	CTBLN(54,cardNo,in_speed_max),\
+	CTBLN(55,cardNo,out_speed_max),\
+	CTBLN(56,cardNo,measure_rate),\
+	CTBLN(57,cardNo,pre_Command_Wait),\
+	CTBLN(58,cardNo,rx_tweak1),\
+	CTBLN(59,cardNo,rx_tweak2),\
+	CTBLN(60,cardNo,tx_queue_len),\
+
+
+
+static ctl_table arlan_conf_table0[] =
+{
+	ARLAN_SYSCTL_TABLE_TOTAL(0)
+
+#ifdef ARLAN_PROC_SHM_DUMP
+	{
+		.ctl_name	= 150,
+		.procname	= "arlan0-txRing",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_infotxRing,
+	},
+	{
+		.ctl_name	= 151,
+		.procname	= "arlan0-rxRing",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_inforxRing,
+	},
+	{
+		.ctl_name	= 152,
+		.procname	= "arlan0-18",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_info18,
+	},
+	{
+		.ctl_name	= 153,
+		.procname	= "arlan0-ring",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_info161719,
+	},
+	{
+		.ctl_name	= 154,
+		.procname	= "arlan0-shm-cpy",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_info,
+	},
+#endif
+	{
+		.ctl_name	= 155,
+		.procname	= "config0",
+		.data		= &conf_reset_result,
+		.maxlen		= 100,
+		.mode		= 0400,
+		.proc_handler	= &arlan_configure
+	},
+	{
+		.ctl_name	= 156,
+		.procname	= "reset0",
+		.data		= &conf_reset_result,
+		.maxlen		= 100,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_reset,
+	},
+	{ .ctl_name = 0 }
+};
+
+static ctl_table arlan_conf_table1[] =
+{
+
+	ARLAN_SYSCTL_TABLE_TOTAL(1)
+
+#ifdef ARLAN_PROC_SHM_DUMP
+	{
+		.ctl_name	= 150,
+		.procname	= "arlan1-txRing",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_infotxRing,
+	},
+	{
+		.ctl_name	= 151,
+		.procname	= "arlan1-rxRing",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_inforxRing,
+	},
+	{
+		.ctl_name	= 152,
+		.procname	= "arlan1-18",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_info18,
+	},
+	{
+		.ctl_name	= 153,
+		.procname	= "arlan1-ring",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_info161719,
+	},
+	{
+		.ctl_name	= 154,
+		.procname	= "arlan1-shm-cpy",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_info,
+	},
+#endif
+	{
+		.ctl_name	= 155,
+		.procname	= "config1",
+		.data		= &conf_reset_result,
+		.maxlen		= 100,
+		.mode		= 0400,
+		.proc_handler	= &arlan_configure,
+	},
+	{
+		.ctl_name	= 156,
+		.procname	= "reset1",
+		.data		= &conf_reset_result,
+		.maxlen		= 100,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_reset,
+	},
+	{ .ctl_name = 0 }
+};
+
+static ctl_table arlan_conf_table2[] =
+{
+
+	ARLAN_SYSCTL_TABLE_TOTAL(2)
+
+#ifdef ARLAN_PROC_SHM_DUMP
+	{
+		.ctl_name	= 150,
+		.procname	= "arlan2-txRing",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_infotxRing,
+	},
+	{
+		.ctl_name	= 151,
+		.procname	= "arlan2-rxRing",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_inforxRing,
+	},
+	{
+		.ctl_name	= 152,
+		.procname	= "arlan2-18",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_info18,
+	},
+	{
+		.ctl_name	= 153,
+		.procname	= "arlan2-ring",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_info161719,
+	},
+	{
+		.ctl_name	= 154,
+		.procname	= "arlan2-shm-cpy",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_info,
+	},
+#endif
+	{
+		.ctl_name	= 155,
+		.procname	= "config2",
+		.data		= &conf_reset_result,
+		.maxlen		= 100,
+		.mode		= 0400,
+		.proc_handler	= &arlan_configure,
+	},
+	{
+		.ctl_name	= 156,
+		.procname	= "reset2",
+		.data		= &conf_reset_result,
+		.maxlen		= 100,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_reset,
+	},
+	{ .ctl_name = 0 }
+};
+
+static ctl_table arlan_conf_table3[] =
+{
+
+	ARLAN_SYSCTL_TABLE_TOTAL(3)
+
+#ifdef ARLAN_PROC_SHM_DUMP
+	{
+		.ctl_name	= 150,
+		.procname	= "arlan3-txRing",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_infotxRing,
+	},
+	{
+		.ctl_name	= 151,
+		.procname	= "arlan3-rxRing",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_inforxRing,
+	},
+	{
+		.ctl_name	= 152,
+		.procname	= "arlan3-18",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_info18,
+	},
+	{
+		.ctl_name	= 153,
+		.procname	= "arlan3-ring",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_info161719,
+	},
+	{
+		.ctl_name	= 154,
+		.procname	= "arlan3-shm-cpy",
+		.data		= &arlan_drive_info,
+		.maxlen		= ARLAN_STR_SIZE,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_info,
+	},
+#endif
+	{
+		.ctl_name	= 155,
+		.procname	= "config3",
+		.data		= &conf_reset_result,
+		.maxlen		= 100,
+		.mode		= 0400,
+		.proc_handler	= &arlan_configure,
+	},
+	{
+		.ctl_name	= 156,
+		.procname	= "reset3",
+		.data		= &conf_reset_result,
+		.maxlen		= 100,
+		.mode		= 0400,
+		.proc_handler	= &arlan_sysctl_reset,
+	},
+	{ .ctl_name = 0 }
+};
+
+
+
+static ctl_table arlan_table[] =
+{
+	{
+		.ctl_name	= 0,
+		.procname	= "arlan0",
+		.maxlen		= 0,
+		.mode		= 0600,
+		.child		= arlan_conf_table0,
+	},
+	{
+		.ctl_name	= 0,
+		.procname	= "arlan1",
+		.maxlen		= 0,
+		.mode		= 0600,
+		.child		= arlan_conf_table1,
+	},
+	{
+		.ctl_name	= 0,
+		.procname	= "arlan2",
+		.maxlen		= 0,
+		.mode		= 0600,
+		.child		= arlan_conf_table2,
+	},
+	{
+		.ctl_name	= 0,
+		.procname	= "arlan3",
+		.maxlen		= 0,
+		.mode		= 0600,
+		.child		= arlan_conf_table3,
+	},
+	{ .ctl_name = 0 }
+};
+
+#else
+
+static ctl_table arlan_table[MAX_ARLANS + 1] =
+{
+	{ .ctl_name = 0 }
+};
+#endif
+#else
+
+static ctl_table arlan_table[MAX_ARLANS + 1] =
+{
+	{ .ctl_name = 0 }
+};
+#endif
+
+
+// static int mmtu = 1234;
+
+static ctl_table arlan_root_table[] =
+{
+	{
+		.ctl_name	= 254,
+		.procname	= "arlan",
+		.maxlen		= 0,
+		.mode		= 0555,
+		.child		= arlan_table,
+	},
+	{ .ctl_name = 0 }
+};
+
+/* Make sure that /proc/sys/dev is there */
+//static ctl_table arlan_device_root_table[] =
+//{
+//	{CTL_DEV, "dev", NULL, 0, 0555, arlan_root_table},
+//	{0}
+//};
+
+
+
+static struct ctl_table_header *arlan_device_sysctl_header;
+
+int init_arlan_proc(void)
+{
+
+	int i = 0;
+	if (arlan_device_sysctl_header)
+		return 0;
+	for (i = 0; i < MAX_ARLANS && arlan_device[i]; i++)
+		arlan_table[i].ctl_name = i + 1;
+	arlan_device_sysctl_header = register_sysctl_table(arlan_root_table, 0);
+	if (!arlan_device_sysctl_header)
+		return -1;
+
+	return 0;
+
+};
+
+
+
+#ifdef MODULE
+
+int init_module(void)
+{
+
+	return init_arlan_proc();
+};
+
+void cleanup_module(void)
+{
+	unregister_sysctl_table(arlan_device_sysctl_header);
+	arlan_device_sysctl_header = NULL;
+
+	return;
+};
+
+#endif				// MODULE
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/net/wireless/arlan.c b/drivers/net/wireless/arlan.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/wireless/arlan.c	Sun Feb 23 22:25:25 2003
@@ -0,0 +1,2077 @@
+/*
+ *  Copyright (C) 1997 Cullen Jennings
+ *  Copyright (C) 1998 Elmer Joandiu, elmer@ylenurme.ee
+ *  GNU General Public License applies
+ * This module provides support for the Arlan 655 card made by Aironet
+ */
+
+#include <linux/config.h>
+#include "arlan.h"
+
+#if BITS_PER_LONG != 32
+#  error FIXME: this driver requires a 32-bit platform
+#endif
+
+static const char *arlan_version = "C.Jennigs 97 & Elmer.Joandi@ut.ee  Oct'98, http://www.ylenurme.ee/~elmer/655/";
+
+struct net_device *arlan_device[MAX_ARLANS];
+int last_arlan;
+
+static int SID = SIDUNKNOWN;
+static int radioNodeId = radioNodeIdUNKNOWN;
+static char encryptionKey[12] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
+static char *siteName = siteNameUNKNOWN;
+static int mem = memUNKNOWN;
+int arlan_debug = debugUNKNOWN;
+static int probe = probeUNKNOWN;
+static int numDevices = numDevicesUNKNOWN;
+static int spreadingCode = spreadingCodeUNKNOWN;
+static int channelNumber = channelNumberUNKNOWN;
+static int channelSet = channelSetUNKNOWN;
+static int systemId = systemIdUNKNOWN;
+static int registrationMode = registrationModeUNKNOWN;
+static int keyStart;
+static int tx_delay_ms;
+static int retries = 5;
+static int async = 1;
+static int tx_queue_len = 1;
+static int arlan_EEPROM_bad;
+
+#ifdef ARLAN_DEBUGGING
+
+static int arlan_entry_debug;
+static int arlan_exit_debug;
+static int testMemory = testMemoryUNKNOWN;
+static int irq = irqUNKNOWN;
+static int txScrambled = 1;
+static int mdebug;
+#endif
+
+#if LINUX_VERSION_CODE > 0x20100
+MODULE_PARM(irq, "i");
+MODULE_PARM(mem, "i");
+MODULE_PARM(probe, "i");
+MODULE_PARM(arlan_debug, "i");
+MODULE_PARM(numDevices, "i");
+MODULE_PARM(testMemory, "i");
+MODULE_PARM(spreadingCode, "i");
+MODULE_PARM(channelNumber, "i");
+MODULE_PARM(channelSet, "i");
+MODULE_PARM(systemId, "i");
+MODULE_PARM(registrationMode, "i");
+MODULE_PARM(radioNodeId, "i");
+MODULE_PARM(SID, "i");
+MODULE_PARM(txScrambled, "i");
+MODULE_PARM(keyStart, "i");
+MODULE_PARM(mdebug, "i");
+MODULE_PARM(tx_delay_ms, "i");
+MODULE_PARM(retries, "i");
+MODULE_PARM(async, "i");
+MODULE_PARM(tx_queue_len, "i");
+MODULE_PARM(arlan_entry_debug, "i");
+MODULE_PARM(arlan_exit_debug, "i");
+MODULE_PARM(arlan_entry_and_exit_debug, "i");
+MODULE_PARM(arlan_EEPROM_bad, "i");
+MODULE_PARM_DESC(irq, "(unused)");
+MODULE_PARM_DESC(mem, "Arlan memory address for single device probing");
+MODULE_PARM_DESC(probe, "Arlan probe at initialization (0-1)");
+MODULE_PARM_DESC(arlan_debug, "Arlan debug enable (0-1)");
+MODULE_PARM_DESC(numDevices, "Number of Arlan devices; ignored if >1");
+MODULE_PARM_DESC(testMemory, "(unused)");
+MODULE_PARM_DESC(mdebug, "Arlan multicast debugging (0-1)");
+MODULE_PARM_DESC(retries, "Arlan maximum packet retransmisions");
+#ifdef ARLAN_ENTRY_EXIT_DEBUGGING
+MODULE_PARM_DESC(arlan_entry_debug, "Arlan driver function entry debugging");
+MODULE_PARM_DESC(arlan_exit_debug, "Arlan driver function exit debugging");
+MODULE_PARM_DESC(arlan_entry_and_exit_debug, "Arlan driver function entry and exit debugging");
+#else
+MODULE_PARM_DESC(arlan_entry_debug, "(ignored)");
+MODULE_PARM_DESC(arlan_exit_debug, "(ignored)");
+MODULE_PARM_DESC(arlan_entry_and_exit_debug, "(ignored)");
+#endif
+
+EXPORT_SYMBOL(arlan_device);
+EXPORT_SYMBOL(arlan_conf);
+EXPORT_SYMBOL(last_arlan);
+
+
+//        #warning kernel 2.1.110 tested
+#define myATOMIC_INIT(a,b) atomic_set(&(a),b)
+
+#else
+#define test_and_set_bit	set_bit
+#if LINUX_VERSION_CODE != 0x20024
+ //        #warning kernel  2.0.36  tested
+#endif
+#define myATOMIC_INIT(a,b) a = b;
+
+#endif
+
+struct arlan_conf_stru arlan_conf[MAX_ARLANS];
+static int arlans_found;
+
+static  int 	arlan_probe_here(struct net_device *dev, int ioaddr);
+static  int 	arlan_open(struct net_device *dev);
+static  int 	arlan_tx(struct sk_buff *skb, struct net_device *dev);
+static  void 	arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+static  int 	arlan_close(struct net_device *dev);
+static  struct net_device_stats *
+		arlan_statistics		(struct net_device *dev);
+static  void 	arlan_set_multicast		(struct net_device *dev);
+static  int 	arlan_hw_tx			(struct net_device* dev, char *buf, int length );
+static  int	arlan_hw_config			(struct net_device * dev);
+static  void 	arlan_tx_done_interrupt		(struct net_device * dev, int status);
+static  void	arlan_rx_interrupt		(struct net_device * dev, u_char rxStatus, u_short, u_short);
+static  void	arlan_process_interrupt		(struct net_device * dev);
+static	void	arlan_tx_timeout		(struct net_device *dev);
+int	arlan_command(struct net_device * dev, int command);
+
+EXPORT_SYMBOL(arlan_command);
+
+static inline long long arlan_time(void)
+{
+	struct timeval timev;
+	do_gettimeofday(&timev);
+	return ((long long) timev.tv_sec * 1000000 + timev.tv_usec);
+};
+
+#ifdef ARLAN_ENTRY_EXIT_DEBUGGING
+#define ARLAN_DEBUG_ENTRY(name) \
+	{\
+	struct timeval timev;\
+	do_gettimeofday(&timev);\
+		if (arlan_entry_debug || arlan_entry_and_exit_debug)\
+			printk("--->>>" name " %ld " "\n",((long int) timev.tv_sec * 1000000 + timev.tv_usec));\
+	}
+#define ARLAN_DEBUG_EXIT(name) \
+	{\
+	struct timeval timev;\
+	do_gettimeofday(&timev);\
+		if (arlan_exit_debug || arlan_entry_and_exit_debug)\
+			printk("<<<---" name " %ld " "\n",((long int) timev.tv_sec * 1000000 + timev.tv_usec) );\
+	}
+#else
+#define ARLAN_DEBUG_ENTRY(name)
+#define ARLAN_DEBUG_EXIT(name)
+#endif
+
+
+#define arlan_interrupt_ack(dev)\
+        clearClearInterrupt(dev);\
+        setClearInterrupt(dev);
+
+
+#define ARLAN_COMMAND_LOCK(dev) \
+	if (atomic_dec_and_test(&((struct arlan_private * )dev->priv)->card_users))\
+   		arlan_wait_command_complete_short(dev,__LINE__);
+#define ARLAN_COMMAND_UNLOCK(dev) \
+	atomic_inc(&((struct arlan_private * )dev->priv)->card_users);
+
+
+#define ARLAN_COMMAND_INC(dev) \
+ 	{((struct arlan_private *) dev->priv)->under_command++;}
+#define ARLAN_COMMAND_ZERO(dev) \
+ 	{((struct arlan_private *) dev->priv)->under_command =0;}
+#define ARLAN_UNDER_COMMAND(dev)\
+	(((struct arlan_private *) dev->priv)->under_command)
+
+#define ARLAN_COMMAND_START(dev) ARLAN_COMMAND_INC(dev)
+#define ARLAN_COMMAND_END(dev) ARLAN_COMMAND_ZERO(dev)
+#define ARLAN_TOGGLE_START(dev)\
+ 	{((struct arlan_private *) dev->priv)->under_toggle++;}
+#define ARLAN_TOGGLE_END(dev)\
+ 	{((struct arlan_private *) dev->priv)->under_toggle=0;}
+#define ARLAN_UNDER_TOGGLE(dev)\
+ 	(((struct arlan_private *) dev->priv)->under_toggle)
+
+
+
+static inline int arlan_drop_tx(struct net_device *dev)
+{
+	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
+
+	priv->stats.tx_errors++;
+	if (priv->Conf->tx_delay_ms)
+	{
+		priv->tx_done_delayed = jiffies + priv->Conf->tx_delay_ms * HZ / 1000 + 1;
+	}
+	else
+	{
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_TX;
+		TXHEAD(dev).offset = 0;
+		TXTAIL(dev).offset = 0;
+		priv->txLast = 0;
+		priv->txOffset = 0;
+		priv->bad = 0;
+		if (!priv->under_reset && !priv->under_config)
+			netif_wake_queue (dev);
+	}
+	return 1;
+};
+
+
+int arlan_command(struct net_device *dev, int command_p)
+{
+
+	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
+	struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf;
+	struct arlan_private *priv = (struct arlan_private *) dev->priv;
+	int udelayed = 0;
+	int i = 0;
+	long long time_mks = arlan_time();
+
+	ARLAN_DEBUG_ENTRY("arlan_command");
+
+	if (priv->card_polling_interval)
+		priv->card_polling_interval = 1;
+
+	if (arlan_debug & ARLAN_DEBUG_CHAIN_LOCKS)
+		printk(KERN_DEBUG "arlan_command, %lx lock %lx  commandByte %x waiting %x incoming %x \n",
+		jiffies, priv->command_lock, READSHMB(arlan->commandByte),
+		       priv->waiting_command_mask, command_p);
+
+	priv->waiting_command_mask |= command_p;
+
+	if (priv->waiting_command_mask & ARLAN_COMMAND_RESET)
+		if (jiffies - priv->lastReset < 5 * HZ)
+			priv->waiting_command_mask &= ~ARLAN_COMMAND_RESET;
+
+	if (priv->waiting_command_mask & ARLAN_COMMAND_INT_ACK)
+	{
+		arlan_interrupt_ack(dev);
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_INT_ACK;
+	}
+	if (priv->waiting_command_mask & ARLAN_COMMAND_INT_ENABLE)
+	{
+		setInterruptEnable(dev);
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_INT_ENABLE;
+	}
+
+	/* Card access serializing lock */
+
+	if (test_and_set_bit(0, (void *) &priv->command_lock))
+	{
+		if (arlan_debug & ARLAN_DEBUG_CHAIN_LOCKS)
+			printk(KERN_DEBUG "arlan_command: entered when command locked \n");
+		goto command_busy_end;
+	}
+	/* Check cards status and waiting */
+
+	if (priv->waiting_command_mask & (ARLAN_COMMAND_LONG_WAIT_NOW | ARLAN_COMMAND_WAIT_NOW))
+	{
+		while (priv->waiting_command_mask & (ARLAN_COMMAND_LONG_WAIT_NOW | ARLAN_COMMAND_WAIT_NOW))
+		{
+			if (READSHMB(arlan->resetFlag) ||
+				READSHMB(arlan->commandByte))	/* || 
+								   (readControlRegister(dev) & ARLAN_ACCESS))
+								 */
+				udelay(40);
+			else
+				priv->waiting_command_mask &= ~(ARLAN_COMMAND_LONG_WAIT_NOW | ARLAN_COMMAND_WAIT_NOW);
+
+			udelayed++;
+
+			if (priv->waiting_command_mask & ARLAN_COMMAND_LONG_WAIT_NOW)
+			{
+				if (udelayed * 40 > 1000000)
+				{
+					printk(KERN_ERR "%s long wait too long \n", dev->name);
+					priv->waiting_command_mask |= ARLAN_COMMAND_RESET;
+					break;
+				}
+			}
+			else if (priv->waiting_command_mask & ARLAN_COMMAND_WAIT_NOW)
+			{
+				if (udelayed * 40 > 1000)
+				{
+					printk(KERN_ERR "%s short wait too long \n", dev->name);
+					goto bad_end;
+				}
+			}
+		}
+	}
+	else
+	{
+		i = 0;
+		while ((READSHMB(arlan->resetFlag) ||
+			READSHMB(arlan->commandByte)) &&
+			conf->pre_Command_Wait > (i++) * 10)
+			udelay(10);
+
+
+		if ((READSHMB(arlan->resetFlag) ||
+			READSHMB(arlan->commandByte)) &&
+			!(priv->waiting_command_mask & ARLAN_COMMAND_RESET))
+		{
+			goto card_busy_end;
+		}
+	}
+	if (priv->waiting_command_mask & ARLAN_COMMAND_RESET)
+		priv->under_reset = 1;
+	if (priv->waiting_command_mask & ARLAN_COMMAND_CONF)
+		priv->under_config = 1;
+
+	/* Issuing command */
+	arlan_lock_card_access(dev);
+	if (priv->waiting_command_mask & ARLAN_COMMAND_POWERUP)
+	{
+	//     if (readControlRegister(dev) & (ARLAN_ACCESS && ARLAN_POWER))
+		setPowerOn(dev);
+		arlan_interrupt_lancpu(dev);
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_POWERUP;
+		priv->waiting_command_mask |= ARLAN_COMMAND_RESET;
+		priv->card_polling_interval = HZ / 10;
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_ACTIVATE)
+	{
+		WRITESHMB(arlan->commandByte, ARLAN_COM_ACTIVATE);
+		arlan_interrupt_lancpu(dev);
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_ACTIVATE;
+		priv->card_polling_interval = HZ / 10;
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_RX_ABORT)
+	{
+		if (priv->rx_command_given)
+		{
+			WRITESHMB(arlan->commandByte, ARLAN_COM_RX_ABORT);
+			arlan_interrupt_lancpu(dev);
+			priv->rx_command_given = 0;
+		}
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_RX_ABORT;
+		priv->card_polling_interval = 1;
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_TX_ABORT)
+	{
+		if (priv->tx_command_given)
+		{
+			WRITESHMB(arlan->commandByte, ARLAN_COM_TX_ABORT);
+			arlan_interrupt_lancpu(dev);
+			priv->tx_command_given = 0;
+		}
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_TX_ABORT;
+		priv->card_polling_interval = 1;
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_RESET)
+	{
+		priv->under_reset=1;
+		netif_stop_queue (dev);
+
+		arlan_drop_tx(dev);
+		if (priv->tx_command_given || priv->rx_command_given)
+		{
+			printk(KERN_ERR "%s: Reset under tx or rx command \n", dev->name);
+		};
+		netif_stop_queue (dev);
+		if (arlan_debug & ARLAN_DEBUG_RESET)
+			printk(KERN_ERR "%s: Doing chip reset\n", dev->name);
+		priv->lastReset = jiffies;
+		WRITESHM(arlan->commandByte, 0, u_char);
+		/* hold card in reset state */
+		setHardwareReset(dev);
+		/* set reset flag and then release reset */
+		WRITESHM(arlan->resetFlag, 0xff, u_char);
+		clearChannelAttention(dev);
+		clearHardwareReset(dev);
+		priv->numResets++;
+		priv->card_polling_interval = HZ / 4;
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_RESET;
+		priv->waiting_command_mask |= ARLAN_COMMAND_INT_RACK;
+//		priv->waiting_command_mask |= ARLAN_COMMAND_INT_RENABLE; 
+//		priv->waiting_command_mask |= ARLAN_COMMAND_RX;
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_INT_RACK)
+	{
+		clearHardwareReset(dev);
+		clearClearInterrupt(dev);
+		setClearInterrupt(dev);
+		setInterruptEnable(dev);
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_INT_RACK;
+		priv->waiting_command_mask |= ARLAN_COMMAND_CONF;
+		priv->under_config = 1;
+		priv->under_reset = 0;
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_INT_RENABLE)
+	{
+		setInterruptEnable(dev);
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_INT_RENABLE;
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_CONF)
+	{
+		if (priv->tx_command_given || priv->rx_command_given)
+		{
+			printk(KERN_ERR "%s: Reset under tx or rx command \n", dev->name);
+		}
+		arlan_drop_tx(dev);
+		setInterruptEnable(dev);
+		arlan_hw_config(dev);
+		arlan_interrupt_lancpu(dev);
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_CONF;
+		priv->card_polling_interval = HZ / 10;
+//		priv->waiting_command_mask |= ARLAN_COMMAND_INT_RACK;   
+//		priv->waiting_command_mask |= ARLAN_COMMAND_INT_ENABLE; 
+		priv->waiting_command_mask |= ARLAN_COMMAND_CONF_WAIT;
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_CONF_WAIT)
+	{
+		if (READSHMB(arlan->configuredStatusFlag) != 0 &&
+			READSHMB(arlan->diagnosticInfo) == 0xff)
+		{
+			priv->waiting_command_mask &= ~ARLAN_COMMAND_CONF_WAIT;
+			priv->waiting_command_mask |= ARLAN_COMMAND_RX;
+			priv->waiting_command_mask |= ARLAN_COMMAND_TBUSY_CLEAR;
+			priv->card_polling_interval = HZ / 10;
+			priv->tx_command_given = 0;
+			priv->under_config = 0;
+		}
+		else
+		{
+			priv->card_polling_interval = 1;
+			if (arlan_debug & ARLAN_DEBUG_TIMING)
+				printk(KERN_ERR "configure delayed \n");
+		}
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_RX)
+	{
+		if (!registrationBad(dev))
+		{
+			setInterruptEnable(dev);
+			memset_io((void *) arlan->commandParameter, 0, 0xf);
+			WRITESHMB(arlan->commandByte, ARLAN_COM_INT | ARLAN_COM_RX_ENABLE);
+			WRITESHMB(arlan->commandParameter[0], conf->rxParameter);
+			arlan_interrupt_lancpu(dev);
+			priv->rx_command_given = 0; // mnjah, bad
+			priv->last_rx_time = arlan_time();
+			priv->waiting_command_mask &= ~ARLAN_COMMAND_RX;
+			priv->card_polling_interval = 1;
+		}
+		else
+			priv->card_polling_interval = 2;
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_TBUSY_CLEAR)
+	{
+		if ( !registrationBad(dev) &&
+		     (netif_queue_stopped(dev) || !netif_running(dev)) )
+			{
+				priv->waiting_command_mask &= ~ARLAN_COMMAND_TBUSY_CLEAR;
+				netif_wake_queue (dev);
+			};
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_TX)
+	{
+		if (!test_and_set_bit(0, (void *) &priv->tx_command_given))
+		{
+			if ((time_mks - priv->last_tx_time > conf->rx_tweak1) ||
+				(time_mks - priv->last_rx_int_ack_time < conf->rx_tweak2))
+			{
+				setInterruptEnable(dev);
+				memset_io((void *) arlan->commandParameter, 0, 0xf);
+				WRITESHMB(arlan->commandByte, ARLAN_COM_TX_ENABLE | ARLAN_COM_INT);
+				memcpy_toio((void *) arlan->commandParameter, &TXLAST(dev), 14);
+//				for ( i=1 ; i < 15 ; i++) printk("%02x:",READSHMB(arlan->commandParameter[i]));
+				priv->last_command_was_rx = 0;
+				priv->tx_last_sent = jiffies;
+				arlan_interrupt_lancpu(dev);
+				priv->last_tx_time = arlan_time();
+				priv->tx_command_given = 1;
+				priv->waiting_command_mask &= ~ARLAN_COMMAND_TX;
+				priv->card_polling_interval = 1;
+			}
+			else
+			{
+				priv->tx_command_given = 0;
+				priv->card_polling_interval = 1;
+			}
+		} 
+		else if (arlan_debug & ARLAN_DEBUG_CHAIN_LOCKS)
+			printk(KERN_ERR "tx command when tx chain locked \n");
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_NOOPINT)
+	{
+		{
+			WRITESHMB(arlan->commandByte, ARLAN_COM_NOP | ARLAN_COM_INT);
+		}
+		arlan_interrupt_lancpu(dev);
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_NOOPINT;
+		priv->card_polling_interval = HZ / 3;
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_NOOP)
+	{
+		WRITESHMB(arlan->commandByte, ARLAN_COM_NOP);
+		arlan_interrupt_lancpu(dev);
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_NOOP;
+		priv->card_polling_interval = HZ / 3;
+	}
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_SLOW_POLL)
+	{
+		WRITESHMB(arlan->commandByte, ARLAN_COM_GOTO_SLOW_POLL);
+		arlan_interrupt_lancpu(dev);
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_SLOW_POLL;
+		priv->card_polling_interval = HZ / 3;
+	} 
+	else if (priv->waiting_command_mask & ARLAN_COMMAND_POWERDOWN)
+	{
+		setPowerOff(dev);
+		if (arlan_debug & ARLAN_DEBUG_CARD_STATE)
+			printk(KERN_WARNING "%s: Arlan Going Standby\n", dev->name);
+		priv->waiting_command_mask &= ~ARLAN_COMMAND_POWERDOWN;
+		priv->card_polling_interval = 3 * HZ;
+	}
+	arlan_unlock_card_access(dev);
+	for (i = 0; READSHMB(arlan->commandByte) && i < 20; i++)
+		udelay(10);
+	if (READSHMB(arlan->commandByte))
+		if (arlan_debug & ARLAN_DEBUG_CARD_STATE)
+			printk(KERN_ERR "card busy leaving command %x \n", priv->waiting_command_mask);
+
+	priv->command_lock = 0;
+	ARLAN_DEBUG_EXIT("arlan_command");
+	priv->last_command_buff_free_time = jiffies;
+	return 0;
+
+card_busy_end:
+	if (jiffies - priv->last_command_buff_free_time > HZ)
+		priv->waiting_command_mask |= ARLAN_COMMAND_CLEAN_AND_RESET;
+
+	if (arlan_debug & ARLAN_DEBUG_CARD_STATE)
+		printk(KERN_ERR "%s arlan_command card busy end \n", dev->name);
+	priv->command_lock = 0;
+	ARLAN_DEBUG_EXIT("arlan_command");
+	return 1;
+
+bad_end:
+	printk(KERN_ERR "%s arlan_command bad end \n", dev->name);
+
+	priv->command_lock = 0;
+	ARLAN_DEBUG_EXIT("arlan_command");
+
+	return -1;
+
+command_busy_end:
+	if (arlan_debug & ARLAN_DEBUG_CARD_STATE)
+		printk(KERN_ERR "%s arlan_command command busy end \n", dev->name);
+	ARLAN_DEBUG_EXIT("arlan_command");
+	return 2;
+
+};
+
+static inline void arlan_command_process(struct net_device *dev)
+{
+	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
+
+	int times = 0;
+	while (priv->waiting_command_mask && times < 8)
+	{
+		if (priv->waiting_command_mask)
+		{
+			if (arlan_command(dev, 0))
+				break;
+			times++;
+		}
+		/* if long command, we wont repeat trying */ ;
+		if (priv->card_polling_interval > 1)
+			break;
+		times++;
+	}
+}
+
+
+static inline void arlan_retransmit_now(struct net_device *dev)
+{
+	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
+
+
+	ARLAN_DEBUG_ENTRY("arlan_retransmit_now");
+	if (TXLAST(dev).offset == 0)
+	{
+		if (TXHEAD(dev).offset)
+		{
+			priv->txLast = 0;
+			IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk(KERN_DEBUG "TX buff switch to head \n");
+
+		}
+		else if (TXTAIL(dev).offset)
+		{
+			IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk(KERN_DEBUG "TX buff switch to tail \n");
+			priv->txLast = 1;
+		}
+		else
+			IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk(KERN_ERR "ReTransmit buff empty");
+		priv->txOffset = 0;
+		netif_wake_queue (dev);
+		return;
+
+	}
+	arlan_command(dev, ARLAN_COMMAND_TX);
+
+	priv->nof_tx++;
+
+	priv->Conf->driverRetransmissions++;
+	priv->retransmissions++;
+
+	IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk("Retransmit %d bytes \n", TXLAST(dev).length);
+
+	ARLAN_DEBUG_EXIT("arlan_retransmit_now");
+}
+
+
+
+static void arlan_registration_timer(unsigned long data)
+{
+	struct net_device *dev = (struct net_device *) data;
+	struct arlan_private *priv = (struct arlan_private *) dev->priv;
+
+	int lostTime = ((int) (jiffies - priv->registrationLastSeen)) * 1000 / HZ;
+	int bh_mark_needed = 0;
+	int next_tick = 1;
+
+
+	priv->timer_chain_active = 1;
+
+
+	if (registrationBad(dev))
+	{
+		//debug=100;
+		priv->registrationLostCount++;
+		if (lostTime > 7000 && lostTime < 7200)
+		{
+			printk(KERN_NOTICE "%s registration Lost \n", dev->name);
+		}
+		if (lostTime / priv->reRegisterExp > 2000)
+			arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_CONF);
+		if (lostTime / (priv->reRegisterExp) > 3500)
+			arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET);
+		if (priv->reRegisterExp < 400)
+			priv->reRegisterExp += 2;
+		if (lostTime > 7200)
+		{
+			next_tick = HZ;
+			arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET);
+		}
+	}
+	else
+	{
+		if (priv->Conf->registrationMode && lostTime > 10000 &&
+			priv->registrationLostCount)
+		{
+			printk(KERN_NOTICE "%s registration is back after %d milliseconds\n", dev->name,
+				((int) (jiffies - priv->registrationLastSeen) * 1000) / HZ);
+		}
+		priv->registrationLastSeen = jiffies;
+		priv->registrationLostCount = 0;
+		priv->reRegisterExp = 1;
+		if (!netif_running(dev) )
+			netif_wake_queue(dev);
+		if (priv->tx_last_sent > priv->tx_last_cleared &&
+			jiffies - priv->tx_last_sent > 5*HZ ){
+			arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET);		
+			priv->tx_last_cleared = jiffies;
+		};
+	}
+
+
+	if (!registrationBad(dev) && priv->ReTransmitRequested)
+	{
+		IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
+			printk(KERN_ERR "Retransmit from timer \n");
+		priv->ReTransmitRequested = 0;
+		arlan_retransmit_now(dev);
+	}
+	if (!registrationBad(dev) &&
+		time_after(jiffies, priv->tx_done_delayed) &&
+		priv->tx_done_delayed != 0)
+	{
+		TXLAST(dev).offset = 0;
+		if (priv->txLast)
+			priv->txLast = 0;
+		else if (TXTAIL(dev).offset)
+			priv->txLast = 1;
+		if (TXLAST(dev).offset)
+		{
+			arlan_retransmit_now(dev);
+			dev->trans_start = jiffies;
+		}
+		if (!(TXHEAD(dev).offset && TXTAIL(dev).offset))
+		{
+			priv->txOffset = 0;
+			netif_wake_queue (dev);
+		}
+		priv->tx_done_delayed = 0;
+		bh_mark_needed = 1;
+	}
+	if (bh_mark_needed)
+	{
+		priv->txOffset = 0;
+		netif_wake_queue (dev);
+	}
+	arlan_process_interrupt(dev);
+
+	if (next_tick < priv->card_polling_interval)
+		next_tick = priv->card_polling_interval;
+
+	priv->timer_chain_active = 0;
+	priv->timer.expires = jiffies + next_tick;
+
+	add_timer(&priv->timer);
+}
+
+
+#ifdef ARLAN_DEBUGGING
+
+static void arlan_print_registers(struct net_device *dev, int line)
+{
+	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
+
+	u_char hostcpuLock, lancpuLock, controlRegister, cntrlRegImage,
+		txStatus, rxStatus, interruptInProgress, commandByte;
+
+
+	ARLAN_DEBUG_ENTRY("arlan_print_registers");
+	READSHM(interruptInProgress, arlan->interruptInProgress, u_char);
+	READSHM(hostcpuLock, arlan->hostcpuLock, u_char);
+	READSHM(lancpuLock, arlan->lancpuLock, u_char);
+	READSHM(controlRegister, arlan->controlRegister, u_char);
+	READSHM(cntrlRegImage, arlan->cntrlRegImage, u_char);
+	READSHM(txStatus, arlan->txStatus, u_char);
+	READSHM(rxStatus, arlan->rxStatus, u_char);
+	READSHM(commandByte, arlan->commandByte, u_char);
+
+	printk(KERN_WARNING "line %04d IP %02x HL %02x LL %02x CB %02x CR %02x CRI %02x TX %02x RX %02x\n",
+		line, interruptInProgress, hostcpuLock, lancpuLock, commandByte,
+		controlRegister, cntrlRegImage, txStatus, rxStatus);
+
+	ARLAN_DEBUG_EXIT("arlan_print_registers");
+}
+#endif
+
+
+static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
+{
+	int i;
+
+	struct arlan_private *priv = (struct arlan_private *) dev->priv;
+	volatile struct arlan_shmem *arlan = priv->card;
+	struct arlan_conf_stru *conf = priv->Conf;
+
+	int tailStarts = 0x800;
+	int headEnds = 0x0;
+
+
+	ARLAN_DEBUG_ENTRY("arlan_hw_tx");
+	if (TXHEAD(dev).offset)
+		headEnds = (((TXHEAD(dev).offset + TXHEAD(dev).length - (((int) arlan->txBuffer) - ((int) arlan))) / 64) + 1) * 64;
+	if (TXTAIL(dev).offset)
+		tailStarts = 0x800 - (((TXTAIL(dev).offset - (((int) arlan->txBuffer) - ((int) arlan))) / 64) + 2) * 64;
+
+
+	if (!TXHEAD(dev).offset && length < tailStarts)
+	{
+		IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
+			printk(KERN_ERR "TXHEAD insert, tailStart %d\n", tailStarts);
+
+		TXHEAD(dev).offset =
+			(((int) arlan->txBuffer) - ((int) arlan));
+		TXHEAD(dev).length = length - ARLAN_FAKE_HDR_LEN;
+		for (i = 0; i < 6; i++)
+			TXHEAD(dev).dest[i] = buf[i];
+		TXHEAD(dev).clear = conf->txClear;
+		TXHEAD(dev).retries = conf->txRetries;	/* 0 is use default */
+		TXHEAD(dev).routing = conf->txRouting;
+		TXHEAD(dev).scrambled = conf->txScrambled;
+		memcpy_toio(((char *) arlan + TXHEAD(dev).offset), buf + ARLAN_FAKE_HDR_LEN, TXHEAD(dev).length);
+	}
+	else if (!TXTAIL(dev).offset && length < (0x800 - headEnds))
+	{
+		IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
+			printk(KERN_ERR "TXTAIL insert, headEnd %d\n", headEnds);
+
+		TXTAIL(dev).offset =
+			(((int) arlan->txBuffer) - ((int) arlan)) + 0x800 - (length / 64 + 2) * 64;
+		TXTAIL(dev).length = length - ARLAN_FAKE_HDR_LEN;
+		for (i = 0; i < 6; i++)
+			TXTAIL(dev).dest[i] = buf[i];
+		TXTAIL(dev).clear = conf->txClear;
+		TXTAIL(dev).retries = conf->txRetries;
+		TXTAIL(dev).routing = conf->txRouting;
+		TXTAIL(dev).scrambled = conf->txScrambled;
+		memcpy_toio(((char *) arlan + TXTAIL(dev).offset), buf + ARLAN_FAKE_HDR_LEN, TXTAIL(dev).length);
+	}
+	else
+	{
+		netif_stop_queue (dev);
+		return -1;
+		IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
+			printk(KERN_ERR "TX TAIL & HEAD full, return, tailStart %d headEnd %d\n", tailStarts, headEnds);
+	}
+	priv->out_bytes += length;
+	priv->out_bytes10 += length;
+	if (conf->measure_rate < 1)
+		conf->measure_rate = 1;
+	if (jiffies - priv->out_time > conf->measure_rate * HZ)
+	{
+		conf->out_speed = priv->out_bytes / conf->measure_rate;
+		priv->out_bytes = 0;
+		priv->out_time = jiffies;
+	}
+	if (jiffies - priv->out_time10 > conf->measure_rate * HZ * 10)
+	{
+		conf->out_speed10 = priv->out_bytes10 / (10 * conf->measure_rate);
+		priv->out_bytes10 = 0;
+		priv->out_time10 = jiffies;
+	}
+	if (TXHEAD(dev).offset && TXTAIL(dev).offset)
+	{
+		netif_stop_queue (dev);
+		return 0;
+	}
+	else
+		netif_start_queue (dev);
+
+
+	IFDEBUG(ARLAN_DEBUG_HEADER_DUMP)
+		printk(KERN_WARNING "%s Transmit t %2x:%2x:%2x:%2x:%2x:%2x f %2x:%2x:%2x:%2x:%2x:%2x \n", dev->name,
+		   (unsigned char) buf[0], (unsigned char) buf[1], (unsigned char) buf[2], (unsigned char) buf[3],
+		   (unsigned char) buf[4], (unsigned char) buf[5], (unsigned char) buf[6], (unsigned char) buf[7],
+		   (unsigned char) buf[8], (unsigned char) buf[9], (unsigned char) buf[10], (unsigned char) buf[11]);
+
+	IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk(KERN_ERR "TX command prepare for buffer %d\n", priv->txLast);
+
+	arlan_command(dev, ARLAN_COMMAND_TX);
+
+	priv->last_command_was_rx = 0;
+	priv->tx_last_sent = jiffies;
+	priv->nof_tx++;
+
+	IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk("%s TX Qued %d bytes \n", dev->name, length);
+
+	ARLAN_DEBUG_EXIT("arlan_hw_tx");
+
+	return 0;
+}
+
+
+static int arlan_hw_config(struct net_device *dev)
+{
+	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
+	struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf;
+	struct arlan_private *priv = (struct arlan_private *) dev->priv;
+
+	ARLAN_DEBUG_ENTRY("arlan_hw_config");
+
+	printk(KERN_NOTICE "%s arlan configure called \n", dev->name);
+	if (arlan_EEPROM_bad)
+		printk(KERN_NOTICE "arlan configure with eeprom bad option \n");
+
+
+	WRITESHM(arlan->spreadingCode, conf->spreadingCode, u_char);
+	WRITESHM(arlan->channelSet, conf->channelSet, u_char);
+
+	if (arlan_EEPROM_bad)
+		WRITESHM(arlan->defaultChannelSet, conf->channelSet, u_char);
+
+	WRITESHM(arlan->channelNumber, conf->channelNumber, u_char);
+
+	WRITESHM(arlan->scramblingDisable, conf->scramblingDisable, u_char);
+	WRITESHM(arlan->txAttenuation, conf->txAttenuation, u_char);
+
+	WRITESHM(arlan->systemId, conf->systemId, u_int);
+
+	WRITESHM(arlan->maxRetries, conf->maxRetries, u_char);
+	WRITESHM(arlan->receiveMode, conf->receiveMode, u_char);
+	WRITESHM(arlan->priority, conf->priority, u_char);
+	WRITESHM(arlan->rootOrRepeater, conf->rootOrRepeater, u_char);
+	WRITESHM(arlan->SID, conf->SID, u_int);
+
+	WRITESHM(arlan->registrationMode, conf->registrationMode, u_char);
+
+	WRITESHM(arlan->registrationFill, conf->registrationFill, u_char);
+	WRITESHM(arlan->localTalkAddress, conf->localTalkAddress, u_char);
+	WRITESHM(arlan->codeFormat, conf->codeFormat, u_char);
+	WRITESHM(arlan->numChannels, conf->numChannels, u_char);
+	WRITESHM(arlan->channel1, conf->channel1, u_char);
+	WRITESHM(arlan->channel2, conf->channel2, u_char);
+	WRITESHM(arlan->channel3, conf->channel3, u_char);
+	WRITESHM(arlan->channel4, conf->channel4, u_char);
+	WRITESHM(arlan->radioNodeId, conf->radioNodeId, u_short);
+	WRITESHM(arlan->SID, conf->SID, u_int);
+	WRITESHM(arlan->waitTime, conf->waitTime, u_short);
+	WRITESHM(arlan->lParameter, conf->lParameter, u_short);
+	memcpy_toio(&(arlan->_15), &(conf->_15), 3);
+	WRITESHM(arlan->_15, conf->_15, u_short);
+	WRITESHM(arlan->headerSize, conf->headerSize, u_short);
+	if (arlan_EEPROM_bad)
+		WRITESHM(arlan->hardwareType, conf->hardwareType, u_char);
+	WRITESHM(arlan->radioType, conf->radioType, u_char);
+	if (arlan_EEPROM_bad)
+		WRITESHM(arlan->radioModule, conf->radioType, u_char);
+
+	memcpy_toio(arlan->encryptionKey + keyStart, encryptionKey, 8);
+	memcpy_toio(arlan->name, conf->siteName, 16);
+
+	WRITESHMB(arlan->commandByte, ARLAN_COM_INT | ARLAN_COM_CONF);	/* do configure */
+	memset_io(arlan->commandParameter, 0, 0xf);	/* 0xf */
+	memset_io(arlan->commandParameter + 1, 0, 2);
+	if (conf->writeEEPROM)
+	{
+		  memset_io(arlan->commandParameter, conf->writeEEPROM, 1);
+//		conf->writeEEPROM=0;
+	}
+	if (conf->registrationMode && conf->registrationInterrupts)
+		memset_io(arlan->commandParameter + 3, 1, 1);
+	else
+		memset_io(arlan->commandParameter + 3, 0, 1);
+
+	priv->irq_test_done = 0;
+
+	if (conf->tx_queue_len)
+		dev->tx_queue_len = conf->tx_queue_len;
+	udelay(100);
+
+	ARLAN_DEBUG_EXIT("arlan_hw_config");
+	return 0;
+}
+
+
+static int arlan_read_card_configuration(struct net_device *dev)
+{
+	u_char tlx415;
+	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
+	struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf;
+
+	ARLAN_DEBUG_ENTRY("arlan_read_card_configuration");
+
+	if (radioNodeId == radioNodeIdUNKNOWN)
+	{
+		READSHM(conf->radioNodeId, arlan->radioNodeId, u_short);
+	}
+	else
+		conf->radioNodeId = radioNodeId;
+		
+	if (SID == SIDUNKNOWN)
+	{
+		READSHM(conf->SID, arlan->SID, u_int);
+	}
+	else conf->SID = SID;
+		
+	if (spreadingCode == spreadingCodeUNKNOWN)
+	{
+		  READSHM(conf->spreadingCode, arlan->spreadingCode, u_char);
+	}
+	else
+		conf->spreadingCode = spreadingCode;
+		
+	if (channelSet == channelSetUNKNOWN)
+	{
+		READSHM(conf->channelSet, arlan->channelSet, u_char);
+	}
+	else conf->channelSet = channelSet;
+
+	if (channelNumber == channelNumberUNKNOWN)
+	{
+		READSHM(conf->channelNumber, arlan->channelNumber, u_char);
+	}
+	else conf->channelNumber = channelNumber;
+	
+	READSHM(conf->scramblingDisable, arlan->scramblingDisable, u_char);
+	READSHM(conf->txAttenuation, arlan->txAttenuation, u_char);
+	
+	if (systemId == systemIdUNKNOWN)
+	{
+		READSHM(conf->systemId, arlan->systemId, u_int);
+	} 
+	else conf->systemId = systemId;
+	
+	READSHM(conf->maxDatagramSize, arlan->maxDatagramSize, u_short);
+	READSHM(conf->maxFrameSize, arlan->maxFrameSize, u_short);
+	READSHM(conf->maxRetries, arlan->maxRetries, u_char);
+	READSHM(conf->receiveMode, arlan->receiveMode, u_char);
+	READSHM(conf->priority, arlan->priority, u_char);
+	READSHM(conf->rootOrRepeater, arlan->rootOrRepeater, u_char);
+
+	if (SID == SIDUNKNOWN)
+	{
+		  READSHM(conf->SID, arlan->SID, u_int);
+	}
+	else conf->SID = SID;
+	
+	if (registrationMode == registrationModeUNKNOWN)
+	{
+		  READSHM(conf->registrationMode, arlan->registrationMode, u_char);
+	}
+	else conf->registrationMode = registrationMode;
+	
+	READSHM(conf->registrationFill, arlan->registrationFill, u_char);
+	READSHM(conf->localTalkAddress, arlan->localTalkAddress, u_char);
+	READSHM(conf->codeFormat, arlan->codeFormat, u_char);
+	READSHM(conf->numChannels, arlan->numChannels, u_char);
+	READSHM(conf->channel1, arlan->channel1, u_char);
+	READSHM(conf->channel2, arlan->channel2, u_char);
+	READSHM(conf->channel3, arlan->channel3, u_char);
+	READSHM(conf->channel4, arlan->channel4, u_char);
+	READSHM(conf->waitTime, arlan->waitTime, u_short);
+	READSHM(conf->lParameter, arlan->lParameter, u_short);
+	READSHM(conf->_15, arlan->_15, u_short);
+	READSHM(conf->headerSize, arlan->headerSize, u_short);
+	READSHM(conf->hardwareType, arlan->hardwareType, u_char);
+	READSHM(conf->radioType, arlan->radioModule, u_char);
+	
+	if (conf->radioType == 0)
+		conf->radioType = 0xc;
+
+	WRITESHM(arlan->configStatus, 0xA5, u_char);
+	READSHM(tlx415, arlan->configStatus, u_char);
+	
+	if (tlx415 != 0xA5)
+		printk(KERN_INFO "%s tlx415 chip \n", dev->name);
+	
+	conf->txClear = 0;
+	conf->txRetries = 1;
+	conf->txRouting = 1;
+	conf->txScrambled = 0;
+	conf->rxParameter = 1;
+	conf->txTimeoutMs = 4000;
+	conf->waitCardTimeout = 100000;
+	conf->receiveMode = ARLAN_RCV_CLEAN;
+	memcpy_fromio(conf->siteName, arlan->name, 16);
+	conf->siteName[16] = '\0';
+	conf->retries = retries;
+	conf->tx_delay_ms = tx_delay_ms;
+	conf->async = async;
+	conf->ReTransmitPacketMaxSize = 200;
+	conf->waitReTransmitPacketMaxSize = 200;
+	conf->txAckTimeoutMs = 900;
+	conf->fastReTransCount = 3;
+
+	ARLAN_DEBUG_EXIT("arlan_read_card_configuration");
+
+	return 0;
+}
+
+
+static int lastFoundAt = 0xbe000;
+
+
+/*
+ * This is the real probe routine. Linux has a history of friendly device
+ * probes on the ISA bus. A good device probes avoids doing writes, and
+ * verifies that the correct device exists and functions.
+ */
+
+static int __init arlan_check_fingerprint(int memaddr)
+{
+	static char probeText[] = "TELESYSTEM SLW INC.    ARLAN \0";
+	char tempBuf[49];
+	volatile struct arlan_shmem *arlan = (struct arlan_shmem *) memaddr;
+
+	ARLAN_DEBUG_ENTRY("arlan_check_fingerprint");
+	if (check_mem_region(virt_to_phys((void *)memaddr),0x2000 )){
+		// printk(KERN_WARNING "arlan: memory region %lx excluded from probing \n",virt_to_phys((void*)memaddr));
+		return -ENODEV;
+	};
+	memcpy_fromio(tempBuf, arlan->textRegion, 29);
+	tempBuf[30] = 0;
+
+	/* check for card at this address */
+	if (0 != strncmp(tempBuf, probeText, 29)){
+// not 		release_mem_region(virt_to_phys((void*)memaddr),0x2000);
+		return -ENODEV;
+	}
+
+//   printk(KERN_INFO "arlan found at 0x%x \n",memaddr);
+	ARLAN_DEBUG_EXIT("arlan_check_fingerprint");
+
+	return 0;
+
+
+}
+
+static int __init arlan_probe_everywhere(struct net_device *dev)
+{
+	int m;
+	int probed = 0;
+	int found = 0;
+
+	SET_MODULE_OWNER(dev);
+
+	ARLAN_DEBUG_ENTRY("arlan_probe_everywhere");
+	if (mem != 0 && numDevices == 1)	/* Check a single specified location. */
+	{
+		if (arlan_probe_here(dev, (int) phys_to_virt(  mem) ) == 0)
+			return 0;
+		else
+			return -ENODEV;
+	}
+	for (m = (int)phys_to_virt(lastFoundAt) + 0x2000; m <= (int)phys_to_virt(0xDE000); m += 0x2000)
+	{
+		if (arlan_probe_here(dev, m) == 0)
+		{
+			found++;
+			lastFoundAt = (int)virt_to_phys((void*)m);
+			break;
+		}
+		probed++;
+	}
+	if (found == 0 && probed != 0)
+	{
+		if (lastFoundAt == 0xbe000)
+			printk(KERN_ERR "arlan: No Arlan devices found \n");
+		return -ENODEV;
+	}
+	else
+		return 0;
+
+	ARLAN_DEBUG_EXIT("arlan_probe_everywhere");
+
+	return -ENODEV;
+}
+
+
+static int arlan_change_mtu(struct net_device *dev, int new_mtu)
+{
+	struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf;
+
+	ARLAN_DEBUG_ENTRY("arlan_change_mtu");
+	if (new_mtu > 2032)
+		return -EINVAL;
+	dev->mtu = new_mtu;
+	if (new_mtu < 256)
+		new_mtu = 256;	/* cards book suggests 1600 */
+	conf->maxDatagramSize = new_mtu;
+	conf->maxFrameSize = new_mtu + 48;
+
+	arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_CONF);
+	printk(KERN_NOTICE "%s mtu changed to %d \n", dev->name, new_mtu);
+
+	ARLAN_DEBUG_EXIT("arlan_change_mtu");
+
+	return 0;
+}
+
+static int arlan_mac_addr(struct net_device *dev, void *p)
+{
+	struct sockaddr *addr = p;
+
+
+	ARLAN_DEBUG_ENTRY("arlan_mac_addr");
+	return -EINVAL;
+
+	if (!netif_running(dev))
+		return -EBUSY;
+	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+
+	ARLAN_DEBUG_EXIT("arlan_mac_addr");
+	return 0;
+}
+
+
+
+
+static int __init
+	      arlan_allocate_device(int num, struct net_device *devs)
+{
+
+	struct net_device *dev;
+	struct arlan_private *ap;
+
+	ARLAN_DEBUG_ENTRY("arlan_allocate_device");
+
+	if (!devs) {
+		dev = init_etherdev(0, sizeof(struct arlan_private) + sizeof(struct arlan_shmem));
+		if (!dev) {
+			printk(KERN_ERR "ARLAN: init_etherdev failed\n");
+			return 0;
+		}
+		ap = dev->priv;
+		ap->conf = dev->priv + sizeof(struct arlan_private);
+		ap->init_etherdev_alloc = 1;
+	} else {
+		dev = devs;
+		dev->priv = kmalloc(sizeof(struct arlan_private) + sizeof(struct arlan_shmem), GFP_KERNEL);
+		if (!dev->priv) {
+			printk(KERN_ERR "ARLAN: kmalloc of dev->priv failed\n");
+			return 0;
+		}
+		ap = dev->priv;
+		ap->conf = dev->priv + sizeof(struct arlan_private);
+		memset(ap, 0, sizeof(*ap));
+	}
+
+	/* Fill in the 'dev' fields. */
+	dev->base_addr = 0;
+	dev->mem_start = 0;
+	dev->mem_end = 0;
+	dev->mtu = 1500;
+	dev->flags = 0;		/* IFF_BROADCAST & IFF_MULTICAST & IFF_PROMISC; */
+	dev->irq = 0;
+	dev->dma = 0;
+	dev->tx_queue_len = tx_queue_len;
+	ether_setup(dev);
+	dev->tx_queue_len = tx_queue_len;
+	dev->open = arlan_open;
+	dev->stop = arlan_close;
+	dev->hard_start_xmit = arlan_tx;
+	dev->get_stats = arlan_statistics;
+	dev->set_multicast_list = arlan_set_multicast;
+	dev->change_mtu = arlan_change_mtu;
+	dev->set_mac_address = arlan_mac_addr;
+	dev->tx_timeout = arlan_tx_timeout;
+	dev->watchdog_timeo = 3*HZ;
+	
+	((struct arlan_private *) dev->priv)->irq_test_done = 0;
+	arlan_device[num] = dev;
+	((struct arlan_private *) arlan_device[num]->priv)->Conf = &(arlan_conf[num]);
+
+	((struct arlan_private *) dev->priv)->Conf->pre_Command_Wait = 40;
+	((struct arlan_private *) dev->priv)->Conf->rx_tweak1 = 30;
+	((struct arlan_private *) dev->priv)->Conf->rx_tweak2 = 0;
+
+	ARLAN_DEBUG_EXIT("arlan_allocate_device");
+	return (int) dev;
+}
+
+
+static int __init arlan_probe_here(struct net_device *dev, int memaddr)
+{
+	volatile struct arlan_shmem *arlan;
+
+	ARLAN_DEBUG_ENTRY("arlan_probe_here");
+
+	if (arlan_check_fingerprint(memaddr))
+		return -ENODEV;
+
+	printk(KERN_NOTICE "%s: Arlan found at %x, \n ", dev->name, (int) virt_to_phys((void*)memaddr));
+
+	if (!arlan_allocate_device(arlans_found, dev))
+		return -1;
+
+	((struct arlan_private *) dev->priv)->card = (struct arlan_shmem *) memaddr;
+	arlan = (void *) memaddr;
+
+	dev->mem_start = memaddr;
+	dev->mem_end = memaddr + 0x1FFF;
+
+	if (dev->irq < 2)
+	{
+		READSHM(dev->irq, arlan->irqLevel, u_char);
+	} else if (dev->irq == 2)
+		dev->irq = 9;
+
+	arlan_read_card_configuration(dev);
+
+	ARLAN_DEBUG_EXIT("arlan_probe_here");
+	return 0;
+}
+
+
+
+
+static int arlan_open(struct net_device *dev)
+{
+	struct arlan_private *priv = (struct arlan_private *) dev->priv;
+	volatile struct arlan_shmem *arlan = priv->card;
+	int ret = 0;
+
+	ARLAN_DEBUG_ENTRY("arlan_open");
+
+	if (dev->mem_start == 0)
+		ret = arlan_probe_everywhere(dev);
+	if (ret != 0)
+		return ret;
+
+	arlan = ((struct arlan_private *) dev->priv)->card;
+	ret = request_irq(dev->irq, &arlan_interrupt, 0, dev->name, dev);
+	if (ret)
+	{
+		printk(KERN_ERR "%s: unable to get IRQ %d .\n",
+			dev->name, dev->irq);
+		return ret;
+	}
+
+
+	priv->bad = 0;
+	priv->lastReset = 0;
+	priv->reset = 0;
+	priv->open_time = jiffies;
+	memcpy_fromio(dev->dev_addr, arlan->lanCardNodeId, 6);
+	memset(dev->broadcast, 0xff, 6);
+	priv->txOffset = 0;
+	dev->tx_queue_len = tx_queue_len;
+	priv->interrupt_processing_active = 0;
+	priv->command_lock = 0;
+
+	netif_start_queue (dev);
+
+	init_MUTEX(&priv->card_lock);
+	myATOMIC_INIT(priv->card_users, 1);	/* damn 2.0.33 */
+	priv->registrationLostCount = 0;
+	priv->registrationLastSeen = jiffies;
+	priv->txLast = 0;
+	priv->tx_command_given = 0;
+	priv->rx_command_given = 0;
+	
+	priv->reRegisterExp = 1;
+	priv->nof_tx = 0;
+	priv->nof_tx_ack = 0;
+	priv->last_command_was_rx = 0;
+	priv->tx_last_sent = jiffies - 1;
+	priv->tx_last_cleared = jiffies;
+	priv->Conf->writeEEPROM = 0;
+	priv->Conf->registrationInterrupts = 1;
+
+	init_timer(&priv->timer);
+	priv->timer.expires = jiffies + HZ / 10;
+	priv->timer.data = (unsigned long) dev;
+	priv->timer.function = &arlan_registration_timer;	/* timer handler */
+
+	arlan_command(dev, ARLAN_COMMAND_POWERUP | ARLAN_COMMAND_LONG_WAIT_NOW);
+	mdelay(200);
+	add_timer(&priv->timer);
+
+#ifdef CONFIG_PROC_FS
+#ifndef MODULE
+	if (arlan_device[0])
+		init_arlan_proc();
+#endif
+#endif
+	ARLAN_DEBUG_EXIT("arlan_open");
+	return 0;
+}
+
+
+static void arlan_tx_timeout (struct net_device *dev)
+{
+	printk(KERN_ERR "%s: arlan transmit timed out, kernel decided\n", dev->name);
+	/* Try to restart the adaptor. */
+	arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET);
+	// dev->trans_start = jiffies;
+	// netif_start_queue (dev);
+}
+
+
+static int arlan_tx(struct sk_buff *skb, struct net_device *dev)
+{
+	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
+	short length;
+	unsigned char *buf;
+
+	ARLAN_DEBUG_ENTRY("arlan_tx");
+	
+	length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
+	buf = skb->data;
+
+	if (priv->txOffset + length + 0x12 > 0x800) {
+		printk(KERN_ERR "TX RING overflow \n");
+		netif_stop_queue (dev);
+	}
+
+	if (arlan_hw_tx(dev, buf, length) == -1)
+		goto bad_end;
+
+	dev->trans_start = jiffies;
+
+	dev_kfree_skb(skb);
+
+	arlan_process_interrupt(dev);
+	priv->tx_chain_active = 0;
+	ARLAN_DEBUG_EXIT("arlan_tx");
+	return 0;
+
+bad_end:
+	arlan_process_interrupt(dev);
+	priv->tx_chain_active = 0;
+	netif_stop_queue (dev);
+	ARLAN_DEBUG_EXIT("arlan_tx");
+	return 1;
+}
+
+
+static inline int DoNotReTransmitCrap(struct net_device *dev)
+{
+	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
+
+	if (TXLAST(dev).length < priv->Conf->ReTransmitPacketMaxSize)
+		return 1;
+	return 0;
+
+}
+
+static inline int DoNotWaitReTransmitCrap(struct net_device *dev)
+{
+	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
+
+	if (TXLAST(dev).length < priv->Conf->waitReTransmitPacketMaxSize)
+		return 1;
+	return 0;
+}
+
+static inline void arlan_queue_retransmit(struct net_device *dev)
+{
+	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
+
+	ARLAN_DEBUG_ENTRY("arlan_queue_retransmit");
+
+	if (DoNotWaitReTransmitCrap(dev))
+	{
+		  arlan_drop_tx(dev);
+	} else
+		priv->ReTransmitRequested++;
+
+	ARLAN_DEBUG_EXIT("arlan_queue_retransmit");
+};
+
+static inline void RetryOrFail(struct net_device *dev)
+{
+	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
+
+	ARLAN_DEBUG_ENTRY("RetryOrFail");
+
+	if (priv->retransmissions > priv->Conf->retries ||
+	    DoNotReTransmitCrap(dev))
+	{
+		arlan_drop_tx(dev);
+	}
+	else if (priv->bad <= priv->Conf->fastReTransCount)
+	{
+		arlan_retransmit_now(dev);
+	}
+	else arlan_queue_retransmit(dev);
+
+	ARLAN_DEBUG_EXIT("RetryOrFail");
+}
+
+
+static void arlan_tx_done_interrupt(struct net_device *dev, int status)
+{
+	struct arlan_private *priv = ((struct arlan_private *) dev->priv);
+
+	ARLAN_DEBUG_ENTRY("arlan_tx_done_interrupt");
+
+	priv->tx_last_cleared = jiffies;
+	priv->tx_command_given = 0;
+	priv->nof_tx_ack++;
+	switch (status)
+	{
+		case 1:
+		{
+			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
+				printk("arlan intr: transmit OK\n");
+			priv->stats.tx_packets++;
+			priv->bad = 0;
+			priv->reset = 0;
+			priv->retransmissions = 0;
+			if (priv->Conf->tx_delay_ms)
+			{
+				priv->tx_done_delayed = jiffies + (priv->Conf->tx_delay_ms * HZ) / 1000 + 1;;
+			}
+			else
+			{
+				TXLAST(dev).offset = 0;
+				if (priv->txLast)
+					priv->txLast = 0;
+				else if (TXTAIL(dev).offset)
+					priv->txLast = 1;
+				if (TXLAST(dev).offset)
+				{
+					arlan_retransmit_now(dev);
+					dev->trans_start = jiffies;
+				}
+				if (!TXHEAD(dev).offset || !TXTAIL(dev).offset)
+				{
+					priv->txOffset = 0;
+					netif_wake_queue (dev);
+				}
+			}
+		}
+		break;
+		
+		case 2:
+		{
+			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
+				printk("arlan intr: transmit timed out\n");
+			priv->bad += 1;
+			//arlan_queue_retransmit(dev);
+			RetryOrFail(dev);
+		}
+		break;
+
+		case 3:
+		{
+			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
+				printk("arlan intr: transmit max retries\n");
+			priv->bad += 1;
+			priv->reset = 0;
+			//arlan_queue_retransmit(dev);
+			RetryOrFail(dev);
+		}
+		break;
+		
+		case 4:
+		{
+			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
+				printk("arlan intr: transmit aborted\n");
+			priv->bad += 1;
+			arlan_queue_retransmit(dev);
+			//RetryOrFail(dev);
+		}
+		break;
+
+		case 5:
+		{
+			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
+				printk("arlan intr: transmit not registered\n");
+			priv->bad += 1;
+			//debug=101;
+			arlan_queue_retransmit(dev);
+		}
+		break;
+
+		case 6:
+		{
+			IFDEBUG(ARLAN_DEBUG_TX_CHAIN) 
+				printk("arlan intr: transmit destination full\n");
+			priv->bad += 1;
+			priv->reset = 0;
+			//arlan_drop_tx(dev);
+			arlan_queue_retransmit(dev);
+		}
+		break;
+
+		case 7:
+		{
+			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
+				printk("arlan intr: transmit unknown ack\n");
+			priv->bad += 1;
+			priv->reset = 0;
+			arlan_queue_retransmit(dev);
+		}
+		break;
+		
+		case 8:
+		{
+			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
+				printk("arlan intr: transmit dest mail box full\n");
+			priv->bad += 1;
+			priv->reset = 0;
+			//arlan_drop_tx(dev);
+			arlan_queue_retransmit(dev);
+		}
+		break;
+
+		case 9:
+		{
+			IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
+				printk("arlan intr: transmit root dest not reg.\n");
+			priv->bad += 1;
+			priv->reset = 1;
+			//arlan_drop_tx(dev);
+			arlan_queue_retransmit(dev);
+		}
+		break;
+
+		default:
+		{
+			printk(KERN_ERR "arlan intr: transmit status unknown\n");
+			priv->bad += 1;
+			priv->reset = 1;
+			arlan_drop_tx(dev);
+		}
+	}
+
+	ARLAN_DEBUG_EXIT("arlan_tx_done_interrupt");
+}
+
+
+static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short rxOffset, u_short pkt_len)
+{
+	char *skbtmp;
+	int i = 0;
+
+	struct arlan_private *priv = (struct arlan_private *) dev->priv;
+	volatile struct arlan_shmem *arlan = priv->card;
+	struct arlan_conf_stru *conf = priv->Conf;
+
+
+	ARLAN_DEBUG_ENTRY("arlan_rx_interrupt");
+	// by spec,   not                WRITESHMB(arlan->rxStatus,0x00);
+	// prohibited here              arlan_command(dev, ARLAN_COMMAND_RX);
+
+	if (pkt_len < 10 || pkt_len > 2048)
+	{
+		printk(KERN_WARNING "%s: got too short or long packet, len %d \n", dev->name, pkt_len);
+		return;
+	}
+	if (rxOffset + pkt_len > 0x2000)
+	{
+		printk("%s: got too long packet, len %d offset %x\n", dev->name, pkt_len, rxOffset);
+		return;
+	}
+	priv->in_bytes += pkt_len;
+	priv->in_bytes10 += pkt_len;
+	if (conf->measure_rate < 1)
+		conf->measure_rate = 1;
+	if (jiffies - priv->in_time > conf->measure_rate * HZ)
+	{
+		conf->in_speed = priv->in_bytes / conf->measure_rate;
+		priv->in_bytes = 0;
+		priv->in_time = jiffies;
+	}
+	if (jiffies - priv->in_time10 > conf->measure_rate * HZ * 10)
+	{
+		conf->in_speed10 = priv->in_bytes10 / (10 * conf->measure_rate);
+		priv->in_bytes10 = 0;
+		priv->in_time10 = jiffies;
+	}
+	DEBUGSHM(1, "arlan rcv pkt rxStatus= %d ", arlan->rxStatus, u_char);
+	switch (rxStatus)
+	{
+		case 1:
+		case 2:
+		case 3:
+		{
+			/* Malloc up new buffer. */
+			struct sk_buff *skb;
+
+			DEBUGSHM(50, "arlan recv pkt offs=%d\n", arlan->rxOffset, u_short);
+			DEBUGSHM(1, "arlan rxFrmType = %d \n", arlan->rxFrmType, u_char);
+			DEBUGSHM(1, KERN_INFO "arlan rx scrambled = %d \n", arlan->scrambled, u_char);
+
+			/* here we do multicast filtering to avoid slow 8-bit memcopy */
+#ifdef ARLAN_MULTICAST
+			if (!(dev->flags & IFF_ALLMULTI) &&
+				!(dev->flags & IFF_PROMISC) &&
+				dev->mc_list)
+			{
+				char hw_dst_addr[6];
+				struct dev_mc_list *dmi = dev->mc_list;
+				int i;
+
+				memcpy_fromio(hw_dst_addr, arlan->ultimateDestAddress, 6);
+				if (hw_dst_addr[0] == 0x01)
+				{
+					if (mdebug)
+						if (hw_dst_addr[1] == 0x00)
+							printk(KERN_ERR "%s mcast 0x0100 \n", dev->name);
+						else if (hw_dst_addr[1] == 0x40)
+							printk(KERN_ERR "%s m/bcast 0x0140 \n", dev->name);
+					while (dmi)
+					{							if (dmi->dmi_addrlen == 6)
+						{
+							if (arlan_debug & ARLAN_DEBUG_HEADER_DUMP)
+								printk(KERN_ERR "%s mcl %2x:%2x:%2x:%2x:%2x:%2x \n", dev->name,
+										 dmi->dmi_addr[0], dmi->dmi_addr[1], dmi->dmi_addr[2],
+										 dmi->dmi_addr[3], dmi->dmi_addr[4], dmi->dmi_addr[5]);
+							for (i = 0; i < 6; i++)
+								if (dmi->dmi_addr[i] != hw_dst_addr[i])
+									break;
+							if (i == 6)
+								break;
+						}
+						else
+							printk(KERN_ERR "%s: invalid multicast address length given.\n", dev->name);
+						dmi = dmi->next;
+					}
+					/* we reach here if multicast filtering is on and packet 
+					 * is multicast and not for receive */
+					goto end_of_interrupt;
+				}
+			}
+#endif				// ARLAN_MULTICAST
+			/* multicast filtering ends here */
+			pkt_len += ARLAN_FAKE_HDR_LEN;
+
+			skb = dev_alloc_skb(pkt_len + 4);
+			if (skb == NULL)
+			{
+				printk(KERN_ERR "%s: Memory squeeze, dropping packet.\n", dev->name);
+				priv->stats.rx_dropped++;
+				break;
+			}
+			skb_reserve(skb, 2);
+			skb->dev = dev;
+			skbtmp = skb_put(skb, pkt_len);
+
+			memcpy_fromio(skbtmp + ARLAN_FAKE_HDR_LEN, ((char *) arlan) + rxOffset, pkt_len - ARLAN_FAKE_HDR_LEN);
+			memcpy_fromio(skbtmp, arlan->ultimateDestAddress, 6);
+			memcpy_fromio(skbtmp + 6, arlan->rxSrc, 6);
+			WRITESHMB(arlan->rxStatus, 0x00);
+			arlan_command(dev, ARLAN_COMMAND_RX);
+
+			IFDEBUG(ARLAN_DEBUG_HEADER_DUMP)
+			{
+				char immedDestAddress[6];
+				char immedSrcAddress[6];
+				memcpy_fromio(immedDestAddress, arlan->immedDestAddress, 6);
+				memcpy_fromio(immedSrcAddress, arlan->immedSrcAddress, 6);
+
+				printk(KERN_WARNING "%s t %2x:%2x:%2x:%2x:%2x:%2x f %2x:%2x:%2x:%2x:%2x:%2x imd %2x:%2x:%2x:%2x:%2x:%2x ims %2x:%2x:%2x:%2x:%2x:%2x\n", dev->name,
+					(unsigned char) skbtmp[0], (unsigned char) skbtmp[1], (unsigned char) skbtmp[2], (unsigned char) skbtmp[3],
+					(unsigned char) skbtmp[4], (unsigned char) skbtmp[5], (unsigned char) skbtmp[6], (unsigned char) skbtmp[7],
+					(unsigned char) skbtmp[8], (unsigned char) skbtmp[9], (unsigned char) skbtmp[10], (unsigned char) skbtmp[11],
+					immedDestAddress[0], immedDestAddress[1], immedDestAddress[2],
+					immedDestAddress[3], immedDestAddress[4], immedDestAddress[5],
+					immedSrcAddress[0], immedSrcAddress[1], immedSrcAddress[2],
+					immedSrcAddress[3], immedSrcAddress[4], immedSrcAddress[5]);
+			}
+			skb->protocol = eth_type_trans(skb, dev);
+			IFDEBUG(ARLAN_DEBUG_HEADER_DUMP)
+				if (skb->protocol != 0x608 && skb->protocol != 0x8)
+				{
+					for (i = 0; i <= 22; i++)
+						printk("%02x:", (u_char) skbtmp[i + 12]);
+					printk(KERN_ERR "\n");
+					printk(KERN_WARNING "arlan kernel pkt type trans %x \n", skb->protocol);
+				}
+			netif_rx(skb);
+			dev->last_rx = jiffies;
+			priv->stats.rx_packets++;
+			priv->stats.rx_bytes += pkt_len;
+		}
+		break;
+		
+		default:
+			printk(KERN_ERR "arlan intr: received unknown status\n");
+			priv->stats.rx_crc_errors++;
+			break;
+	}
+	ARLAN_DEBUG_EXIT("arlan_rx_interrupt");
+}
+
+static void arlan_process_interrupt(struct net_device *dev)
+{
+	struct arlan_private *priv = (struct arlan_private *) dev->priv;
+	volatile struct arlan_shmem *arlan = priv->card;
+	u_char rxStatus = READSHMB(arlan->rxStatus);
+	u_char txStatus = READSHMB(arlan->txStatus);
+	u_short rxOffset = READSHMS(arlan->rxOffset);
+	u_short pkt_len = READSHMS(arlan->rxLength);
+	int interrupt_count = 0;
+
+	ARLAN_DEBUG_ENTRY("arlan_process_interrupt");
+
+	if (test_and_set_bit(0, (void *) &priv->interrupt_processing_active))
+	{
+		if (arlan_debug & ARLAN_DEBUG_CHAIN_LOCKS)
+			printk(KERN_ERR "interrupt chain reentering \n");
+		goto end_int_process;
+	}
+	while ((rxStatus || txStatus || priv->interrupt_ack_requested)
+			&& (interrupt_count < 5))
+	{
+		if (rxStatus)
+			priv->last_rx_int_ack_time = arlan_time();
+
+		arlan_command(dev, ARLAN_COMMAND_INT_ACK);
+		arlan_command(dev, ARLAN_COMMAND_INT_ENABLE);
+		
+		IFDEBUG(ARLAN_DEBUG_INTERRUPT)
+			printk(KERN_ERR "%s:  got IRQ rx %x tx %x comm %x rxOff %x rxLen %x \n",
+					dev->name, rxStatus, txStatus, READSHMB(arlan->commandByte),
+					rxOffset, pkt_len);
+
+		if (rxStatus == 0 && txStatus == 0)
+		{
+			priv->last_command_was_rx = 0;
+			if (priv->irq_test_done)
+			{
+				if (!registrationBad(dev))
+					IFDEBUG(ARLAN_DEBUG_INTERRUPT) printk(KERN_ERR "%s unknown interrupt(nop? regLost ?) reason tx %d rx %d ",
+										    dev->name, txStatus, rxStatus);
+			} else {
+				IFDEBUG(ARLAN_DEBUG_INTERRUPT)
+					printk(KERN_INFO "%s irq $%d test OK \n", dev->name, dev->irq);
+
+			}
+			priv->interrupt_ack_requested = 0;
+			goto ends;
+		}
+		if (txStatus != 0)
+		{
+			WRITESHMB(arlan->txStatus, 0x00);
+			arlan_tx_done_interrupt(dev, txStatus);
+			goto ends;
+		}
+		if (rxStatus == 1 || rxStatus == 2)
+		{		/* a packet waiting */
+			arlan_rx_interrupt(dev, rxStatus, rxOffset, pkt_len);
+			goto ends;
+		}
+		if (rxStatus > 2 && rxStatus < 0xff)
+		{
+			priv->last_command_was_rx = 0;
+			WRITESHMB(arlan->rxStatus, 0x00);
+			printk(KERN_ERR "%s unknown rxStatus reason tx %d rx %d ",
+				dev->name, txStatus, rxStatus);
+			goto ends;
+		}
+		if (rxStatus == 0xff)
+		{
+			priv->last_command_was_rx = 0;
+			WRITESHMB(arlan->rxStatus, 0x00);
+			arlan_command(dev, ARLAN_COMMAND_RX);
+			if (registrationBad(dev))
+				netif_device_detach(dev);
+			if (!registrationBad(dev))
+			{
+				priv->registrationLastSeen = jiffies;
+				if (!netif_queue_stopped(dev) && !priv->under_reset && !priv->under_config)
+					netif_wake_queue (dev);
+			}
+			goto ends;
+		}
+ends:
+
+		arlan_command_process(dev);
+
+		rxStatus = READSHMB(arlan->rxStatus);
+		txStatus = READSHMB(arlan->txStatus);
+		rxOffset = READSHMS(arlan->rxOffset);
+		pkt_len = READSHMS(arlan->rxLength);
+
+
+		priv->irq_test_done = 1;
+
+		interrupt_count++;
+	}
+	priv->interrupt_processing_active = 0;
+
+end_int_process:
+	arlan_command_process(dev);
+
+	ARLAN_DEBUG_EXIT("arlan_process_interrupt");
+	return;
+}
+
+static void arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+	struct net_device *dev = dev_id;
+	struct arlan_private *priv = (struct arlan_private *) dev->priv;
+	volatile struct arlan_shmem *arlan = priv->card;
+	u_char rxStatus = READSHMB(arlan->rxStatus);
+	u_char txStatus = READSHMB(arlan->txStatus);
+
+	ARLAN_DEBUG_ENTRY("arlan_interrupt");
+
+
+	if (!rxStatus && !txStatus)
+		priv->interrupt_ack_requested++;
+
+	arlan_process_interrupt(dev);
+	
+	priv->irq_test_done = 1;
+
+	ARLAN_DEBUG_EXIT("arlan_interrupt");
+	return;
+
+}
+
+
+static int arlan_close(struct net_device *dev)
+{
+	struct arlan_private *priv = (struct arlan_private *) dev->priv;
+
+	if (!dev)
+	{
+		printk(KERN_CRIT "arlan: No Device\n");
+		return 0;
+	}
+	priv = (struct arlan_private *) dev->priv;
+	if (!priv)
+	{
+		printk(KERN_CRIT "arlan: No Device priv \n");
+		return 0;
+	}
+	ARLAN_DEBUG_ENTRY("arlan_close");
+
+	del_timer(&priv->timer);
+
+	arlan_command(dev, ARLAN_COMMAND_POWERDOWN);
+
+	IFDEBUG(ARLAN_DEBUG_STARTUP)
+		printk(KERN_NOTICE "%s: Closing device\n", dev->name);
+
+	priv->open_time = 0;
+	netif_stop_queue(dev);
+	free_irq(dev->irq, dev);
+
+	ARLAN_DEBUG_EXIT("arlan_close");
+	return 0;
+}
+
+#ifdef ARLAN_DEBUGGING
+static long alignLong(volatile u_char * ptr)
+{
+	long ret;
+	memcpy_fromio(&ret, (void *) ptr, 4);
+	return ret;
+}
+#endif
+
+/*
+ * Get the current statistics.
+ * This may be called with the card open or closed.
+ */
+
+static struct net_device_stats *arlan_statistics(struct net_device *dev)
+{
+	struct arlan_private *priv = (struct arlan_private *) dev->priv;
+	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
+
+
+	ARLAN_DEBUG_ENTRY("arlan_statistics");
+
+	/* Update the statistics from the device registers. */
+
+	READSHM(priv->stats.collisions, arlan->numReTransmissions, u_int);
+	READSHM(priv->stats.rx_crc_errors, arlan->numCRCErrors, u_int);
+	READSHM(priv->stats.rx_dropped, arlan->numFramesDiscarded, u_int);
+	READSHM(priv->stats.rx_fifo_errors, arlan->numRXBufferOverflows, u_int);
+	READSHM(priv->stats.rx_frame_errors, arlan->numReceiveFramesLost, u_int);
+	READSHM(priv->stats.rx_over_errors, arlan->numRXOverruns, u_int);
+	READSHM(priv->stats.rx_packets, arlan->numDatagramsReceived, u_int);
+	READSHM(priv->stats.tx_aborted_errors, arlan->numAbortErrors, u_int);
+	READSHM(priv->stats.tx_carrier_errors, arlan->numStatusTimeouts, u_int);
+	READSHM(priv->stats.tx_dropped, arlan->numDatagramsDiscarded, u_int);
+	READSHM(priv->stats.tx_fifo_errors, arlan->numTXUnderruns, u_int);
+	READSHM(priv->stats.tx_packets, arlan->numDatagramsTransmitted, u_int);
+	READSHM(priv->stats.tx_window_errors, arlan->numHoldOffs, u_int);
+
+	ARLAN_DEBUG_EXIT("arlan_statistics");
+
+	return &priv->stats;
+}
+
+
+static void arlan_set_multicast(struct net_device *dev)
+{
+	volatile struct arlan_shmem *arlan = ((struct arlan_private *) dev->priv)->card;
+	struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf;
+	int board_conf_needed = 0;
+
+
+	ARLAN_DEBUG_ENTRY("arlan_set_multicast");
+
+	if (dev->flags & IFF_PROMISC)
+	{
+		unsigned char recMode;
+		READSHM(recMode, arlan->receiveMode, u_char);
+		conf->receiveMode = (ARLAN_RCV_PROMISC | ARLAN_RCV_CONTROL);
+		if (conf->receiveMode != recMode)
+			board_conf_needed = 1;
+	}
+	else
+	{
+		/* turn off promiscuous mode  */
+		unsigned char recMode;
+		READSHM(recMode, arlan->receiveMode, u_char);
+		conf->receiveMode = ARLAN_RCV_CLEAN | ARLAN_RCV_CONTROL;
+		if (conf->receiveMode != recMode)
+			board_conf_needed = 1;
+	}
+	if (board_conf_needed)
+		arlan_command(dev, ARLAN_COMMAND_CONF);
+
+	ARLAN_DEBUG_EXIT("arlan_set_multicast");
+}
+
+
+int __init arlan_probe(struct net_device *dev)
+{
+	printk("Arlan driver %s\n", arlan_version);
+
+	if (arlan_probe_everywhere(dev))
+		return -ENODEV;
+
+	arlans_found++;
+
+	if (arlans_found == 1)
+		siteName = kmalloc(100, GFP_KERNEL);
+	return 0;
+}
+
+#ifdef  MODULE
+
+static int __init arlan_find_devices(void)
+{
+	int m;
+	int found = 0;
+
+	ARLAN_DEBUG_ENTRY("arlan_find_devices");
+	if (mem != 0 && numDevices == 1)	/* Check a single specified location. */
+		return 1;
+	for (m =(int) phys_to_virt(0xc0000); m <=(int) phys_to_virt(0xDE000); m += 0x2000)
+	{
+		if (arlan_check_fingerprint(m) == 0)
+			found++;
+	}
+	ARLAN_DEBUG_EXIT("arlan_find_devices");
+
+	return found;
+}
+
+int init_module(void)
+{
+	int i = 0;
+
+	ARLAN_DEBUG_ENTRY("init_module");
+
+	if (channelSet != channelSetUNKNOWN || channelNumber != channelNumberUNKNOWN || systemId != systemIdUNKNOWN)
+		return -EINVAL;
+
+	numDevices = arlan_find_devices();
+	if (numDevices == 0)
+		return -ENODEV;
+
+	siteName = kmalloc(100, GFP_KERNEL);
+	if(siteName==NULL)
+		return -ENOMEM;
+
+	for (i = 0; i < numDevices && i < MAX_ARLANS; i++)
+	{
+		if (!arlan_allocate_device(i, NULL))
+			return -ENOMEM;
+
+		if (arlan_device[i] == NULL)
+			return -ENOMEM;
+
+		if (probe)
+			arlan_probe_everywhere(arlan_device[i]);
+//		arlan_command(arlan_device[i], ARLAN_COMMAND_POWERDOWN );
+	}
+	printk(KERN_INFO "Arlan driver %s\n", arlan_version);
+	ARLAN_DEBUG_EXIT("init_module");
+	return 0;
+}
+
+
+void cleanup_module(void)
+{
+	int i = 0;
+	struct arlan_private *ap;
+
+	ARLAN_DEBUG_ENTRY("cleanup_module");
+
+	IFDEBUG(ARLAN_DEBUG_SHUTDOWN)
+		printk(KERN_INFO "arlan: unloading module\n");
+	for (i = 0; i < MAX_ARLANS; i++)
+	{
+		if (arlan_device[i])
+		{
+			arlan_command(arlan_device[i], ARLAN_COMMAND_POWERDOWN );
+
+//			release_mem_region(virt_to_phys(arlan_device[i]->mem_start), 0x2000 );
+			unregister_netdev(arlan_device[i]);
+			ap = arlan_device[i]->priv;
+			if (ap->init_etherdev_alloc) {
+				kfree(arlan_device[i]);
+				arlan_device[i] = NULL;
+			} else {
+				kfree(ap);
+				ap = NULL;
+			}
+		}
+	}
+	ARLAN_DEBUG_EXIT("cleanup_module");
+}
+
+
+#endif
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/net/wireless/arlan.h b/drivers/net/wireless/arlan.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/wireless/arlan.h	Sun Feb 23 22:25:24 2003
@@ -0,0 +1,577 @@
+/*
+ *  Copyright (C) 1997 Cullen Jennings
+ *  Copyright (C) 1998 Elmer.Joandi@ut.ee, +37-255-13500	
+ *  GNU General Public License applies
+ */
+#include <linux/version.h>
+
+#include <linux/module.h>
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/skbuff.h>
+#include <linux/if_ether.h>	/* For the statistics structure. */
+#include <linux/if_arp.h>	/* For ARPHRD_ETHER */
+#include <linux/ptrace.h>
+#include <linux/ioport.h>
+#include <linux/in.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/timer.h>
+
+#include <linux/init.h>
+#include <asm/system.h>
+#include <asm/bitops.h>
+#include <asm/io.h>
+#include <linux/errno.h>
+#include <linux/delay.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+
+
+//#define ARLAN_DEBUGGING 1
+
+#define ARLAN_PROC_INTERFACE
+#define MAX_ARLANS 4 /* not more than 4 ! */
+#define ARLAN_PROC_SHM_DUMP /* shows all card registers, makes driver way larger */
+
+#define ARLAN_MAX_MULTICAST_ADDRS 16
+#define ARLAN_RCV_CLEAN 	0
+#define ARLAN_RCV_PROMISC 1
+#define ARLAN_RCV_CONTROL 2
+
+
+#ifdef CONFIG_PROC_FS
+extern int 	init_arlan_proc(void);
+#endif
+
+extern struct net_device *arlan_device[MAX_ARLANS];
+extern int	arlan_debug;
+extern char *	siteName;
+extern int	arlan_entry_debug;
+extern int	arlan_exit_debug;
+extern int	testMemory;
+extern const char* arlan_version;
+extern int     arlan_command(struct net_device * dev, int command);
+ 
+#define SIDUNKNOWN -1
+#define radioNodeIdUNKNOWN -1
+#define encryptionKeyUNKNOWN '\0';
+#define irqUNKNOWN 0
+#define memUNKNOWN 0
+#define debugUNKNOWN 0
+#define probeUNKNOWN 1
+#define numDevicesUNKNOWN 1
+#define testMemoryUNKNOWN 1
+#define spreadingCodeUNKNOWN 0
+#define channelNumberUNKNOWN 0
+#define channelSetUNKNOWN 0
+#define systemIdUNKNOWN -1
+#define registrationModeUNKNOWN -1
+#define siteNameUNKNOWN "LinuxSite"
+
+
+
+#define IFDEBUG( L ) if ( (L) & arlan_debug ) 
+#define ARLAN_FAKE_HDR_LEN 12 
+
+#ifdef ARLAN_DEBUGGING
+	#define DEBUG 1
+	#define ARLAN_ENTRY_EXIT_DEBUGGING 1
+	#define ARLAN_DEBUG(a,b) printk(KERN_DEBUG a, b)
+#else
+	#define ARLAN_DEBUG(a,b) 
+#endif
+
+struct arlan_shmem
+{
+      /* Header Signature */ 
+      volatile	char textRegion[48];
+      volatile	u_char resetFlag;
+      volatile	u_char  diagnosticInfo;
+      volatile	u_short diagnosticOffset;
+      volatile	u_char _1[12];
+      volatile	u_char lanCardNodeId[6];
+      volatile	u_char broadcastAddress[6];
+      volatile	u_char hardwareType;
+      volatile	u_char majorHardwareVersion;
+      volatile	u_char minorHardwareVersion;
+      volatile	u_char radioModule;// shows EEPROM, can be overridden at 0x111
+      volatile	u_char defaultChannelSet; // shows EEProm, can be overriiden at 0x10A
+      volatile	u_char _2[47];
+      
+      /* Control/Status Block - 0x0080 */
+      volatile	u_char interruptInProgress; /* not used by lancpu */
+      volatile	u_char cntrlRegImage; /* not used by lancpu */
+      volatile	u_char _3[13];
+      volatile	u_char dumpByte;
+      volatile	u_char commandByte; /* non-zero = active */
+      volatile	u_char commandParameter[15];
+
+      /* Receive Status - 0x00a0 */
+      volatile	u_char rxStatus; /* 1- data, 2-control, 0xff - registr change */
+      volatile	u_char rxFrmType;
+      volatile	u_short rxOffset;
+      volatile	u_short rxLength;
+      volatile	u_char rxSrc[6];
+      volatile	u_char rxBroadcastFlag;
+      volatile	u_char rxQuality;
+      volatile	u_char scrambled;
+      volatile	u_char _4[1];
+      
+      /* Transmit Status - 0x00b0 */
+      volatile	u_char txStatus;
+      volatile	u_char txAckQuality;
+      volatile	u_char numRetries;
+      volatile	u_char _5[14];
+      volatile	u_char registeredRouter[6];
+      volatile	u_char backboneRouter[6];
+      volatile	u_char registrationStatus;
+      volatile	u_char configuredStatusFlag;
+      volatile	u_char _6[1];
+      volatile	u_char ultimateDestAddress[6];
+      volatile	u_char immedDestAddress[6];
+      volatile	u_char immedSrcAddress[6];
+      volatile	u_short rxSequenceNumber;
+      volatile	u_char assignedLocaltalkAddress;
+      volatile	u_char _7[27];
+
+      /* System Parameter Block */
+
+      /* - Driver Parameters (Novell Specific) */
+
+      volatile	u_short txTimeout;
+      volatile	u_short transportTime;
+      volatile	u_char _8[4];
+
+      /* - Configuration Parameters */
+      volatile	u_char irqLevel;
+      volatile	u_char spreadingCode;
+      volatile	u_char channelSet;
+      volatile	u_char channelNumber;
+      volatile	u_short radioNodeId;
+      volatile	u_char _9[2];
+      volatile	u_char scramblingDisable;
+      volatile	u_char radioType;
+      volatile	u_short routerId;
+      volatile	u_char _10[9];
+      volatile	u_char txAttenuation;
+      volatile	u_char systemId[4]; 
+      volatile	u_short globalChecksum;
+      volatile	u_char _11[4];
+      volatile	u_short maxDatagramSize;
+      volatile	u_short maxFrameSize;
+      volatile	u_char maxRetries;
+      volatile	u_char receiveMode;
+      volatile	u_char priority;
+      volatile	u_char rootOrRepeater;
+      volatile	u_char specifiedRouter[6];
+      volatile	u_short fastPollPeriod;
+      volatile	u_char pollDecay;
+      volatile	u_char fastPollDelay[2];
+      volatile	u_char arlThreshold;
+      volatile	u_char arlDecay;
+      volatile	u_char _12[1];
+      volatile	u_short specRouterTimeout;
+      volatile	u_char _13[5];
+
+      /* Scrambled Area */
+      volatile	u_char SID[4];
+      volatile	u_char encryptionKey[12];
+      volatile	u_char _14[2];
+      volatile	u_char waitTime[2];
+      volatile	u_char lParameter[2];
+      volatile	u_char _15[3];
+      volatile	u_short headerSize;
+      volatile	u_short sectionChecksum;
+
+      volatile	u_char registrationMode;
+      volatile	u_char registrationFill;
+      volatile	u_short pollPeriod;
+      volatile	u_short refreshPeriod;
+      volatile	u_char name[16];
+      volatile	u_char NID[6];
+      volatile	u_char localTalkAddress;
+      volatile	u_char codeFormat;
+      volatile	u_char numChannels;
+      volatile	u_char channel1;
+      volatile	u_char channel2;
+      volatile	u_char channel3;
+      volatile	u_char channel4;
+      volatile	u_char SSCode[59];
+
+      volatile	u_char _16[0xC0];
+      volatile	u_short auxCmd;
+      volatile	u_char  dumpPtr[4];
+      volatile	u_char dumpVal;
+      volatile	u_char _17[0x6A];
+      volatile	u_char wireTest;
+      volatile	u_char _18[14];
+
+      /* Statistics Block - 0x0300 */
+      volatile	u_char hostcpuLock;
+      volatile	u_char lancpuLock;
+      volatile	u_char resetTime[18];
+      
+      volatile	u_char numDatagramsTransmitted[4];
+      volatile	u_char numReTransmissions[4];
+      volatile	u_char numFramesDiscarded[4];
+      volatile	u_char numDatagramsReceived[4];
+      volatile	u_char numDuplicateReceivedFrames[4];
+      volatile	u_char numDatagramsDiscarded[4];
+      
+      volatile	u_short maxNumReTransmitDatagram;
+      volatile	u_short maxNumReTransmitFrames;
+      volatile	u_short maxNumConsecutiveDuplicateFrames;
+      /* misaligned here so we have to go to characters */
+     
+      volatile	u_char numBytesTransmitted[4];
+      volatile	u_char numBytesReceived[4];
+      volatile	u_char numCRCErrors[4];
+      volatile	u_char numLengthErrors[4];
+      volatile	u_char numAbortErrors[4];
+      volatile	u_char numTXUnderruns[4];
+      volatile	u_char numRXOverruns[4];
+      volatile	u_char numHoldOffs[4];
+      volatile	u_char numFramesTransmitted[4];
+      volatile	u_char numFramesReceived[4];
+      volatile	u_char numReceiveFramesLost[4];
+      volatile	u_char numRXBufferOverflows[4];
+      volatile	u_char numFramesDiscardedAddrMismatch[4];
+      volatile	u_char numFramesDiscardedSIDMismatch[4];
+      volatile	u_char numPollsTransmistted[4];
+      volatile	u_char numPollAcknowledges[4];
+      volatile	u_char numStatusTimeouts[4];
+      volatile	u_char numNACKReceived[4];
+
+      volatile	u_char _19[0x86];
+
+      volatile	u_char txBuffer[0x800];
+      volatile	u_char rxBuffer[0x800];
+
+      volatile	u_char _20[0x800];
+      volatile	u_char _21[0x3fb];
+      volatile	u_char configStatus;
+      volatile	u_char _22;
+      volatile	u_char progIOCtrl;
+      volatile	u_char shareMBase;
+      volatile	u_char controlRegister;
+};
+
+struct arlan_conf_stru {
+      int spreadingCode;
+      int channelSet;
+      int channelNumber;
+      int scramblingDisable;
+      int txAttenuation;
+      int systemId; 
+      int maxDatagramSize;
+      int maxFrameSize;
+      int maxRetries;
+      int receiveMode;
+      int priority;
+      int rootOrRepeater;
+      int SID;
+      int radioNodeId;
+      int registrationMode;
+      int registrationFill;
+      int localTalkAddress;
+      int codeFormat;
+      int numChannels;
+      int channel1;
+      int channel2;
+      int channel3;
+      int channel4;
+      int txClear;
+      int txRetries;
+      int txRouting;
+      int txScrambled;
+      int rxParameter;
+      int txTimeoutMs;
+      int txAckTimeoutMs;
+      int waitCardTimeout;
+      int	waitTime;
+      int	lParameter;
+      int	_15;
+      int	headerSize;
+      int async;
+      int retries;
+      int tx_delay_ms;
+      int waitReTransmitPacketMaxSize;
+      int ReTransmitPacketMaxSize;
+      int fastReTransCount;
+      int driverRetransmissions;
+      int registrationInterrupts;
+      int hardwareType;
+      int radioType;
+      int writeRadioType;
+      int writeEEPROM;
+      char siteName[17];
+      int measure_rate;
+      int in_speed;
+      int out_speed;
+      int in_speed10;
+      int out_speed10;
+      int in_speed_max;
+      int out_speed_max;
+      int pre_Command_Wait;
+      int rx_tweak1;
+      int rx_tweak2;
+      int tx_queue_len;
+};
+
+extern struct arlan_conf_stru arlan_conf[MAX_ARLANS];
+
+struct TxParam
+{
+      volatile	short 		offset;
+      volatile 	short 		length;
+      volatile	u_char 		dest[6];
+      volatile	unsigned	char clear;
+      volatile	unsigned	char retries;
+      volatile	unsigned	char routing;
+      volatile	unsigned	char scrambled;
+};
+
+struct TxRingPoint  {
+	struct TxParam txParam;
+	
+	
+};
+
+#define TX_RING_SIZE 2
+/* Information that need to be kept for each board. */
+struct arlan_private {
+      struct net_device_stats stats;
+      long open_time;			/* Useless example local info. */
+      struct arlan_shmem * card;
+      struct arlan_shmem * conf;
+      struct TxParam txParam;      
+      int multicastLength;
+      char  multicastList[ARLAN_MAX_MULTICAST_ADDRS][6];
+      int promiscModeEnabled;
+      struct arlan_conf_stru * Conf;	     
+      int	bad;
+      int 	reset;
+      long long lastReset;
+      struct timer_list timer;
+      struct timer_list tx_delay_timer;
+      struct timer_list tx_retry_timer;
+      struct timer_list rx_check_timer;
+      struct semaphore card_lock;
+      atomic_t 	card_users;
+      atomic_t	delay_on;
+      atomic_t  retr_on;
+      int registrationLostCount;
+      int reRegisterExp;
+      int nof_tx;
+      int nof_tx_ack;
+      int last_nof_tx;
+      int last_nof_tx_ack;
+      int irq_test_done;
+      int last_command_was_rx;
+      struct TxParam txRing[TX_RING_SIZE];
+      char reTransmitBuff[0x800];
+      volatile int txLast;
+      volatile int txNew;
+      volatile int txOffset;
+      volatile char ReTransmitRequested;
+      volatile long long tx_done_delayed;
+      volatile long long registrationLastSeen;
+      volatile char under_command;
+      volatile char under_toggle;
+      volatile long long tx_last_sent;
+      volatile long long tx_last_cleared;
+      volatile u_char under_tx;
+      volatile int 	retransmissions;
+      volatile int	tx_chain_active;
+      volatile int 	timer_chain_active;
+      volatile int 	interrupt_ack_requested;
+      volatile long	command_lock;
+      volatile int	rx_command_needed;
+      volatile int	tx_command_needed;
+      volatile int 	waiting_command_mask;
+      volatile int 	card_polling_interval;
+      volatile int 	last_command_buff_free_time;
+      volatile int	numResets;
+      volatile int 	under_reset;
+      volatile int 	under_config;
+      volatile int 	rx_command_given;
+      volatile long 	tx_command_given;
+      volatile long	interrupt_processing_active;
+      volatile long long 	last_tx_time;
+      volatile long long	last_rx_time;
+      volatile long long	last_rx_int_ack_time;
+      int	in_bytes;
+      int	out_bytes;
+      int	in_time;
+      int	out_time;
+      int	in_time10;
+      int	out_time10;
+      int	in_bytes10;
+      int	out_bytes10;
+      int	init_etherdev_alloc;
+};
+
+
+
+#define ARLAN_CLEAR		0x00
+#define ARLAN_RESET 		0x01
+#define ARLAN_CHANNEL_ATTENTION 0x02
+#define ARLAN_INTERRUPT_ENABLE 	0x04
+#define ARLAN_CLEAR_INTERRUPT 	0x08
+#define ARLAN_POWER 		0x40
+#define ARLAN_ACCESS		0x80
+
+#define ARLAN_COM_CONF                0x01
+#define ARLAN_COM_RX_ENABLE           0x03
+#define ARLAN_COM_RX_ABORT            0x04
+#define ARLAN_COM_TX_ENABLE           0x05
+#define ARLAN_COM_TX_ABORT            0x06
+#define ARLAN_COM_NOP		      0x07
+#define ARLAN_COM_STANDBY             0x08
+#define ARLAN_COM_ACTIVATE            0x09
+#define ARLAN_COM_GOTO_SLOW_POLL      0x0a
+#define ARLAN_COM_INT                 0x80
+
+
+#define TXLAST(dev) (((struct arlan_private *)dev->priv)->txRing[((struct arlan_private *)dev->priv)->txLast])
+#define TXHEAD(dev) (((struct arlan_private *)dev->priv)->txRing[0])
+#define TXTAIL(dev) (((struct arlan_private *)dev->priv)->txRing[1])
+
+#define TXBuffStart(dev) \
+ ((int)(((struct arlan_private *)dev->priv)->card)->txBuffer) - ((int)(((struct arlan_private *)dev->priv)->card) )
+#define TXBuffEnd(dev) \
+ ((int)(((struct arlan_private *)dev->priv)->card)->rxBuffer) - ((int)(((struct arlan_private *)dev->priv)->card)
+ 
+#define READSHM(to,from,atype) {\
+	atype tmp;\
+	memcpy_fromio(&(tmp),&(from),sizeof(atype));\
+	to = tmp;\
+	}
+
+#define READSHMEM(from,atype)\
+	atype from; \
+	READSHM(from, arlan->from, atype);
+
+#define WRITESHM(to,from,atype) \
+	{ atype tmpSHM = from;\
+	memcpy_toio(&(to),&tmpSHM,sizeof(atype));\
+	}
+
+#define DEBUGSHM(levelSHM,stringSHM,stuff,atype) \
+	{	atype tmpSHM; \
+		memcpy_fromio(&tmpSHM,&(stuff),sizeof(atype));\
+		IFDEBUG(levelSHM) printk(stringSHM,tmpSHM);\
+	}
+
+#define WRITESHMB(to, val) \
+	writeb(val,&(to))
+#define READSHMB(to) \
+	readb(&(to))
+#define WRITESHMS(to, val) \
+	writew(val,&(to))
+#define READSHMS(to) \
+	readw(&(to))
+#define WRITESHMI(to, val) \
+	writel(val,&(to))
+#define READSHMI(to) \
+	readl(&(to))
+
+
+
+
+
+#define registrationBad(dev)\
+   ( (   READSHMB(((struct arlan_private *)dev->priv)->card->registrationMode)    > 0) && \
+     (   READSHMB(((struct arlan_private *)dev->priv)->card->registrationStatus) == 0)    )
+
+
+#define readControlRegister(dev)\
+ 	READSHMB(((struct arlan_private *)dev->priv)->card->cntrlRegImage)
+
+#define writeControlRegister(dev, v){\
+   WRITESHMB(((struct arlan_private *)dev->priv)->card->cntrlRegImage	,((v) &0xF) );\
+   WRITESHMB(((struct arlan_private *)dev->priv)->card->controlRegister	,(v) 	);}
+
+
+#define arlan_interrupt_lancpu(dev) {\
+   int cr;   \
+   \
+   priv->under_toggle++;   \
+   cr = readControlRegister(dev);\
+   if (cr & ARLAN_CHANNEL_ATTENTION){ \
+      writeControlRegister(dev, (cr & ~ARLAN_CHANNEL_ATTENTION));\
+   }else  \
+      writeControlRegister(dev, (cr | ARLAN_CHANNEL_ATTENTION));\
+   priv->under_toggle=0;     \
+}
+
+#define clearChannelAttention(dev){ \
+   writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_CHANNEL_ATTENTION);}
+#define setHardwareReset(dev) {\
+   writeControlRegister(dev,readControlRegister(dev) | ARLAN_RESET);}
+#define clearHardwareReset(dev) {\
+   writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_RESET);}
+#define setInterruptEnable(dev){\
+   writeControlRegister(dev,readControlRegister(dev) | ARLAN_INTERRUPT_ENABLE)  ;}
+#define clearInterruptEnable(dev){\
+   writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_INTERRUPT_ENABLE)  ;}
+#define setClearInterrupt(dev){\
+   writeControlRegister(dev,readControlRegister(dev) | ARLAN_CLEAR_INTERRUPT)   ;}
+#define clearClearInterrupt(dev){\
+   writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_CLEAR_INTERRUPT);}
+#define setPowerOff(dev){\
+   writeControlRegister(dev,readControlRegister(dev) | (ARLAN_POWER && ARLAN_ACCESS));\
+   writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_ACCESS);}
+#define setPowerOn(dev){\
+   writeControlRegister(dev,readControlRegister(dev) & ~(ARLAN_POWER));   }
+#define arlan_lock_card_access(dev){\
+   writeControlRegister(dev,readControlRegister(dev) & ~ARLAN_ACCESS);}
+#define arlan_unlock_card_access(dev){\
+   writeControlRegister(dev,readControlRegister(dev) | ARLAN_ACCESS ); }  
+
+
+
+
+#define ARLAN_COMMAND_RX		0x000001
+#define ARLAN_COMMAND_NOOP		0x000002
+#define ARLAN_COMMAND_NOOPINT		0x000004
+#define ARLAN_COMMAND_TX		0x000008
+#define ARLAN_COMMAND_CONF		0x000010
+#define ARLAN_COMMAND_RESET		0x000020
+#define ARLAN_COMMAND_TX_ABORT		0x000040
+#define ARLAN_COMMAND_RX_ABORT		0x000080
+#define ARLAN_COMMAND_POWERDOWN		0x000100
+#define ARLAN_COMMAND_POWERUP		0x000200
+#define ARLAN_COMMAND_SLOW_POLL 	0x000400
+#define ARLAN_COMMAND_ACTIVATE 		0x000800
+#define ARLAN_COMMAND_INT_ACK		0x001000
+#define ARLAN_COMMAND_INT_ENABLE	0x002000
+#define ARLAN_COMMAND_WAIT_NOW		0x004000
+#define ARLAN_COMMAND_LONG_WAIT_NOW	0x008000
+#define ARLAN_COMMAND_STANDBY		0x010000
+#define ARLAN_COMMAND_INT_RACK		0x020000
+#define ARLAN_COMMAND_INT_RENABLE	0x040000
+#define ARLAN_COMMAND_CONF_WAIT		0x080000
+#define ARLAN_COMMAND_TBUSY_CLEAR	0x100000
+#define ARLAN_COMMAND_CLEAN_AND_CONF	(ARLAN_COMMAND_TX_ABORT\
+					| ARLAN_COMMAND_RX_ABORT\
+					| ARLAN_COMMAND_CONF)
+#define ARLAN_COMMAND_CLEAN_AND_RESET   (ARLAN_COMMAND_TX_ABORT\
+					| ARLAN_COMMAND_RX_ABORT\
+					| ARLAN_COMMAND_RESET)
+
+
+ 
+#define ARLAN_DEBUG_CHAIN_LOCKS		0x00001
+#define ARLAN_DEBUG_RESET		0x00002
+#define ARLAN_DEBUG_TIMING		0x00004
+#define ARLAN_DEBUG_CARD_STATE		0x00008
+#define ARLAN_DEBUG_TX_CHAIN		0x00010
+#define ARLAN_DEBUG_MULTICAST		0x00020
+#define ARLAN_DEBUG_HEADER_DUMP		0x00040
+#define ARLAN_DEBUG_INTERRUPT		0x00080
+#define ARLAN_DEBUG_STARTUP		0x00100
+#define ARLAN_DEBUG_SHUTDOWN		0x00200
+ 
diff -Nru a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
--- a/drivers/net/wireless/orinoco.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/net/wireless/orinoco.c	Sun Feb 23 22:25:27 2003
@@ -289,7 +289,7 @@
  *	  which are used as the dev->open, dev->stop, priv->reset
  *	  callbacks if none are specified when alloc_orinocodev() is
  *	  called.
- *	o Removed orinoco_plx_interupt() and orinoco_pci_interrupt().
+ *	o Removed orinoco_plx_interrupt() and orinoco_pci_interrupt().
  *	  They didn't do anything.
  *
  * v0.12 -> v0.12a - 4 Jul 2002 - David Gibson
diff -Nru a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/wireless/ray_cs.c	Sun Feb 23 22:25:23 2003
@@ -0,0 +1,3012 @@
+/*=============================================================================
+ *
+ * A  PCMCIA client driver for the Raylink wireless LAN card.
+ * The starting point for this module was the skeleton.c in the
+ * PCMCIA 2.9.12 package written by David Hinds, dahinds@users.sourceforge.net
+ *
+ *
+ * Copyright (c) 1998  Corey Thomas (corey@world.std.com)
+ *
+ * This driver is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 only of the GNU General Public License as 
+ * published by the Free Software Foundation.
+ *
+ * It is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Changes:
+ * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/08/2000
+ * - reorganize kmallocs in ray_attach, checking all for failure
+ *   and releasing the previous allocations if one fails
+ *
+ * 
+=============================================================================*/
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/proc_fs.h>
+#include <linux/ptrace.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/if_arp.h>
+#include <linux/ioport.h>
+#include <linux/skbuff.h>
+#include <linux/ethtool.h>
+
+#include <pcmcia/version.h>
+#include <pcmcia/cs_types.h>
+#include <pcmcia/cs.h>
+#include <pcmcia/cistpl.h>
+#include <pcmcia/cisreg.h>
+#include <pcmcia/ds.h>
+#include <pcmcia/mem_op.h>
+
+#ifdef CONFIG_NET_PCMCIA_RADIO
+#include <linux/wireless.h>
+
+#include <asm/io.h>
+#include <asm/system.h>
+#include <asm/byteorder.h>
+#include <asm/uaccess.h>
+
+/* Warning : these stuff will slow down the driver... */
+#define WIRELESS_SPY		/* Enable spying addresses */
+/* Definitions we need for spy */
+typedef struct iw_statistics	iw_stats;
+typedef struct iw_quality	iw_qual;
+typedef u_char	mac_addr[ETH_ALEN];	/* Hardware address */
+#endif	/* CONFIG_NET_PCMCIA_RADIO */
+
+#include "rayctl.h"
+#include "ray_cs.h"
+
+/* All the PCMCIA modules use PCMCIA_DEBUG to control debugging.  If
+   you do not define PCMCIA_DEBUG at all, all the debug code will be
+   left out.  If you compile with PCMCIA_DEBUG=0, the debug code will
+   be present but disabled -- but it can then be enabled for specific
+   modules at load time with a 'pc_debug=#' option to insmod.
+*/
+
+#ifdef RAYLINK_DEBUG
+#define PCMCIA_DEBUG RAYLINK_DEBUG
+#endif
+#ifdef PCMCIA_DEBUG
+static int ray_debug;
+static int pc_debug = PCMCIA_DEBUG;
+MODULE_PARM(pc_debug, "i");
+/* #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); */
+#define DEBUG(n, args...) if (pc_debug>(n)) printk(args);
+#else
+#define DEBUG(n, args...)
+#endif
+/** Prototypes based on PCMCIA skeleton driver *******************************/
+static void ray_config(dev_link_t *link);
+static void ray_release(u_long arg);
+static int ray_event(event_t event, int priority, event_callback_args_t *args);
+static dev_link_t *ray_attach(void);
+static void ray_detach(dev_link_t *);
+
+/***** Prototypes indicated by device structure ******************************/
+static int ray_dev_close(struct net_device *dev);
+static int ray_dev_config(struct net_device *dev, struct ifmap *map);
+static struct net_device_stats *ray_get_stats(struct net_device *dev);
+static int ray_dev_init(struct net_device *dev);
+static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
+static int ray_open(struct net_device *dev);
+static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev);
+static void set_multicast_list(struct net_device *dev);
+static void ray_update_multi_list(struct net_device *dev, int all);
+static int translate_frame(ray_dev_t *local, struct tx_msg *ptx,
+                unsigned char *data, int len);
+static void ray_build_header(ray_dev_t *local, struct tx_msg *ptx, UCHAR msg_type,
+                unsigned char *data);
+static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len);
+#if WIRELESS_EXT > 7	/* If wireless extension exist in the kernel */
+static iw_stats * ray_get_wireless_stats(struct net_device *	dev);
+#endif	/* WIRELESS_EXT > 7 */
+
+/***** Prototypes for raylink functions **************************************/
+static int asc_to_int(char a);
+static void authenticate(ray_dev_t *local);
+static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type);
+static void authenticate_timeout(u_long);
+static int get_free_ccs(ray_dev_t *local);
+static int get_free_tx_ccs(ray_dev_t *local);
+static void init_startup_params(ray_dev_t *local);
+static int parse_addr(char *in_str, UCHAR *out);
+static int ray_hw_xmit(unsigned char* data, int len, struct net_device* dev, UCHAR type);
+static int ray_init(struct net_device *dev);
+static int interrupt_ecf(ray_dev_t *local, int ccs);
+static void ray_reset(struct net_device *dev);
+static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len);
+static void verify_dl_startup(u_long);
+
+/* Prototypes for interrpt time functions **********************************/
+static void ray_interrupt (int reg, void *dev_id, struct pt_regs *regs);
+static void clear_interrupt(ray_dev_t *local);
+static void rx_deauthenticate(ray_dev_t *local, struct rcs *prcs, 
+                       unsigned int pkt_addr, int rx_len);
+static int copy_from_rx_buff(ray_dev_t *local, UCHAR *dest, int pkt_addr, int len);
+static void ray_rx(struct net_device *dev, ray_dev_t *local, struct rcs *prcs);
+static void release_frag_chain(ray_dev_t *local, struct rcs *prcs);
+static void rx_authenticate(ray_dev_t *local, struct rcs *prcs,
+                     unsigned int pkt_addr, int rx_len);
+static void rx_data(struct net_device *dev, struct rcs *prcs, unsigned int pkt_addr, 
+             int rx_len);
+static void associate(ray_dev_t *local);
+
+/* Card command functions */
+static int dl_startup_params(struct net_device *dev);
+static void join_net(u_long local);
+static void start_net(u_long local);
+/* void start_net(ray_dev_t *local); */
+
+/* Create symbol table for registering with kernel in init_module */
+EXPORT_SYMBOL(ray_dev_ioctl);
+EXPORT_SYMBOL(ray_rx);
+
+/*===========================================================================*/
+/* Parameters that can be set with 'insmod' */
+/* Bit map of interrupts to choose from */
+/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, and 3 */
+static u_long irq_mask = 0xdeb8;
+
+/* ADHOC=0, Infrastructure=1 */
+static int net_type = ADHOC;
+
+/* Hop dwell time in Kus (1024 us units defined by 802.11) */
+static int hop_dwell = 128;
+
+/* Beacon period in Kus */
+static int beacon_period = 256;
+
+/* power save mode (0 = off, 1 = save power) */
+static int psm;
+
+/* String for network's Extended Service Set ID. 32 Characters max */
+static char *essid;
+
+/* Default to encapsulation unless translation requested */
+static int translate = 1;
+
+static int country = USA;
+
+static int sniffer;
+
+static int bc;
+
+/* 48 bit physical card address if overriding card's real physical
+ * address is required.  Since IEEE 802.11 addresses are 48 bits
+ * like ethernet, an int can't be used, so a string is used. To
+ * allow use of addresses starting with a decimal digit, the first
+ * character must be a letter and will be ignored. This letter is
+ * followed by up to 12 hex digits which are the address.  If less
+ * than 12 digits are used, the address will be left filled with 0's.
+ * Note that bit 0 of the first byte is the broadcast bit, and evil
+ * things will happen if it is not 0 in a card address.
+ */
+static char *phy_addr = NULL;
+
+
+/* The dev_info variable is the "key" that is used to match up this
+   device driver with appropriate cards, through the card configuration
+   database.
+*/
+static dev_info_t dev_info = "ray_cs";
+
+/* A linked list of "instances" of the ray device.  Each actual
+   PCMCIA card corresponds to one device instance, and is described
+   by one dev_link_t structure (defined in ds.h).
+*/
+static dev_link_t *dev_list = NULL;
+
+/* A dev_link_t structure has fields for most things that are needed
+   to keep track of a socket, but there will usually be some device
+   specific information that also needs to be kept track of.  The
+   'priv' pointer in a dev_link_t structure can be used to point to
+   a device-specific private data structure, like this.
+*/
+static unsigned int ray_mem_speed = 500;
+
+MODULE_AUTHOR("Corey Thomas <corey@world.std.com>");
+MODULE_DESCRIPTION("Raylink/WebGear wireless LAN driver");
+MODULE_LICENSE("GPL");
+
+MODULE_PARM(irq_mask,"i");
+MODULE_PARM(net_type,"i");
+MODULE_PARM(hop_dwell,"i");
+MODULE_PARM(beacon_period,"i");
+MODULE_PARM(psm,"i");
+MODULE_PARM(essid,"s");
+MODULE_PARM(translate,"i");
+MODULE_PARM(country,"i");
+MODULE_PARM(sniffer,"i");
+MODULE_PARM(bc,"i");
+MODULE_PARM(phy_addr,"s");
+MODULE_PARM(ray_mem_speed, "i");
+
+static UCHAR b5_default_startup_parms[] = {
+    0,   0,                         /* Adhoc station */
+   'L','I','N','U','X', 0,  0,  0,  /* 32 char ESSID */
+    0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,
+    1,  0,                          /* Active scan, CA Mode */
+    0,  0,  0,  0,  0,  0,          /* No default MAC addr  */
+    0x7f, 0xff,                     /* Frag threshold */
+    0x00, 0x80,                     /* Hop time 128 Kus*/
+    0x01, 0x00,                     /* Beacon period 256 Kus */
+    0x01, 0x07, 0xa3,               /* DTIM, retries, ack timeout*/
+    0x1d, 0x82, 0x4e,               /* SIFS, DIFS, PIFS */
+    0x7f, 0xff,                     /* RTS threshold */
+    0x04, 0xe2, 0x38, 0xA4,         /* scan_dwell, max_scan_dwell */
+    0x05,                           /* assoc resp timeout thresh */
+    0x08, 0x02, 0x08,               /* adhoc, infra, super cycle max*/
+    0,                              /* Promiscuous mode */
+    0x0c, 0x0bd,                    /* Unique word */
+    0x32,                           /* Slot time */
+    0xff, 0xff,                     /* roam-low snr, low snr count */
+    0x05, 0xff,                     /* Infra, adhoc missed bcn thresh */
+    0x01, 0x0b, 0x4f,               /* USA, hop pattern, hop pat length */
+/* b4 - b5 differences start here */
+    0x00, 0x3f,                     /* CW max */
+    0x00, 0x0f,                     /* CW min */
+    0x04, 0x08,                     /* Noise gain, limit offset */
+    0x28, 0x28,                     /* det rssi, med busy offsets */
+    7,                              /* det sync thresh */
+    0, 2, 2,                        /* test mode, min, max */
+    0,                              /* allow broadcast SSID probe resp */
+    0, 0,                           /* privacy must start, can join */
+    2, 0, 0, 0, 0, 0, 0, 0          /* basic rate set */
+};
+
+static UCHAR b4_default_startup_parms[] = {
+    0,   0,                         /* Adhoc station */
+   'L','I','N','U','X', 0,  0,  0,  /* 32 char ESSID */
+    0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,
+    1,  0,                          /* Active scan, CA Mode */
+    0,  0,  0,  0,  0,  0,          /* No default MAC addr  */
+    0x7f, 0xff,                     /* Frag threshold */
+    0x02, 0x00,                     /* Hop time */
+    0x00, 0x01,                     /* Beacon period */
+    0x01, 0x07, 0xa3,               /* DTIM, retries, ack timeout*/
+    0x1d, 0x82, 0xce,               /* SIFS, DIFS, PIFS */
+    0x7f, 0xff,                     /* RTS threshold */
+    0xfb, 0x1e, 0xc7, 0x5c,         /* scan_dwell, max_scan_dwell */
+    0x05,                           /* assoc resp timeout thresh */
+    0x04, 0x02, 0x4,                /* adhoc, infra, super cycle max*/
+    0,                              /* Promiscuous mode */
+    0x0c, 0x0bd,                    /* Unique word */
+    0x4e,                           /* Slot time (TBD seems wrong)*/
+    0xff, 0xff,                     /* roam-low snr, low snr count */
+    0x05, 0xff,                     /* Infra, adhoc missed bcn thresh */
+    0x01, 0x0b, 0x4e,               /* USA, hop pattern, hop pat length */
+/* b4 - b5 differences start here */
+    0x3f, 0x0f,                     /* CW max, min */
+    0x04, 0x08,                     /* Noise gain, limit offset */
+    0x28, 0x28,                     /* det rssi, med busy offsets */
+    7,                              /* det sync thresh */
+    0, 2, 2                         /* test mode, min, max*/
+};
+/*===========================================================================*/
+static unsigned char eth2_llc[] = {0xaa, 0xaa, 3, 0, 0, 0};
+
+static char hop_pattern_length[] = { 1,
+	     USA_HOP_MOD,             EUROPE_HOP_MOD,
+	     JAPAN_HOP_MOD,           KOREA_HOP_MOD,
+	     SPAIN_HOP_MOD,           FRANCE_HOP_MOD,
+	     ISRAEL_HOP_MOD,          AUSTRALIA_HOP_MOD,
+	     JAPAN_TEST_HOP_MOD
+};
+
+static char rcsid[] = "Raylink/WebGear wireless LAN - Corey <Thomas corey@world.std.com>";
+
+/*===========================================================================*/
+static void cs_error(client_handle_t handle, int func, int ret)
+{
+    error_info_t err = { func, ret };
+    pcmcia_report_error(handle, &err);
+}
+/*======================================================================
+
+    This bit of code is used to avoid unregistering network devices
+    at inappropriate times.  2.2 and later kernels are fairly picky
+    about when this can happen.
+    
+======================================================================*/
+
+static void flush_stale_links(void)
+{
+    dev_link_t *link, *next;
+    for (link = dev_list; link; link = next) {
+	next = link->next;
+	if (link->state & DEV_STALE_LINK)
+	    ray_detach(link);
+    }
+}
+
+/*=============================================================================
+    ray_attach() creates an "instance" of the driver, allocating
+    local data structures for one device.  The device is registered
+    with Card Services.
+    The dev_link structure is initialized, but we don't actually
+    configure the card at this point -- we wait until we receive a
+    card insertion event.
+=============================================================================*/
+static dev_link_t *ray_attach(void)
+{
+    client_reg_t client_reg;
+    dev_link_t *link;
+    ray_dev_t *local;
+    int ret;
+    struct net_device *dev;
+    
+    DEBUG(1, "ray_attach()\n");
+    flush_stale_links();
+
+    /* Initialize the dev_link_t structure */
+    link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
+
+    if (!link)
+	    return NULL;
+
+    /* Allocate space for private device-specific data */
+    dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
+
+    if (!dev)
+	    goto fail_alloc_dev;
+
+    local = kmalloc(sizeof(ray_dev_t), GFP_KERNEL);
+
+    if (!local)
+	    goto fail_alloc_local;
+
+    memset(link, 0, sizeof(struct dev_link_t));
+    memset(dev, 0, sizeof(struct net_device));
+    memset(local, 0, sizeof(ray_dev_t));
+
+    init_timer(&link->release);
+    link->release.function = &ray_release;
+    link->release.data = (u_long)link;
+
+    /* The io structure describes IO port mapping. None used here */
+    link->io.NumPorts1 = 0;
+    link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
+    link->io.IOAddrLines = 5;
+
+    /* Interrupt setup. For PCMCIA, driver takes what's given */
+    link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
+    link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID;
+    link->irq.IRQInfo2 = irq_mask;
+    link->irq.Handler = &ray_interrupt;
+
+    /* General socket configuration */
+    link->conf.Attributes = CONF_ENABLE_IRQ;
+    link->conf.Vcc = 50;
+    link->conf.IntType = INT_MEMORY_AND_IO;
+    link->conf.ConfigIndex = 1;
+    link->conf.Present = PRESENT_OPTION;
+
+    link->priv = dev;
+    link->irq.Instance = dev;
+    
+    dev->priv = local;
+    local->finder = link;
+    local->card_status = CARD_INSERTED;
+    local->authentication_state = UNAUTHENTICATED;
+    local->num_multi = 0;
+    DEBUG(2,"ray_attach link = %p,  dev = %p,  local = %p, intr = %p\n",
+          link,dev,local,&ray_interrupt);
+
+    /* Raylink entries in the device structure */
+    dev->hard_start_xmit = &ray_dev_start_xmit;
+    dev->set_config = &ray_dev_config;
+    dev->get_stats  = &ray_get_stats;
+    dev->do_ioctl = &ray_dev_ioctl;
+#if WIRELESS_EXT > 7	/* If wireless extension exist in the kernel */
+    dev->get_wireless_stats = ray_get_wireless_stats;
+#endif
+
+    dev->set_multicast_list = &set_multicast_list;
+
+    DEBUG(2,"ray_cs ray_attach calling ether_setup.)\n");
+    ether_setup(dev);
+    dev->init = &ray_dev_init;
+    dev->open = &ray_open;
+    dev->stop = &ray_dev_close;
+    netif_stop_queue(dev);
+
+    /* Register with Card Services */
+    link->next = dev_list;
+    dev_list = link;
+    client_reg.dev_info = &dev_info;
+    client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
+    client_reg.EventMask =
+        CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
+        CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
+        CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
+    client_reg.event_handler = &ray_event;
+    client_reg.Version = 0x0210;
+    client_reg.event_callback_args.client_data = link;
+
+    DEBUG(2,"ray_cs ray_attach calling CardServices(RegisterClient...)\n");
+
+    init_timer(&local->timer);
+
+    ret = pcmcia_register_client(&link->handle, &client_reg);
+    if (ret != 0) {
+        printk("ray_cs ray_attach RegisterClient unhappy - detaching\n");
+        cs_error(link->handle, RegisterClient, ret);
+        ray_detach(link);
+        return NULL;
+    }
+    DEBUG(2,"ray_cs ray_attach ending\n");
+    return link;
+
+fail_alloc_local:
+    kfree(dev);
+fail_alloc_dev:
+    kfree(link);
+    return NULL;
+} /* ray_attach */
+/*=============================================================================
+    This deletes a driver "instance".  The device is de-registered
+    with Card Services.  If it has been released, all local data
+    structures are freed.  Otherwise, the structures will be freed
+    when the device is released.
+=============================================================================*/
+static void ray_detach(dev_link_t *link)
+{
+    dev_link_t **linkp;
+
+    DEBUG(1, "ray_detach(0x%p)\n", link);
+    
+    /* Locate device structure */
+    for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
+        if (*linkp == link) break;
+    if (*linkp == NULL)
+        return;
+
+    /* If the device is currently configured and active, we won't
+      actually delete it yet.  Instead, it is marked so that when
+      the release() function is called, that will trigger a proper
+      detach().
+    */
+    del_timer(&link->release);
+    if (link->state & DEV_CONFIG) {
+        ray_release((u_long)link);
+        if(link->state & DEV_STALE_CONFIG) {
+            link->state |= DEV_STALE_LINK;
+            return;
+        }
+    }
+
+    /* Break the link with Card Services */
+    if (link->handle)
+        pcmcia_deregister_client(link->handle);
+    
+    /* Unlink device structure, free pieces */
+    *linkp = link->next;
+    if (link->priv) {
+        struct net_device *dev = link->priv;
+	if (link->dev) unregister_netdev(dev);
+        if (dev->priv)
+            kfree(dev->priv);
+        kfree(link->priv);
+    }
+    kfree(link);
+    DEBUG(2,"ray_cs ray_detach ending\n");
+} /* ray_detach */
+/*=============================================================================
+    ray_config() is run after a CARD_INSERTION event
+    is received, to configure the PCMCIA socket, and to make the
+    ethernet device available to the system.
+=============================================================================*/
+#define CS_CHECK(fn, args...) \
+while ((last_ret=fn(args))!=0) goto cs_failed
+#define MAX_TUPLE_SIZE 128
+static void ray_config(dev_link_t *link)
+{
+    client_handle_t handle = link->handle;
+    tuple_t tuple;
+    cisparse_t parse;
+    int last_fn = 0, last_ret = 0;
+    int i;
+    u_char buf[MAX_TUPLE_SIZE];
+    win_req_t req;
+    memreq_t mem;
+    struct net_device *dev = (struct net_device *)link->priv;
+    ray_dev_t *local = (ray_dev_t *)dev->priv;
+
+    DEBUG(1, "ray_config(0x%p)\n", link);
+
+    /* This reads the card's CONFIG tuple to find its configuration regs */
+    tuple.DesiredTuple = CISTPL_CONFIG;
+    CS_CHECK(pcmcia_get_first_tuple, handle, &tuple);
+    tuple.TupleData = buf;
+    tuple.TupleDataMax = MAX_TUPLE_SIZE;
+    tuple.TupleOffset = 0;
+    CS_CHECK(pcmcia_get_tuple_data, handle, &tuple);
+    CS_CHECK(pcmcia_parse_tuple, handle, &tuple, &parse);
+    link->conf.ConfigBase = parse.config.base;
+    link->conf.Present = parse.config.rmask[0];
+
+    /* Determine card type and firmware version */
+    buf[0] = buf[MAX_TUPLE_SIZE - 1] = 0;
+    tuple.DesiredTuple = CISTPL_VERS_1;
+    CS_CHECK(pcmcia_get_first_tuple, handle, &tuple);
+    tuple.TupleData = buf;
+    tuple.TupleDataMax = MAX_TUPLE_SIZE;
+    tuple.TupleOffset = 2;
+    CS_CHECK(pcmcia_get_tuple_data, handle, &tuple);
+
+    for (i=0; i<tuple.TupleDataLen - 4; i++) 
+        if (buf[i] == 0) buf[i] = ' ';
+    printk(KERN_INFO "ray_cs Detected: %s\n",buf);
+
+    /* Configure card */
+    link->state |= DEV_CONFIG;
+
+    /* Now allocate an interrupt line.  Note that this does not
+       actually assign a handler to the interrupt.
+    */
+    CS_CHECK(pcmcia_request_irq, link->handle, &link->irq);
+    dev->irq = link->irq.AssignedIRQ;
+    
+    /* This actually configures the PCMCIA socket -- setting up
+       the I/O windows and the interrupt mapping.
+    */
+    CS_CHECK(pcmcia_request_configuration, link->handle, &link->conf);
+
+/*** Set up 32k window for shared memory (transmit and control) ************/
+    req.Attributes = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
+    req.Base = 0;
+    req.Size = 0x8000;
+    req.AccessSpeed = ray_mem_speed;
+    CS_CHECK(pcmcia_request_window, &link->handle, &req, &link->win);
+    mem.CardOffset = 0x0000; mem.Page = 0;
+    CS_CHECK(pcmcia_map_mem_page, link->win, &mem);
+    local->sram = (UCHAR *)(ioremap(req.Base,req.Size));
+
+/*** Set up 16k window for shared memory (receive buffer) ***************/
+    req.Attributes = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
+    req.Base = 0;
+    req.Size = 0x4000;
+    req.AccessSpeed = ray_mem_speed;
+    CS_CHECK(pcmcia_request_window, &link->handle, &req, &local->rmem_handle);
+    mem.CardOffset = 0x8000; mem.Page = 0;
+    CS_CHECK(pcmcia_map_mem_page, local->rmem_handle, &mem);
+    local->rmem = (UCHAR *)(ioremap(req.Base,req.Size));
+
+/*** Set up window for attribute memory ***********************************/
+    req.Attributes = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT;
+    req.Base = 0;
+    req.Size = 0x1000;
+    req.AccessSpeed = ray_mem_speed;
+    CS_CHECK(pcmcia_request_window, &link->handle, &req, &local->amem_handle);
+    mem.CardOffset = 0x0000; mem.Page = 0;
+    CS_CHECK(pcmcia_map_mem_page, local->amem_handle, &mem);
+    local->amem = (UCHAR *)(ioremap(req.Base,req.Size));
+
+    DEBUG(3,"ray_config sram=%p\n",local->sram);
+    DEBUG(3,"ray_config rmem=%p\n",local->rmem);
+    DEBUG(3,"ray_config amem=%p\n",local->amem);
+    if (ray_init(dev) < 0) {
+        ray_release((u_long)link);
+        return;
+    }
+
+    i = register_netdev(dev);
+    if (i != 0) {
+        printk("ray_config register_netdev() failed\n");
+        ray_release((u_long)link);
+        return;
+    }
+
+    strcpy(local->node.dev_name, dev->name);
+    link->dev = &local->node;
+
+    link->state &= ~DEV_CONFIG_PENDING;
+    printk(KERN_INFO "%s: RayLink, irq %d, hw_addr ",
+       dev->name, dev->irq);
+    for (i = 0; i < 6; i++)
+    printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : "\n"));
+
+    return;
+
+cs_failed:
+    cs_error(link->handle, last_fn, last_ret);
+
+    ray_release((u_long)link);
+} /* ray_config */
+/*===========================================================================*/
+static int ray_init(struct net_device *dev)
+{
+    int i;
+    UCHAR *p;
+    struct ccs *pccs;
+    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    dev_link_t *link = local->finder;
+    DEBUG(1, "ray_init(0x%p)\n", dev);
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(0,"ray_init - device not present\n");
+        return -1;
+    }
+
+    local->net_type = net_type;
+    local->sta_type = TYPE_STA;
+
+    /* Copy the startup results to local memory */
+    memcpy_fromio(&local->startup_res, local->sram + ECF_TO_HOST_BASE,\
+           sizeof(struct startup_res_6));
+
+    /* Check Power up test status and get mac address from card */
+    if (local->startup_res.startup_word != 0x80) {
+    printk(KERN_INFO "ray_init ERROR card status = %2x\n",
+           local->startup_res.startup_word);
+        local->card_status = CARD_INIT_ERROR;
+        return -1;
+    }
+
+    local->fw_ver = local->startup_res.firmware_version[0];
+    local->fw_bld = local->startup_res.firmware_version[1];
+    local->fw_var = local->startup_res.firmware_version[2];
+    DEBUG(1,"ray_init firmware version %d.%d \n",local->fw_ver, local->fw_bld);
+
+    local->tib_length = 0x20;
+    if ((local->fw_ver == 5) && (local->fw_bld >= 30))
+        local->tib_length = local->startup_res.tib_length;
+    DEBUG(2,"ray_init tib_length = 0x%02x\n", local->tib_length);
+    /* Initialize CCS's to buffer free state */
+    pccs = (struct ccs *)(local->sram + CCS_BASE);
+    for (i=0;  i<NUMBER_OF_CCS;  i++) {
+        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
+    }
+    init_startup_params(local);
+
+    /* copy mac address to startup parameters */
+    if (parse_addr(phy_addr, local->sparm.b4.a_mac_addr))
+    {
+        p = local->sparm.b4.a_mac_addr;
+    }
+    else
+    {
+        memcpy(&local->sparm.b4.a_mac_addr,
+               &local->startup_res.station_addr, ADDRLEN);
+        p = local->sparm.b4.a_mac_addr;
+    }
+
+    clear_interrupt(local); /* Clear any interrupt from the card */
+    local->card_status = CARD_AWAITING_PARAM;
+    DEBUG(2,"ray_init ending\n");
+    return 0;
+} /* ray_init */
+/*===========================================================================*/
+/* Download startup parameters to the card and command it to read them       */
+static int dl_startup_params(struct net_device *dev)
+{
+    int ccsindex;
+    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    struct ccs *pccs;
+    dev_link_t *link = local->finder;
+
+    DEBUG(1,"dl_startup_params entered\n");
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_cs dl_startup_params - device not present\n");
+        return -1;
+    }
+    
+    /* Copy parameters to host to ECF area */
+    if (local->fw_ver == 0x55) 
+        memcpy_toio(local->sram + HOST_TO_ECF_BASE, &local->sparm.b4,
+               sizeof(struct b4_startup_params));
+    else
+        memcpy_toio(local->sram + HOST_TO_ECF_BASE, &local->sparm.b5,
+               sizeof(struct b5_startup_params));
+
+    
+    /* Fill in the CCS fields for the ECF */
+    if ((ccsindex = get_free_ccs(local)) < 0) return -1;
+    local->dl_param_ccs = ccsindex;
+    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
+    writeb(CCS_DOWNLOAD_STARTUP_PARAMS, &pccs->cmd);
+    DEBUG(2,"dl_startup_params start ccsindex = %d\n", local->dl_param_ccs);
+    /* Interrupt the firmware to process the command */
+    if (interrupt_ecf(local, ccsindex)) {
+        printk(KERN_INFO "ray dl_startup_params failed - "
+           "ECF not ready for intr\n");
+        local->card_status = CARD_DL_PARAM_ERROR;
+        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
+        return -2;
+    }
+    local->card_status = CARD_DL_PARAM;
+    /* Start kernel timer to wait for dl startup to complete. */
+    local->timer.expires = jiffies + HZ/2;
+    local->timer.data = (long)local;
+    local->timer.function = &verify_dl_startup;
+    add_timer(&local->timer);
+    DEBUG(2,"ray_cs dl_startup_params started timer for verify_dl_startup\n");
+    return 0;
+} /* dl_startup_params */
+/*===========================================================================*/
+static void init_startup_params(ray_dev_t *local)
+{
+    int i; 
+
+    if (country > JAPAN_TEST) country = USA;
+    else
+        if (country < USA) country = USA;
+    /* structure for hop time and beacon period is defined here using 
+     * New 802.11D6.1 format.  Card firmware is still using old format
+     * until version 6.
+     *    Before                    After
+     *    a_hop_time ms byte        a_hop_time ms byte
+     *    a_hop_time 2s byte        a_hop_time ls byte
+     *    a_hop_time ls byte        a_beacon_period ms byte
+     *    a_beacon_period           a_beacon_period ls byte
+     *
+     *    a_hop_time = uS           a_hop_time = KuS
+     *    a_beacon_period = hops    a_beacon_period = KuS
+     */                             /* 64ms = 010000 */
+    if (local->fw_ver == 0x55)  {
+        memcpy((UCHAR *)&local->sparm.b4, b4_default_startup_parms, 
+               sizeof(struct b4_startup_params));
+        /* Translate sane kus input values to old build 4/5 format */
+        /* i = hop time in uS truncated to 3 bytes */
+        i = (hop_dwell * 1024) & 0xffffff;
+        local->sparm.b4.a_hop_time[0] = (i >> 16) & 0xff;
+        local->sparm.b4.a_hop_time[1] = (i >> 8) & 0xff;
+        local->sparm.b4.a_beacon_period[0] = 0;
+        local->sparm.b4.a_beacon_period[1] =
+            ((beacon_period/hop_dwell) - 1) & 0xff;
+        local->sparm.b4.a_curr_country_code = country;
+        local->sparm.b4.a_hop_pattern_length = 
+            hop_pattern_length[(int)country] - 1;
+        if (bc)
+        {
+            local->sparm.b4.a_ack_timeout = 0x50;
+            local->sparm.b4.a_sifs = 0x3f;
+        }
+    }
+    else {    /* Version 5 uses real kus values */
+        memcpy((UCHAR *)&local->sparm.b5, b5_default_startup_parms, 
+               sizeof(struct b5_startup_params));
+
+        local->sparm.b5.a_hop_time[0] = (hop_dwell >> 8) & 0xff;
+        local->sparm.b5.a_hop_time[1] = hop_dwell & 0xff;
+        local->sparm.b5.a_beacon_period[0] = (beacon_period >> 8) & 0xff;
+        local->sparm.b5.a_beacon_period[1] = beacon_period & 0xff;
+        if (psm)
+            local->sparm.b5.a_power_mgt_state = 1;
+        local->sparm.b5.a_curr_country_code = country;
+        local->sparm.b5.a_hop_pattern_length = 
+            hop_pattern_length[(int)country];
+    }
+    
+    local->sparm.b4.a_network_type = net_type & 0x01;
+    local->sparm.b4.a_acting_as_ap_status = TYPE_STA;
+
+    if (essid != NULL)
+        strncpy(local->sparm.b4.a_current_ess_id, essid, ESSID_SIZE);
+} /* init_startup_params */ 
+/*===========================================================================*/
+static void verify_dl_startup(u_long data)
+{
+    ray_dev_t *local = (ray_dev_t *)data;
+    struct ccs *pccs = ((struct ccs *)(local->sram + CCS_BASE)) + local->dl_param_ccs;
+    UCHAR status;
+    dev_link_t *link = local->finder;
+
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_cs verify_dl_startup - device not present\n");
+        return;
+    }
+#ifdef PCMCIA_DEBUG
+    if (pc_debug > 2) {
+    int i;
+    printk(KERN_DEBUG "verify_dl_startup parameters sent via ccs %d:\n",
+           local->dl_param_ccs);
+        for (i=0; i<sizeof(struct b5_startup_params); i++) {
+            printk(" %2x", (unsigned int) readb(local->sram + HOST_TO_ECF_BASE + i));
+        }
+    printk("\n");
+    }
+#endif
+
+    status = readb(&pccs->buffer_status);
+    if (status!= CCS_BUFFER_FREE)
+    {
+        printk(KERN_INFO "Download startup params failed.  Status = %d\n",
+           status);
+        local->card_status = CARD_DL_PARAM_ERROR;
+        return;
+    }
+    if (local->sparm.b4.a_network_type == ADHOC)
+        start_net((u_long)local);
+    else
+        join_net((u_long)local);
+
+    return;
+} /* end verify_dl_startup */
+/*===========================================================================*/
+/* Command card to start a network */
+static void start_net(u_long data)
+{
+    ray_dev_t *local = (ray_dev_t *)data;
+    struct ccs *pccs;
+    int ccsindex;
+    dev_link_t *link = local->finder;
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_cs start_net - device not present\n");
+        return;
+    }
+    /* Fill in the CCS fields for the ECF */
+    if ((ccsindex = get_free_ccs(local)) < 0) return;
+    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
+    writeb(CCS_START_NETWORK, &pccs->cmd);
+    writeb(0, &pccs->var.start_network.update_param);
+    /* Interrupt the firmware to process the command */
+    if (interrupt_ecf(local, ccsindex)) {
+        DEBUG(1,"ray start net failed - card not ready for intr\n");
+        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
+        return;
+    }
+    local->card_status = CARD_DOING_ACQ;
+    return;
+} /* end start_net */
+/*===========================================================================*/
+/* Command card to join a network */
+static void join_net(u_long data)
+{
+    ray_dev_t *local = (ray_dev_t *)data;
+
+    struct ccs *pccs;
+    int ccsindex;
+    dev_link_t *link = local->finder;
+    
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_cs join_net - device not present\n");
+        return;
+    }
+    /* Fill in the CCS fields for the ECF */
+    if ((ccsindex = get_free_ccs(local)) < 0) return;
+    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
+    writeb(CCS_JOIN_NETWORK, &pccs->cmd);
+    writeb(0, &pccs->var.join_network.update_param);
+    writeb(0, &pccs->var.join_network.net_initiated);
+    /* Interrupt the firmware to process the command */
+    if (interrupt_ecf(local, ccsindex)) {
+        DEBUG(1,"ray join net failed - card not ready for intr\n");
+        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
+        return;
+    }
+    local->card_status = CARD_DOING_ACQ;
+    return;
+}
+/*============================================================================
+    After a card is removed, ray_release() will unregister the net
+    device, and release the PCMCIA configuration.  If the device is
+    still open, this will be postponed until it is closed.
+=============================================================================*/
+static void ray_release(u_long arg)
+{
+    dev_link_t *link = (dev_link_t *)arg;
+    struct net_device *dev = link->priv; 
+    ray_dev_t *local = dev->priv;
+    int i;
+    
+    DEBUG(1, "ray_release(0x%p)\n", link);
+    /* If the device is currently in use, we won't release until it
+      is actually closed.
+    */
+    if (link->open) {
+        DEBUG(1, "ray_cs: release postponed, '%s' still open\n",
+              link->dev->dev_name);
+        link->state |= DEV_STALE_CONFIG;
+        return;
+    }
+    del_timer(&local->timer);
+    link->state &= ~DEV_CONFIG;
+
+    iounmap(local->sram);
+    iounmap(local->rmem);
+    iounmap(local->amem);
+    /* Do bother checking to see if these succeed or not */
+    i = pcmcia_release_window(link->win);
+    if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(link->win) ret = %x\n",i);
+    i = pcmcia_release_window(local->amem_handle);
+    if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->amem) ret = %x\n",i);
+    i = pcmcia_release_window(local->rmem_handle);
+    if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->rmem) ret = %x\n",i);
+    i = pcmcia_release_configuration(link->handle);
+    if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseConfiguration ret = %x\n",i);
+    i = pcmcia_release_irq(link->handle, &link->irq);
+    if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseIRQ ret = %x\n",i);
+
+    DEBUG(2,"ray_release ending\n");
+} /* ray_release */
+/*=============================================================================
+    The card status event handler.  Mostly, this schedules other
+    stuff to run after an event is received.  A CARD_REMOVAL event
+    also sets some flags to discourage the net drivers from trying
+    to talk to the card any more.
+
+    When a CARD_REMOVAL event is received, we immediately set a flag
+    to block future accesses to this device.  All the functions that
+    actually access the device should check this flag to make sure
+    the card is still present.
+=============================================================================*/
+static int ray_event(event_t event, int priority,
+                     event_callback_args_t *args)
+{
+    dev_link_t *link = args->client_data;
+    struct net_device *dev = link->priv;
+    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    DEBUG(1, "ray_event(0x%06x)\n", event);
+    
+    switch (event) {
+    case CS_EVENT_CARD_REMOVAL:
+        link->state &= ~DEV_PRESENT;
+        netif_device_detach(dev);
+        if (link->state & DEV_CONFIG) {
+            mod_timer(&link->release, jiffies + HZ/20);
+            del_timer(&local->timer);
+        }
+        break;
+    case CS_EVENT_CARD_INSERTION:
+        link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
+        ray_config(link);
+        break;
+    case CS_EVENT_PM_SUSPEND:
+        link->state |= DEV_SUSPEND;
+        /* Fall through... */
+    case CS_EVENT_RESET_PHYSICAL:
+        if (link->state & DEV_CONFIG) {
+            if (link->open)
+            	netif_device_detach(dev);
+
+            pcmcia_release_configuration(link->handle);
+        }
+        break;
+    case CS_EVENT_PM_RESUME:
+        link->state &= ~DEV_SUSPEND;
+        /* Fall through... */
+    case CS_EVENT_CARD_RESET:
+        if (link->state & DEV_CONFIG) {
+            pcmcia_request_configuration(link->handle, &link->conf);
+            if (link->open) {
+                ray_reset(dev);
+		netif_device_attach(dev);
+            }
+        }
+        break;
+    }
+    return 0;
+    DEBUG(2,"ray_event ending\n");
+} /* ray_event */
+/*===========================================================================*/
+int ray_dev_init(struct net_device *dev)
+{
+#ifdef RAY_IMMEDIATE_INIT
+    int i;
+#endif	/* RAY_IMMEDIATE_INIT */
+    ray_dev_t *local = dev->priv;
+    dev_link_t *link = local->finder;
+
+    DEBUG(1,"ray_dev_init(dev=%p)\n",dev);
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_dev_init - device not present\n");
+        return -1;
+    }
+#ifdef RAY_IMMEDIATE_INIT
+    /* Download startup parameters */
+    if ( (i = dl_startup_params(dev)) < 0)
+    {
+        printk(KERN_INFO "ray_dev_init dl_startup_params failed - "
+           "returns 0x%x\n",i);
+        return -1;
+    }
+#else	/* RAY_IMMEDIATE_INIT */
+    /* Postpone the card init so that we can still configure the card,
+     * for example using the Wireless Extensions. The init will happen
+     * in ray_open() - Jean II */
+    DEBUG(1,"ray_dev_init: postponing card init to ray_open() ; Status = %d\n",
+	  local->card_status);
+#endif	/* RAY_IMMEDIATE_INIT */
+
+    /* copy mac and broadcast addresses to linux device */
+    memcpy(&dev->dev_addr, &local->sparm.b4.a_mac_addr, ADDRLEN);
+    memset(dev->broadcast, 0xff, ETH_ALEN);
+
+    DEBUG(2,"ray_dev_init ending\n");
+    return 0;
+}
+/*===========================================================================*/
+static int ray_dev_config(struct net_device *dev, struct ifmap *map)
+{
+    ray_dev_t *local = dev->priv;
+    dev_link_t *link = local->finder;
+    /* Dummy routine to satisfy device structure */
+    DEBUG(1,"ray_dev_config(dev=%p,ifmap=%p)\n",dev,map);
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_dev_config - device not present\n");
+        return -1;
+    }
+
+    return 0;
+}
+/*===========================================================================*/
+static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+    ray_dev_t *local = dev->priv;
+    dev_link_t *link = local->finder;
+    short length = skb->len;
+
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_dev_start_xmit - device not present\n");
+        return -1;
+    }
+    DEBUG(3,"ray_dev_start_xmit(skb=%p, dev=%p)\n",skb,dev);
+    if (local->authentication_state == NEED_TO_AUTH) {
+        DEBUG(0,"ray_cs Sending authentication request.\n");
+        if (!build_auth_frame (local, local->auth_id, OPEN_AUTH_REQUEST)) {
+            local->authentication_state = AUTHENTICATED;
+            netif_stop_queue(dev);
+            return 1;
+        }
+    }
+
+    if (length < ETH_ZLEN)
+    {
+    	skb = skb_padto(skb, ETH_ZLEN);
+    	if (skb == NULL)
+    		return 0;
+    	length = ETH_ZLEN;
+    }
+    switch (ray_hw_xmit( skb->data, length, dev, DATA_TYPE)) {
+        case XMIT_NO_CCS:
+        case XMIT_NEED_AUTH:
+	    netif_stop_queue(dev);
+            return 1;
+        case XMIT_NO_INTR:
+        case XMIT_MSG_BAD:
+        case XMIT_OK:
+        default:
+            dev->trans_start = jiffies;
+            dev_kfree_skb(skb);
+            return 0;
+    }
+    return 0;
+} /* ray_dev_start_xmit */
+/*===========================================================================*/
+static int ray_hw_xmit(unsigned char* data, int len, struct net_device* dev, 
+                UCHAR msg_type)
+{
+    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    struct ccs *pccs;
+    int ccsindex;
+    int offset;
+    struct tx_msg *ptx; /* Address of xmit buffer in PC space */
+    short int addr;     /* Address of xmit buffer in card space */
+    
+    DEBUG(3,"ray_hw_xmit(data=%p, len=%d, dev=%p)\n",data,len,dev);
+    if (len + TX_HEADER_LENGTH > TX_BUF_SIZE)
+    {
+        printk(KERN_INFO "ray_hw_xmit packet too large: %d bytes\n",len);
+        return XMIT_MSG_BAD;
+    }
+	switch (ccsindex = get_free_tx_ccs(local)) {
+	case ECCSBUSY:
+		DEBUG(2,"ray_hw_xmit tx_ccs table busy\n");
+	case ECCSFULL:
+        DEBUG(2,"ray_hw_xmit No free tx ccs\n");
+	case ECARDGONE:
+	netif_stop_queue(dev);
+        return XMIT_NO_CCS;
+	default:
+		break;
+	}
+    addr = TX_BUF_BASE + (ccsindex << 11);
+
+    if (msg_type == DATA_TYPE) {
+        local->stats.tx_bytes += len;
+        local->stats.tx_packets++;
+    }
+
+    ptx = (struct tx_msg *)(local->sram + addr);
+
+    ray_build_header(local, ptx, msg_type, data);
+    if (translate) {
+        offset = translate_frame(local, ptx, data, len);
+    }
+    else { /* Encapsulate frame */
+        /* TBD TIB length will move address of ptx->var */
+        memcpy_toio(&ptx->var, data, len);
+        offset = 0;
+    }
+
+    /* fill in the CCS */
+    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
+    len += TX_HEADER_LENGTH + offset;
+    writeb(CCS_TX_REQUEST, &pccs->cmd);
+    writeb(addr >> 8, &pccs->var.tx_request.tx_data_ptr[0]);
+    writeb(local->tib_length, &pccs->var.tx_request.tx_data_ptr[1]);
+    writeb(len >> 8, &pccs->var.tx_request.tx_data_length[0]);
+    writeb(len & 0xff, &pccs->var.tx_request.tx_data_length[1]);
+/* TBD still need psm_cam? */
+    writeb(PSM_CAM, &pccs->var.tx_request.pow_sav_mode);
+    writeb(local->net_default_tx_rate, &pccs->var.tx_request.tx_rate);
+    writeb(0, &pccs->var.tx_request.antenna);
+    DEBUG(3,"ray_hw_xmit default_tx_rate = 0x%x\n",\
+          local->net_default_tx_rate);
+
+    /* Interrupt the firmware to process the command */
+    if (interrupt_ecf(local, ccsindex)) {
+        DEBUG(2,"ray_hw_xmit failed - ECF not ready for intr\n");
+/* TBD very inefficient to copy packet to buffer, and then not
+   send it, but the alternative is to queue the messages and that
+   won't be done for a while.  Maybe set tbusy until a CCS is free?
+*/
+        writeb(CCS_BUFFER_FREE, &pccs->buffer_status);
+        return XMIT_NO_INTR;
+    }
+    return XMIT_OK;
+} /* end ray_hw_xmit */
+/*===========================================================================*/
+static int translate_frame(ray_dev_t *local, struct tx_msg *ptx, unsigned char *data,
+                    int len)
+{
+    unsigned short int proto = ((struct ethhdr *)data)->h_proto;
+    if (ntohs(proto) >= 1536) { /* DIX II ethernet frame */
+        DEBUG(3,"ray_cs translate_frame DIX II\n");
+        /* Copy LLC header to card buffer */
+        memcpy_toio((UCHAR *)&ptx->var, eth2_llc, sizeof(eth2_llc));
+        memcpy_toio( ((UCHAR *)&ptx->var) + sizeof(eth2_llc), (UCHAR *)&proto, 2);
+        if ((proto == 0xf380) || (proto == 0x3781)) {
+            /* This is the selective translation table, only 2 entries */
+            writeb(0xf8, (UCHAR *) &((struct snaphdr_t *)ptx->var)->org[3]);
+        }
+        /* Copy body of ethernet packet without ethernet header */
+        memcpy_toio((UCHAR *)&ptx->var + sizeof(struct snaphdr_t), \
+                    data + ETH_HLEN,  len - ETH_HLEN);
+        return (int) sizeof(struct snaphdr_t) - ETH_HLEN;
+    }
+    else { /* already  802 type, and proto is length */
+        DEBUG(3,"ray_cs translate_frame 802\n");
+        if (proto == 0xffff) { /* evil netware IPX 802.3 without LLC */
+        DEBUG(3,"ray_cs translate_frame evil IPX\n");
+            memcpy_toio((UCHAR *)&ptx->var, data + ETH_HLEN,  len - ETH_HLEN);
+            return 0 - ETH_HLEN;
+        }
+        memcpy_toio((UCHAR *)&ptx->var, data + ETH_HLEN,  len - ETH_HLEN);
+        return 0 - ETH_HLEN;
+    }
+    /* TBD do other frame types */
+} /* end translate_frame */
+/*===========================================================================*/
+static void ray_build_header(ray_dev_t *local, struct tx_msg *ptx, UCHAR msg_type,
+                unsigned char *data)
+{
+    writeb(PROTOCOL_VER | msg_type, &ptx->mac.frame_ctl_1);
+/*** IEEE 802.11 Address field assignments *************
+                TODS FROMDS   addr_1     addr_2          addr_3   addr_4
+Adhoc           0    0        dest       src (terminal)  BSSID    N/A
+AP to Terminal  0    1        dest       AP(BSSID)       source   N/A
+Terminal to AP  1    0        AP(BSSID)  src (terminal)  dest     N/A
+AP to AP        1    1        dest AP    src AP          dest     source      
+*******************************************************/
+    if (local->net_type == ADHOC) {   
+        writeb(0, &ptx->mac.frame_ctl_2);
+        memcpy_toio(ptx->mac.addr_1, ((struct ethhdr *)data)->h_dest, 2 * ADDRLEN);
+        memcpy_toio(ptx->mac.addr_3, local->bss_id, ADDRLEN);
+    }
+    else /* infrastructure */
+    {
+        if (local->sparm.b4.a_acting_as_ap_status)
+        {
+            writeb(FC2_FROM_DS, &ptx->mac.frame_ctl_2);
+            memcpy_toio(ptx->mac.addr_1, ((struct ethhdr *)data)->h_dest, ADDRLEN);
+            memcpy_toio(ptx->mac.addr_2, local->bss_id, 6);
+            memcpy_toio(ptx->mac.addr_3, ((struct ethhdr *)data)->h_source, ADDRLEN);
+        }
+        else /* Terminal */
+        {
+            writeb(FC2_TO_DS, &ptx->mac.frame_ctl_2);
+            memcpy_toio(ptx->mac.addr_1, local->bss_id, ADDRLEN);
+            memcpy_toio(ptx->mac.addr_2, ((struct ethhdr *)data)->h_source, ADDRLEN);
+            memcpy_toio(ptx->mac.addr_3, ((struct ethhdr *)data)->h_dest, ADDRLEN);
+        }
+    }
+} /* end encapsulate_frame */
+
+
+/*===========================================================================*/
+
+static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
+{
+	u32 ethcmd;
+		
+	if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
+		return -EFAULT;
+	
+	switch (ethcmd) {
+	case ETHTOOL_GDRVINFO: {
+		struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
+		strncpy(info.driver, "ray_cs", sizeof(info.driver)-1);
+		if (copy_to_user(useraddr, &info, sizeof(info)))
+			return -EFAULT;
+		return 0;
+	}
+	}
+	
+	return -EOPNOTSUPP;
+}
+
+/*====================================================================*/
+
+static int ray_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    dev_link_t *link = local->finder;
+    int err = 0;
+#if WIRELESS_EXT > 7
+    struct iwreq *wrq = (struct iwreq *) ifr;
+#endif	/* WIRELESS_EXT > 7 */
+
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_dev_ioctl - device not present\n");
+        return -1;
+    }
+    DEBUG(2,"ray_cs IOCTL dev=%p, ifr=%p, cmd = 0x%x\n",dev,ifr,cmd);
+    /* Validate the command */
+    switch (cmd)
+    {
+    case SIOCETHTOOL:
+      err = netdev_ethtool_ioctl(dev, (void *) ifr->ifr_data);
+      break;
+
+#if WIRELESS_EXT > 7
+      /* --------------- WIRELESS EXTENSIONS --------------- */
+      /* Get name */
+    case SIOCGIWNAME:
+      strcpy(wrq->u.name, "IEEE 802.11-FH");
+      break;
+
+      /* Get frequency/channel */
+    case SIOCGIWFREQ:
+      wrq->u.freq.m = local->sparm.b5.a_hop_pattern;
+      wrq->u.freq.e = 0;
+      break;
+
+      /* Set frequency/channel */
+    case SIOCSIWFREQ:
+      /* Reject if card is already initialised */
+      if(local->card_status != CARD_AWAITING_PARAM)
+	{
+	  err = -EBUSY;
+	  break;
+	}
+
+      /* Setting by channel number */
+      if ((wrq->u.freq.m > USA_HOP_MOD) || (wrq->u.freq.e > 0))
+	err = -EOPNOTSUPP;
+      else
+	  local->sparm.b5.a_hop_pattern = wrq->u.freq.m;
+      break;
+
+      /* Get current network name (ESSID) */
+    case SIOCGIWESSID:
+      if (wrq->u.data.pointer)
+	{
+	  char essid[IW_ESSID_MAX_SIZE + 1];
+	  /* Get the essid that was set */
+	  memcpy(essid, local->sparm.b5.a_current_ess_id,
+		 IW_ESSID_MAX_SIZE);
+	  essid[IW_ESSID_MAX_SIZE] = '\0';
+
+	  /* Push it out ! */
+	  wrq->u.data.length = strlen(essid) + 1;
+	  wrq->u.data.flags = 1; /* active */
+	  copy_to_user(wrq->u.data.pointer, essid, sizeof(essid));
+	}
+      break;
+
+      /* Set desired network name (ESSID) */
+    case SIOCSIWESSID:
+      /* Reject if card is already initialised */
+      if(local->card_status != CARD_AWAITING_PARAM)
+	{
+	  err = -EBUSY;
+	  break;
+	}
+
+	if (wrq->u.data.pointer)
+	{
+	    char	card_essid[IW_ESSID_MAX_SIZE + 1];
+	    
+	    /* Check if we asked for `any' */
+	    if(wrq->u.data.flags == 0)
+	    {
+		/* Corey : can you do that ? */
+		err = -EOPNOTSUPP;
+	    }
+	    else
+	    {
+		/* Check the size of the string */
+		if(wrq->u.data.length >
+		   IW_ESSID_MAX_SIZE + 1)
+		{
+		    err = -E2BIG;
+		    break;
+		}
+		if (copy_from_user(card_essid,
+				   wrq->u.data.pointer,
+				   wrq->u.data.length)) {
+			err = -EFAULT;
+			break;
+		}
+		card_essid[IW_ESSID_MAX_SIZE] = '\0';
+
+		/* Set the ESSID in the card */
+		memcpy(local->sparm.b5.a_current_ess_id, card_essid,
+		       IW_ESSID_MAX_SIZE);
+	    }
+	}
+	break;
+
+      /* Get current Access Point (BSSID in our case) */
+    case SIOCGIWAP:
+      memcpy(wrq->u.ap_addr.sa_data, local->bss_id, ETH_ALEN);
+      wrq->u.ap_addr.sa_family = ARPHRD_ETHER;
+      break;
+
+      /* Get the current bit-rate */
+    case SIOCGIWRATE:
+      if(local->net_default_tx_rate == 3)
+	wrq->u.bitrate.value = 2000000;		/* Hum... */
+      else
+	wrq->u.bitrate.value = local->net_default_tx_rate * 500000;
+      wrq->u.bitrate.fixed = 0;		/* We are in auto mode */
+      break;
+
+      /* Set the desired bit-rate */
+    case SIOCSIWRATE:
+      /* Check if rate is in range */
+      if((wrq->u.bitrate.value != 1000000) &&
+	 (wrq->u.bitrate.value != 2000000))
+	{
+	  err = -EINVAL;
+	  break;
+	}
+      /* Hack for 1.5 Mb/s instead of 2 Mb/s */
+      if((local->fw_ver == 0x55) &&		/* Please check */
+	 (wrq->u.bitrate.value == 2000000))
+	local->net_default_tx_rate = 3;
+      else
+	local->net_default_tx_rate = wrq->u.bitrate.value/500000;
+      break;
+
+      /* Get the current RTS threshold */
+    case SIOCGIWRTS:
+      wrq->u.rts.value = (local->sparm.b5.a_rts_threshold[0] << 8)
+	+ local->sparm.b5.a_rts_threshold[1];
+#if WIRELESS_EXT > 8
+      wrq->u.rts.disabled = (wrq->u.rts.value == 32767);
+#endif /* WIRELESS_EXT > 8 */
+      wrq->u.rts.fixed = 1;
+      break;
+
+      /* Set the desired RTS threshold */
+    case SIOCSIWRTS:
+    {
+	int rthr = wrq->u.rts.value;
+
+      /* Reject if card is already initialised */
+      if(local->card_status != CARD_AWAITING_PARAM)
+	{
+	  err = -EBUSY;
+	  break;
+	}
+
+	/* if(wrq->u.rts.fixed == 0) we should complain */
+#if WIRELESS_EXT > 8
+	if(wrq->u.rts.disabled)
+	    rthr = 32767;
+	else
+#endif /* WIRELESS_EXT > 8 */
+	    if((rthr < 0) || (rthr > 2347)) /* What's the max packet size ??? */
+	    {
+		err = -EINVAL;
+		break;
+	    }
+	local->sparm.b5.a_rts_threshold[0] = (rthr >> 8) & 0xFF;
+	local->sparm.b5.a_rts_threshold[1] = rthr & 0xFF;
+    }
+    break;
+
+      /* Get the current fragmentation threshold */
+    case SIOCGIWFRAG:
+      wrq->u.frag.value = (local->sparm.b5.a_frag_threshold[0] << 8)
+	+ local->sparm.b5.a_frag_threshold[1];
+#if WIRELESS_EXT > 8
+      wrq->u.frag.disabled = (wrq->u.frag.value == 32767);
+#endif /* WIRELESS_EXT > 8 */
+      wrq->u.frag.fixed = 1;
+      break;
+
+      /* Set the desired fragmentation threshold */
+    case SIOCSIWFRAG:
+    {
+	int fthr = wrq->u.frag.value;
+
+      /* Reject if card is already initialised */
+      if(local->card_status != CARD_AWAITING_PARAM)
+	{
+	  err = -EBUSY;
+	  break;
+	}
+
+	/* if(wrq->u.frag.fixed == 0) should complain */
+#if WIRELESS_EXT > 8
+	if(wrq->u.frag.disabled)
+	    fthr = 32767;
+	else
+#endif /* WIRELESS_EXT > 8 */
+	    if((fthr < 256) || (fthr > 2347)) /* To check out ! */
+	    {
+		err = -EINVAL;
+		break;
+	    }
+	local->sparm.b5.a_frag_threshold[0] = (fthr >> 8) & 0xFF;
+	local->sparm.b5.a_frag_threshold[1] = fthr & 0xFF;
+    }
+    break;
+
+#endif	/* WIRELESS_EXT > 7 */
+#if WIRELESS_EXT > 8
+
+      /* Get the current mode of operation */
+    case SIOCGIWMODE:
+      if(local->sparm.b5.a_network_type)
+	wrq->u.mode = IW_MODE_INFRA;
+      else
+	wrq->u.mode = IW_MODE_ADHOC;
+      break;
+
+      /* Set the current mode of operation */
+    case SIOCSIWMODE:
+    {
+	char card_mode = 1;
+	
+      /* Reject if card is already initialised */
+      if(local->card_status != CARD_AWAITING_PARAM)
+	{
+	  err = -EBUSY;
+	  break;
+	}
+
+	switch (wrq->u.mode)
+	{
+	case IW_MODE_ADHOC:
+	    card_mode = 0;
+	    // Fall through
+	case IW_MODE_INFRA:
+	    local->sparm.b5.a_network_type = card_mode;
+	    break;
+	default:
+	    err = -EINVAL;
+	}
+    }
+    break;
+
+#endif /* WIRELESS_EXT > 8 */
+#if WIRELESS_EXT > 7
+      /* ------------------ IWSPY SUPPORT ------------------ */
+      /* Define the range (variations) of above parameters */
+    case SIOCGIWRANGE:
+      /* Basic checking... */
+      if(wrq->u.data.pointer != (caddr_t) 0)
+	{
+	  struct iw_range	range;
+	  memset((char *) &range, 0, sizeof(struct iw_range));
+
+	  /* Set the length (very important for backward compatibility) */
+	  wrq->u.data.length = sizeof(struct iw_range);
+
+#if WIRELESS_EXT > 10
+	  /* Set the Wireless Extension versions */
+	  range.we_version_compiled = WIRELESS_EXT;
+	  range.we_version_source = 9;
+#endif /* WIRELESS_EXT > 10 */
+
+	  /* Set information in the range struct */
+	  range.throughput = 1.1 * 1000 * 1000;	/* Put the right number here */
+	  range.num_channels = hop_pattern_length[(int)country]; 
+	  range.num_frequency = 0;
+	  range.max_qual.qual = 0;
+	  range.max_qual.level = 255;	/* What's the correct value ? */
+	  range.max_qual.noise = 255;	/* Idem */
+	  range.num_bitrates = 2;
+	  range.bitrate[0] = 1000000;	/* 1 Mb/s */
+	  range.bitrate[1] = 2000000;	/* 2 Mb/s */
+
+	  /* Copy structure to the user buffer */
+	  if(copy_to_user(wrq->u.data.pointer, &range,
+			  sizeof(struct iw_range)))
+	    err = -EFAULT;
+	}
+      break;
+
+#ifdef WIRELESS_SPY
+      /* Set addresses to spy */
+    case SIOCSIWSPY:
+      /* Check the number of addresses */
+      if(wrq->u.data.length > IW_MAX_SPY)
+	{
+	  err = -E2BIG;
+	  break;
+	}
+      local->spy_number = wrq->u.data.length;
+
+      /* If there is some addresses to copy */
+      if(local->spy_number > 0)
+	{
+	  struct sockaddr	address[IW_MAX_SPY];
+	  int			i;
+
+	  /* Copy addresses to the driver */
+	  if(copy_from_user(address, wrq->u.data.pointer,
+			    sizeof(struct sockaddr) * local->spy_number))
+	    {
+	      err = -EFAULT;
+	      break;
+	    }
+
+	  /* Copy addresses to the lp structure */
+	  for(i = 0; i < local->spy_number; i++)
+	    memcpy(local->spy_address[i], address[i].sa_data, ETH_ALEN);
+
+	  /* Reset structure... */
+	  memset(local->spy_stat, 0x00, sizeof(iw_qual) * IW_MAX_SPY);
+
+#ifdef DEBUG_IOCTL_INFO
+	  printk(KERN_DEBUG "SetSpy - Set of new addresses is :\n");
+	  for(i = 0; i < local->spy_number; i++)
+	    printk(KERN_DEBUG "%02X:%02X:%02X:%02X:%02X:%02X\n",
+		   local->spy_address[i][0],
+		   local->spy_address[i][1],
+		   local->spy_address[i][2],
+		   local->spy_address[i][3],
+		   local->spy_address[i][4],
+		   local->spy_address[i][5]);
+#endif	/* DEBUG_IOCTL_INFO */
+	}
+      break;
+
+      /* Get the spy list and spy stats */
+    case SIOCGIWSPY:
+      /* Set the number of addresses */
+      wrq->u.data.length = local->spy_number;
+
+      /* If the user want to have the addresses back... */
+      if((local->spy_number > 0) && (wrq->u.data.pointer != (caddr_t) 0))
+	{
+	  struct sockaddr	address[IW_MAX_SPY];
+	  int			i;
+
+	  /* Copy addresses from the lp structure */
+	  for(i = 0; i < local->spy_number; i++)
+	    {
+	      memcpy(address[i].sa_data, local->spy_address[i], ETH_ALEN);
+	      address[i].sa_family = ARPHRD_ETHER;
+	    }
+
+	  /* Copy addresses to the user buffer */
+	  if(copy_to_user(wrq->u.data.pointer, address,
+		       sizeof(struct sockaddr) * local->spy_number))
+	    {
+	      err = -EFAULT;
+	      break;
+	    }
+
+	  /* Copy stats to the user buffer (just after) */
+	  if(copy_to_user(wrq->u.data.pointer +
+		       (sizeof(struct sockaddr) * local->spy_number),
+		       local->spy_stat, sizeof(iw_qual) * local->spy_number))
+	    {
+	      err = -EFAULT;
+	      break;
+	    }
+
+	  /* Reset updated flags */
+	  for(i = 0; i < local->spy_number; i++)
+	    local->spy_stat[i].updated = 0x0;
+	}	/* if(pointer != NULL) */
+
+      break;
+#endif	/* WIRELESS_SPY */
+
+      /* ------------------ PRIVATE IOCTL ------------------ */
+#ifndef SIOCIWFIRSTPRIV
+#define SIOCIWFIRSTPRIV	SIOCDEVPRIVATE
+#endif /* SIOCIWFIRSTPRIV */
+#define SIOCSIPFRAMING	SIOCIWFIRSTPRIV		/* Set framing mode */
+#define SIOCGIPFRAMING	SIOCIWFIRSTPRIV + 1	/* Get framing mode */
+#define SIOCGIPCOUNTRY	SIOCIWFIRSTPRIV + 3	/* Get country code */
+    case SIOCSIPFRAMING:
+      if(!capable(CAP_NET_ADMIN))	/* For private IOCTLs, we need to check permissions */
+	{
+	  err = -EPERM;
+	  break;
+	}
+      translate = *(wrq->u.name);	/* Set framing mode */
+      break;
+    case SIOCGIPFRAMING:
+      *(wrq->u.name) = translate;
+      break;
+    case SIOCGIPCOUNTRY:
+      *(wrq->u.name) = country;
+      break;
+    case SIOCGIWPRIV:
+      /* Export our "private" intercace */
+      if(wrq->u.data.pointer != (caddr_t) 0)
+	{
+	  struct iw_priv_args	priv[] =
+	  {	/* cmd,		set_args,	get_args,	name */
+	    { SIOCSIPFRAMING, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, "set_framing" },
+	    { SIOCGIPFRAMING, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "get_framing" },
+	    { SIOCGIPCOUNTRY, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "get_country" },
+	  };
+	  /* Set the number of ioctl available */
+	  wrq->u.data.length = 3;
+	  /* Copy structure to the user buffer */
+	  if(copy_to_user(wrq->u.data.pointer, (u_char *) priv,
+		       sizeof(priv)))
+	    err = -EFAULT;
+	}
+      break;
+#endif	/* WIRELESS_EXT > 7 */
+
+
+        default:
+            DEBUG(0,"ray_dev_ioctl cmd = 0x%x\n", cmd);
+            err = -EOPNOTSUPP;
+    }
+    return err;
+} /* end ray_dev_ioctl */
+/*===========================================================================*/
+#if WIRELESS_EXT > 7	/* If wireless extension exist in the kernel */
+static iw_stats * ray_get_wireless_stats(struct net_device *	dev)
+{
+  ray_dev_t *	local = (ray_dev_t *) dev->priv;
+  dev_link_t *link = local->finder;
+  struct status *p = (struct status *)(local->sram + STATUS_BASE);
+
+  if(local == (ray_dev_t *) NULL)
+    return (iw_stats *) NULL;
+
+  local->wstats.status = local->card_status;
+#ifdef WIRELESS_SPY
+  if((local->spy_number > 0) && (local->sparm.b5.a_network_type == 0))
+    {
+      /* Get it from the first node in spy list */
+      local->wstats.qual.qual = local->spy_stat[0].qual;
+      local->wstats.qual.level = local->spy_stat[0].level;
+      local->wstats.qual.noise = local->spy_stat[0].noise;
+      local->wstats.qual.updated = local->spy_stat[0].updated;
+    }
+#endif /* WIRELESS_SPY */
+
+  if((link->state & DEV_PRESENT)) {
+    local->wstats.qual.noise = readb(&p->rxnoise);
+    local->wstats.qual.updated |= 4;
+  }
+
+  return &local->wstats;
+} /* end ray_get_wireless_stats */
+#endif	/* WIRELESS_EXT > 7 */
+/*===========================================================================*/
+static int ray_open(struct net_device *dev)
+{
+    dev_link_t *link;
+    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    
+    MOD_INC_USE_COUNT;
+
+    DEBUG(1, "ray_open('%s')\n", dev->name);
+
+    for (link = dev_list; link; link = link->next)
+        if (link->priv == dev) break;
+    if (!DEV_OK(link)) {
+        MOD_DEC_USE_COUNT;
+        return -ENODEV;
+    }
+
+    if (link->open == 0) local->num_multi = 0;
+    link->open++;
+
+    /* If the card is not started, time to start it ! - Jean II */
+    if(local->card_status == CARD_AWAITING_PARAM) {
+	int i;
+
+	DEBUG(1,"ray_open: doing init now !\n");
+
+	/* Download startup parameters */
+	if ( (i = dl_startup_params(dev)) < 0)
+	  {
+	    printk(KERN_INFO "ray_dev_init dl_startup_params failed - "
+		   "returns 0x%x\n",i);
+	    return -1;
+	  }
+     }
+
+    if (sniffer) netif_stop_queue(dev);
+    else         netif_start_queue(dev);
+
+    DEBUG(2,"ray_open ending\n");
+    return 0;
+} /* end ray_open */
+/*===========================================================================*/
+static int ray_dev_close(struct net_device *dev)
+{
+    dev_link_t *link;
+
+    DEBUG(1, "ray_dev_close('%s')\n", dev->name);
+
+    for (link = dev_list; link; link = link->next)
+        if (link->priv == dev) break;
+    if (link == NULL)
+        return -ENODEV;
+
+    link->open--;
+    netif_stop_queue(dev);
+    if (link->state & DEV_STALE_CONFIG)
+	mod_timer(&link->release, jiffies + HZ/20);
+
+    /* In here, we should stop the hardware (stop card from beeing active)
+     * and set local->card_status to CARD_AWAITING_PARAM, so that while the
+     * card is closed we can chage its configuration.
+     * Probably also need a COR reset to get sane state - Jean II */
+
+    MOD_DEC_USE_COUNT;
+
+    return 0;
+} /* end ray_dev_close */
+/*===========================================================================*/
+static void ray_reset(struct net_device *dev) {
+    DEBUG(1,"ray_reset entered\n");
+    return;
+}
+/*===========================================================================*/
+/* Cause a firmware interrupt if it is ready for one                         */
+/* Return nonzero if not ready                                               */
+static int interrupt_ecf(ray_dev_t *local, int ccs)
+{
+    int i = 50;
+    dev_link_t *link = local->finder;
+
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_cs interrupt_ecf - device not present\n");
+        return -1;
+    }
+    DEBUG(2,"interrupt_ecf(local=%p, ccs = 0x%x\n",local,ccs);
+
+    while ( i && 
+            (readb(local->amem + CIS_OFFSET + ECF_INTR_OFFSET) & ECF_INTR_SET))
+        i--;
+    if (i == 0) {
+        DEBUG(2,"ray_cs interrupt_ecf card not ready for interrupt\n");
+        return -1;
+    }
+	/* Fill the mailbox, then kick the card */
+    writeb(ccs, local->sram + SCB_BASE);
+    writeb(ECF_INTR_SET, local->amem + CIS_OFFSET + ECF_INTR_OFFSET);
+    return 0;
+} /* interrupt_ecf */
+/*===========================================================================*/
+/* Get next free transmit CCS                                                */
+/* Return - index of current tx ccs                                          */
+static int get_free_tx_ccs(ray_dev_t *local)
+{
+    int i;
+    struct ccs *pccs = (struct ccs *)(local->sram + CCS_BASE);
+    dev_link_t *link = local->finder;
+
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_cs get_free_tx_ccs - device not present\n");
+        return ECARDGONE;
+    }
+
+    if (test_and_set_bit(0,&local->tx_ccs_lock)) {
+        DEBUG(1,"ray_cs tx_ccs_lock busy\n");
+        return ECCSBUSY;
+    } 
+
+    for (i=0; i < NUMBER_OF_TX_CCS; i++) {
+        if (readb(&(pccs+i)->buffer_status) == CCS_BUFFER_FREE) {
+            writeb(CCS_BUFFER_BUSY, &(pccs+i)->buffer_status);
+            writeb(CCS_END_LIST, &(pccs+i)->link);
+			local->tx_ccs_lock = 0;
+            return i;
+        }
+    }
+	local->tx_ccs_lock = 0;
+    DEBUG(2,"ray_cs ERROR no free tx CCS for raylink card\n");
+    return ECCSFULL;
+} /* get_free_tx_ccs */
+/*===========================================================================*/
+/* Get next free CCS                                                         */
+/* Return - index of current ccs                                             */
+static int get_free_ccs(ray_dev_t *local)
+{
+    int i;
+    struct ccs *pccs = (struct ccs *)(local->sram + CCS_BASE);
+    dev_link_t *link = local->finder;
+
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_cs get_free_ccs - device not present\n");
+        return ECARDGONE;
+    }
+    if (test_and_set_bit(0,&local->ccs_lock)) {
+        DEBUG(1,"ray_cs ccs_lock busy\n");
+        return ECCSBUSY;
+    } 
+
+    for (i = NUMBER_OF_TX_CCS; i < NUMBER_OF_CCS; i++) {
+        if (readb(&(pccs+i)->buffer_status) == CCS_BUFFER_FREE) {
+            writeb(CCS_BUFFER_BUSY, &(pccs+i)->buffer_status);
+            writeb(CCS_END_LIST, &(pccs+i)->link);
+			local->ccs_lock = 0;
+            return i;
+        }
+    }
+	local->ccs_lock = 0;
+    DEBUG(1,"ray_cs ERROR no free CCS for raylink card\n");
+    return ECCSFULL;
+} /* get_free_ccs */
+/*===========================================================================*/
+static void authenticate_timeout(u_long data)
+{
+    ray_dev_t *local = (ray_dev_t *)data;
+    del_timer(&local->timer);
+    printk(KERN_INFO "ray_cs Authentication with access point failed"
+       " - timeout\n");
+    join_net((u_long)local);
+}
+/*===========================================================================*/
+static int asc_to_int(char a)
+{
+    if (a < '0') return -1;
+    if (a <= '9') return (a - '0');
+    if (a < 'A') return -1;
+    if (a <= 'F') return (10 + a - 'A');
+    if (a < 'a') return -1;
+    if (a <= 'f') return (10 + a - 'a');
+    return -1;
+}
+/*===========================================================================*/
+static int parse_addr(char *in_str, UCHAR *out)
+{
+    int len;
+    int i,j,k;
+    int status;
+    
+    if (in_str == NULL) return 0;
+    if ((len = strlen(in_str)) < 2) return 0;
+    memset(out, 0, ADDRLEN);
+
+    status = 1;
+    j = len - 1;
+    if (j > 12) j = 12;
+    i = 5;
+    
+    while (j > 0)
+    {
+        if ((k = asc_to_int(in_str[j--])) != -1) out[i] = k;
+        else return 0;
+
+        if (j == 0) break;
+        if ((k = asc_to_int(in_str[j--])) != -1) out[i] += k << 4;
+        else return 0;
+        if (!i--) break;
+    }
+    return status;
+}
+/*===========================================================================*/
+static struct net_device_stats *ray_get_stats(struct net_device *dev)
+{
+    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    dev_link_t *link = local->finder;
+    struct status *p = (struct status *)(local->sram + STATUS_BASE);
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_cs net_device_stats - device not present\n");
+        return &local->stats;
+    }
+    if (readb(&p->mrx_overflow_for_host))
+    {
+        local->stats.rx_over_errors += ntohs(readb(&p->mrx_overflow));
+        writeb(0,&p->mrx_overflow);
+        writeb(0,&p->mrx_overflow_for_host);
+    }
+    if (readb(&p->mrx_checksum_error_for_host))
+    {
+        local->stats.rx_crc_errors += ntohs(readb(&p->mrx_checksum_error));
+        writeb(0,&p->mrx_checksum_error);
+        writeb(0,&p->mrx_checksum_error_for_host);
+    }
+    if (readb(&p->rx_hec_error_for_host))
+    {
+        local->stats.rx_frame_errors += ntohs(readb(&p->rx_hec_error));
+        writeb(0,&p->rx_hec_error);
+        writeb(0,&p->rx_hec_error_for_host);
+    }
+    return &local->stats;
+}
+/*===========================================================================*/
+static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len)
+{
+    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    dev_link_t *link = local->finder;
+    int ccsindex;
+    int i;
+    struct ccs *pccs;
+
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_update_parm - device not present\n");
+        return;
+    }
+
+    if ((ccsindex = get_free_ccs(local)) < 0)
+    {
+        DEBUG(0,"ray_update_parm - No free ccs\n");
+        return;
+    }
+    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
+    writeb(CCS_UPDATE_PARAMS, &pccs->cmd);
+    writeb(objid, &pccs->var.update_param.object_id);
+    writeb(1, &pccs->var.update_param.number_objects);
+    writeb(0, &pccs->var.update_param.failure_cause);
+    for (i=0; i<len; i++) {
+        writeb(value[i], local->sram + HOST_TO_ECF_BASE);
+    }
+    /* Interrupt the firmware to process the command */
+    if (interrupt_ecf(local, ccsindex)) {
+        DEBUG(0,"ray_cs associate failed - ECF not ready for intr\n");
+        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
+    }
+}
+/*===========================================================================*/
+static void ray_update_multi_list(struct net_device *dev, int all)
+{
+    struct dev_mc_list *dmi, **dmip;
+    int ccsindex;
+    struct ccs *pccs;
+    int i = 0;
+    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    dev_link_t *link = local->finder;
+    UCHAR *p = local->sram + HOST_TO_ECF_BASE;
+
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_update_multi_list - device not present\n");
+        return;
+    }
+    else 
+        DEBUG(2,"ray_update_multi_list(%p)\n",dev);
+    if ((ccsindex = get_free_ccs(local)) < 0)
+    {
+        DEBUG(1,"ray_update_multi - No free ccs\n");
+        return;
+    }
+    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
+    writeb(CCS_UPDATE_MULTICAST_LIST, &pccs->cmd);
+
+    if (all) {
+        writeb(0xff, &pccs->var);
+        local->num_multi = 0xff;
+    }
+    else {
+        /* Copy the kernel's list of MC addresses to card */
+        for (dmip=&dev->mc_list; (dmi=*dmip)!=NULL; dmip=&dmi->next) {
+            memcpy_toio(p, dmi->dmi_addr, ETH_ALEN);
+            DEBUG(1,"ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n",dmi->dmi_addr[0],dmi->dmi_addr[1],dmi->dmi_addr[2],dmi->dmi_addr[3],dmi->dmi_addr[4],dmi->dmi_addr[5]);
+            p += ETH_ALEN;
+            i++;
+        }
+        if (i > 256/ADDRLEN) i = 256/ADDRLEN;
+        writeb((UCHAR)i, &pccs->var);
+        DEBUG(1,"ray_cs update_multi %d addresses in list\n", i);
+        /* Interrupt the firmware to process the command */
+        local->num_multi = i;
+    }
+    if (interrupt_ecf(local, ccsindex)) {
+        DEBUG(1,"ray_cs update_multi failed - ECF not ready for intr\n");
+        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
+    }
+} /* end ray_update_multi_list */
+/*===========================================================================*/
+static void set_multicast_list(struct net_device *dev)
+{
+    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    UCHAR promisc;
+
+    DEBUG(2,"ray_cs set_multicast_list(%p)\n",dev);
+
+    if (dev->flags & IFF_PROMISC)
+    {
+        if (local->sparm.b5.a_promiscuous_mode == 0) {
+            DEBUG(1,"ray_cs set_multicast_list promisc on\n");
+            local->sparm.b5.a_promiscuous_mode = 1;
+            promisc = 1;
+            ray_update_parm(dev,  OBJID_promiscuous_mode, \
+                            &promisc, sizeof(promisc));
+        }
+    }
+    else {
+        if (local->sparm.b5.a_promiscuous_mode == 1) {
+            DEBUG(1,"ray_cs set_multicast_list promisc off\n");
+            local->sparm.b5.a_promiscuous_mode = 0;
+            promisc = 0;
+            ray_update_parm(dev,  OBJID_promiscuous_mode, \
+                            &promisc, sizeof(promisc));
+        }
+    }
+
+    if (dev->flags & IFF_ALLMULTI) ray_update_multi_list(dev, 1);
+    else
+    {
+        if (local->num_multi != dev->mc_count) ray_update_multi_list(dev, 0);
+    }
+} /* end set_multicast_list */
+/*=============================================================================
+ * All routines below here are run at interrupt time.
+=============================================================================*/
+static void ray_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+{
+    struct net_device *dev = (struct net_device *)dev_id;
+    dev_link_t *link;
+    ray_dev_t *local;
+    struct ccs *pccs;
+    struct rcs *prcs;
+    UCHAR rcsindex;
+    UCHAR tmp;
+    UCHAR cmd;
+    UCHAR status;
+
+    if (dev == NULL) /* Note that we want interrupts with dev->start == 0 */
+    return;
+
+    DEBUG(4,"ray_cs: interrupt for *dev=%p\n",dev);
+
+    local = (ray_dev_t *)dev->priv;
+    link = (dev_link_t *)local->finder;
+    if ( ! (link->state & DEV_PRESENT) || link->state & DEV_SUSPEND ) {
+        DEBUG(2,"ray_cs interrupt from device not present or suspended.\n");
+        return;
+    }
+    rcsindex = readb(&((struct scb *)(local->sram))->rcs_index);
+
+    if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS))
+    {
+        DEBUG(1,"ray_cs interrupt bad rcsindex = 0x%x\n",rcsindex);
+        clear_interrupt(local);
+        return;
+    }
+    if (rcsindex < NUMBER_OF_CCS) /* If it's a returned CCS */
+    {
+        pccs = ((struct ccs *) (local->sram + CCS_BASE)) + rcsindex;
+        cmd = readb(&pccs->cmd);
+        status = readb(&pccs->buffer_status);
+        switch (cmd)
+        {
+        case CCS_DOWNLOAD_STARTUP_PARAMS: /* Happens in firmware someday */
+            del_timer(&local->timer);
+            if (status == CCS_COMMAND_COMPLETE) {
+                DEBUG(1,"ray_cs interrupt download_startup_parameters OK\n");
+            }
+            else {
+                DEBUG(1,"ray_cs interrupt download_startup_parameters fail\n");
+            }
+            break;
+        case CCS_UPDATE_PARAMS:
+            DEBUG(1,"ray_cs interrupt update params done\n");
+            if (status != CCS_COMMAND_COMPLETE) {
+                tmp = readb(&pccs->var.update_param.failure_cause);
+            DEBUG(0,"ray_cs interrupt update params failed - reason %d\n",tmp);
+            }
+            break;
+        case CCS_REPORT_PARAMS:
+            DEBUG(1,"ray_cs interrupt report params done\n");
+            break;
+        case CCS_UPDATE_MULTICAST_LIST: /* Note that this CCS isn't returned */
+            DEBUG(1,"ray_cs interrupt CCS Update Multicast List done\n");
+            break;
+        case CCS_UPDATE_POWER_SAVINGS_MODE:
+            DEBUG(1,"ray_cs interrupt update power save mode done\n");
+            break;
+        case CCS_START_NETWORK:
+        case CCS_JOIN_NETWORK:
+            if (status == CCS_COMMAND_COMPLETE) {
+                if (readb(&pccs->var.start_network.net_initiated) == 1) {
+                    DEBUG(0,"ray_cs interrupt network \"%s\" started\n",\
+                          local->sparm.b4.a_current_ess_id);
+                }
+                else {
+                    DEBUG(0,"ray_cs interrupt network \"%s\" joined\n",\
+                          local->sparm.b4.a_current_ess_id);
+                }
+                memcpy_fromio(&local->bss_id,pccs->var.start_network.bssid,ADDRLEN);
+
+                if (local->fw_ver == 0x55) local->net_default_tx_rate = 3;
+                else local->net_default_tx_rate = 
+                         readb(&pccs->var.start_network.net_default_tx_rate);
+                local->encryption = readb(&pccs->var.start_network.encryption);
+                if (!sniffer && (local->net_type == INFRA)
+                    && !(local->sparm.b4.a_acting_as_ap_status)) {
+                    authenticate(local);
+                }
+                local->card_status = CARD_ACQ_COMPLETE;
+            }
+            else {
+                local->card_status = CARD_ACQ_FAILED;
+
+                del_timer(&local->timer);
+                local->timer.expires = jiffies + HZ*5;
+                local->timer.data = (long)local;
+                if (status == CCS_START_NETWORK) {
+                    DEBUG(0,"ray_cs interrupt network \"%s\" start failed\n",\
+                          local->sparm.b4.a_current_ess_id);
+                    local->timer.function = &start_net;
+                }
+                else {
+                    DEBUG(0,"ray_cs interrupt network \"%s\" join failed\n",\
+                          local->sparm.b4.a_current_ess_id);
+                    local->timer.function = &join_net;
+                }
+                add_timer(&local->timer);
+            }
+            break;
+        case CCS_START_ASSOCIATION:
+            if (status == CCS_COMMAND_COMPLETE) {
+                local->card_status = CARD_ASSOC_COMPLETE;
+                DEBUG(0,"ray_cs association successful\n");
+            }
+            else
+            {
+                DEBUG(0,"ray_cs association failed,\n");
+                local->card_status = CARD_ASSOC_FAILED;
+                join_net((u_long)local);
+            }
+            break;
+        case CCS_TX_REQUEST:
+            if (status == CCS_COMMAND_COMPLETE) {
+                DEBUG(3,"ray_cs interrupt tx request complete\n");
+            }
+            else {
+                DEBUG(1,"ray_cs interrupt tx request failed\n");
+            }
+            if (!sniffer) netif_start_queue(dev);
+            netif_wake_queue(dev);
+            break;
+        case CCS_TEST_MEMORY:
+            DEBUG(1,"ray_cs interrupt mem test done\n");
+            break;
+        case CCS_SHUTDOWN:
+            DEBUG(1,"ray_cs interrupt Unexpected CCS returned - Shutdown\n");
+            break;
+        case CCS_DUMP_MEMORY:
+            DEBUG(1,"ray_cs interrupt dump memory done\n");
+            break;
+        case CCS_START_TIMER:
+            DEBUG(2,"ray_cs interrupt DING - raylink timer expired\n");
+            break;
+        default:
+            DEBUG(1,"ray_cs interrupt Unexpected CCS 0x%x returned 0x%x\n",\
+                  rcsindex, cmd);
+        }
+        writeb(CCS_BUFFER_FREE, &pccs->buffer_status);
+    }
+    else /* It's an RCS */
+    {
+        prcs = ((struct rcs *)(local->sram + CCS_BASE)) + rcsindex;
+    
+        switch (readb(&prcs->interrupt_id))
+        {
+        case PROCESS_RX_PACKET:
+            ray_rx(dev, local, prcs);
+            break;
+        case REJOIN_NET_COMPLETE:
+            DEBUG(1,"ray_cs interrupt rejoin net complete\n");
+            local->card_status = CARD_ACQ_COMPLETE;
+            /* do we need to clear tx buffers CCS's? */
+            if (local->sparm.b4.a_network_type == ADHOC) {
+                if (!sniffer) netif_start_queue(dev);
+            }
+            else {
+                memcpy_fromio(&local->bss_id, prcs->var.rejoin_net_complete.bssid, ADDRLEN);
+                DEBUG(1,"ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n",\
+                      local->bss_id[0], local->bss_id[1], local->bss_id[2],\
+                      local->bss_id[3], local->bss_id[4], local->bss_id[5]);
+                if (!sniffer) authenticate(local);
+            }
+            break;
+        case ROAMING_INITIATED:
+            DEBUG(1,"ray_cs interrupt roaming initiated\n"); 
+            netif_stop_queue(dev);
+            local->card_status = CARD_DOING_ACQ;
+            break;
+        case JAPAN_CALL_SIGN_RXD:
+            DEBUG(1,"ray_cs interrupt japan call sign rx\n");
+            break;
+        default:
+            DEBUG(1,"ray_cs Unexpected interrupt for RCS 0x%x cmd = 0x%x\n",\
+                  rcsindex, (unsigned int) readb(&prcs->interrupt_id));
+            break;
+        }
+        writeb(CCS_BUFFER_FREE, &prcs->buffer_status);
+    }
+    clear_interrupt(local);
+} /* ray_interrupt */
+/*===========================================================================*/
+static void ray_rx(struct net_device *dev, ray_dev_t *local, struct rcs *prcs)
+{
+    int rx_len;
+    unsigned int pkt_addr;
+    UCHAR *pmsg;
+    DEBUG(4,"ray_rx process rx packet\n");
+
+    /* Calculate address of packet within Rx buffer */
+    pkt_addr = ((readb(&prcs->var.rx_packet.rx_data_ptr[0]) << 8)
+                + readb(&prcs->var.rx_packet.rx_data_ptr[1])) & RX_BUFF_END;
+    /* Length of first packet fragment */
+    rx_len = (readb(&prcs->var.rx_packet.rx_data_length[0]) << 8)
+        + readb(&prcs->var.rx_packet.rx_data_length[1]);
+
+    local->last_rsl = readb(&prcs->var.rx_packet.rx_sig_lev);
+    pmsg = local->rmem + pkt_addr;
+    switch(readb(pmsg))
+    {
+    case DATA_TYPE:
+        DEBUG(4,"ray_rx data type\n");
+        rx_data(dev, prcs, pkt_addr, rx_len);
+        break;
+    case AUTHENTIC_TYPE:
+        DEBUG(4,"ray_rx authentic type\n");
+        if (sniffer) rx_data(dev, prcs, pkt_addr, rx_len);
+        else rx_authenticate(local, prcs, pkt_addr, rx_len);
+        break;
+    case DEAUTHENTIC_TYPE:
+        DEBUG(4,"ray_rx deauth type\n");
+        if (sniffer) rx_data(dev, prcs, pkt_addr, rx_len);
+        else rx_deauthenticate(local, prcs, pkt_addr, rx_len);
+        break;
+    case NULL_MSG_TYPE:
+        DEBUG(3,"ray_cs rx NULL msg\n");
+        break;
+    case BEACON_TYPE:
+        DEBUG(4,"ray_rx beacon type\n");
+        if (sniffer) rx_data(dev, prcs, pkt_addr, rx_len);
+
+        copy_from_rx_buff(local, (UCHAR *)&local->last_bcn, pkt_addr, 
+                          rx_len < sizeof(struct beacon_rx) ? 
+                          rx_len : sizeof(struct beacon_rx));
+
+	local->beacon_rxed = 1;
+        /* Get the statistics so the card counters never overflow */
+        ray_get_stats(dev);
+            break;
+    default:
+        DEBUG(0,"ray_cs unknown pkt type %2x\n", (unsigned int) readb(pmsg));
+        break;
+    }
+
+} /* end ray_rx */
+/*===========================================================================*/
+static void rx_data(struct net_device *dev, struct rcs *prcs, unsigned int pkt_addr, 
+             int rx_len)
+{
+    struct sk_buff *skb = NULL;
+    struct rcs *prcslink = prcs;
+    ray_dev_t *local = dev->priv;
+    UCHAR *rx_ptr;
+    int total_len;
+    int tmp;
+#ifdef WIRELESS_SPY
+    int siglev = local->last_rsl;
+    u_char linksrcaddr[ETH_ALEN];	/* Other end of the wireless link */
+#endif
+
+    if (!sniffer) {
+        if (translate) {
+/* TBD length needs fixing for translated header */
+            if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) ||
+                rx_len > (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + FCS_LEN)) 
+            {
+                DEBUG(0,"ray_cs invalid packet length %d received \n",rx_len);
+                return;
+            }
+        }
+        else /* encapsulated ethernet */ {
+            if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) ||
+                rx_len > (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + FCS_LEN))
+            {
+                DEBUG(0,"ray_cs invalid packet length %d received \n",rx_len);
+                return;
+            }
+        }
+    }
+    DEBUG(4,"ray_cs rx_data packet\n");
+    /* If fragmented packet, verify sizes of fragments add up */
+    if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) {
+        DEBUG(1,"ray_cs rx'ed fragment\n");
+        tmp = (readb(&prcs->var.rx_packet.totalpacketlength[0]) << 8)
+            +  readb(&prcs->var.rx_packet.totalpacketlength[1]);
+        total_len = tmp;
+        prcslink = prcs;
+        do {
+            tmp -= (readb(&prcslink->var.rx_packet.rx_data_length[0]) << 8)
+                +   readb(&prcslink->var.rx_packet.rx_data_length[1]);
+            if (readb(&prcslink->var.rx_packet.next_frag_rcs_index) == 0xFF
+                || tmp < 0) break;
+            prcslink = ((struct rcs *)(local->sram + CCS_BASE))
+                + readb(&prcslink->link_field);
+        } while (1);
+
+        if (tmp < 0)
+        {
+            DEBUG(0,"ray_cs rx_data fragment lengths don't add up\n");
+            local->stats.rx_dropped++; 
+            release_frag_chain(local, prcs);
+            return;
+        }
+    }
+    else { /* Single unfragmented packet */
+        total_len = rx_len;
+    }
+
+    skb = dev_alloc_skb( total_len+5 );
+    if (skb == NULL)
+    {
+        DEBUG(0,"ray_cs rx_data could not allocate skb\n");
+        local->stats.rx_dropped++; 
+        if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF)
+            release_frag_chain(local, prcs);
+        return;
+    }
+    skb_reserve( skb, 2);   /* Align IP on 16 byte (TBD check this)*/
+    skb->dev = dev;
+
+    DEBUG(4,"ray_cs rx_data total_len = %x, rx_len = %x\n",total_len,rx_len);
+
+/************************/
+    /* Reserve enough room for the whole damn packet. */
+    rx_ptr = skb_put( skb, total_len);
+    /* Copy the whole packet to sk_buff */
+    rx_ptr += copy_from_rx_buff(local, rx_ptr, pkt_addr & RX_BUFF_END, rx_len);
+    /* Get source address */
+#ifdef WIRELESS_SPY
+    memcpy(linksrcaddr, ((struct mac_header *)skb->data)->addr_2, ETH_ALEN);
+#endif
+    /* Now, deal with encapsulation/translation/sniffer */
+    if (!sniffer) {
+        if (!translate) { 
+            /* Encapsulated ethernet, so just lop off 802.11 MAC header */
+/* TBD reserve            skb_reserve( skb, RX_MAC_HEADER_LENGTH); */
+            skb_pull( skb, RX_MAC_HEADER_LENGTH);
+        }
+        else {
+            /* Do translation */
+            untranslate(local, skb, total_len);
+        }
+    }
+    else 
+    {  /* sniffer mode, so just pass whole packet */  };
+
+/************************/
+    /* Now pick up the rest of the fragments if any */
+    tmp = 17; 
+    if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) {
+        prcslink = prcs;
+        DEBUG(1,"ray_cs rx_data in fragment loop\n");
+        do {
+            prcslink = ((struct rcs *)(local->sram + CCS_BASE))
+                + readb(&prcslink->var.rx_packet.next_frag_rcs_index);
+            rx_len = (( readb(&prcslink->var.rx_packet.rx_data_length[0]) << 8)
+                      + readb(&prcslink->var.rx_packet.rx_data_length[1]))
+                & RX_BUFF_END;
+            pkt_addr = (( readb(&prcslink->var.rx_packet.rx_data_ptr[0]) << 8)
+                        + readb(&prcslink->var.rx_packet.rx_data_ptr[1]))
+                & RX_BUFF_END;
+
+            rx_ptr += copy_from_rx_buff(local, rx_ptr, pkt_addr, rx_len);
+
+        } while (tmp-- && 
+                 readb(&prcslink->var.rx_packet.next_frag_rcs_index) != 0xFF);
+        release_frag_chain(local, prcs);
+    }
+
+    skb->protocol = eth_type_trans(skb,dev);
+    netif_rx(skb);
+    dev->last_rx = jiffies;
+    local->stats.rx_packets++;
+    local->stats.rx_bytes += total_len;
+
+    /* Gather signal strength per address */
+#ifdef WIRELESS_SPY
+    /* For the Access Point or the node having started the ad-hoc net
+     * note : ad-hoc work only in some specific configurations, but we
+     * kludge in ray_get_wireless_stats... */
+    if(!memcmp(linksrcaddr, local->bss_id, ETH_ALEN))
+      {
+	/* Update statistics */
+	/*local->wstats.qual.qual = none ? */
+	local->wstats.qual.level = siglev;
+	/*local->wstats.qual.noise = none ? */
+	local->wstats.qual.updated = 0x2;
+      }
+    /* Now, for the addresses in the spy list */
+    {
+      int	i;
+      /* Look all addresses */
+      for(i = 0; i < local->spy_number; i++)
+	/* If match */
+	if(!memcmp(linksrcaddr, local->spy_address[i], ETH_ALEN))
+	  {
+	    /* Update statistics */
+	    /*local->spy_stat[i].qual = none ? */
+	    local->spy_stat[i].level = siglev;
+	    /*local->spy_stat[i].noise = none ? */
+	    local->spy_stat[i].updated = 0x2;
+	  }
+    }
+#endif	/* WIRELESS_SPY */
+} /* end rx_data */
+/*===========================================================================*/
+static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
+{
+    snaphdr_t *psnap = (snaphdr_t *)(skb->data + RX_MAC_HEADER_LENGTH);
+    struct mac_header *pmac = (struct mac_header *)skb->data;
+    unsigned short type = *(unsigned short *)psnap->ethertype;
+    unsigned int xsap = *(unsigned int *)psnap & 0x00ffffff;
+    unsigned int org = (*(unsigned int *)psnap->org) & 0x00ffffff;
+    int delta;
+    struct ethhdr *peth;
+    UCHAR srcaddr[ADDRLEN];
+    UCHAR destaddr[ADDRLEN];
+
+    if (pmac->frame_ctl_2 & FC2_FROM_DS) {
+	if (pmac->frame_ctl_2 & FC2_TO_DS) { /* AP to AP */
+	    memcpy(destaddr, pmac->addr_3, ADDRLEN);
+	    memcpy(srcaddr, ((unsigned char *)pmac->addr_3) + ADDRLEN, ADDRLEN);
+	} else { /* AP to terminal */
+	    memcpy(destaddr, pmac->addr_1, ADDRLEN);
+	    memcpy(srcaddr, pmac->addr_3, ADDRLEN); 
+	}
+    } else { /* Terminal to AP */
+	if (pmac->frame_ctl_2 & FC2_TO_DS) {
+	    memcpy(destaddr, pmac->addr_3, ADDRLEN);
+	    memcpy(srcaddr, pmac->addr_2, ADDRLEN); 
+	} else { /* Adhoc */
+	    memcpy(destaddr, pmac->addr_1, ADDRLEN);
+	    memcpy(srcaddr, pmac->addr_2, ADDRLEN); 
+	}
+    }
+
+#ifdef PCMCIA_DEBUG
+    if (pc_debug > 3) {
+    int i;
+    printk(KERN_DEBUG "skb->data before untranslate");
+    for (i=0;i<64;i++) 
+        printk("%02x ",skb->data[i]);
+    printk("\n" KERN_DEBUG "type = %08x, xsap = %08x, org = %08x\n",
+           type,xsap,org);
+    printk(KERN_DEBUG "untranslate skb->data = %p\n",skb->data);
+    }
+#endif
+
+    if ( xsap != SNAP_ID) {
+        /* not a snap type so leave it alone */
+        DEBUG(3,"ray_cs untranslate NOT SNAP %x\n", *(unsigned int *)psnap & 0x00ffffff);
+
+        delta = RX_MAC_HEADER_LENGTH - ETH_HLEN;
+        peth = (struct ethhdr *)(skb->data + delta);
+        peth->h_proto = htons(len - RX_MAC_HEADER_LENGTH);
+    }
+    else { /* Its a SNAP */
+        if (org == BRIDGE_ENCAP) { /* EtherII and nuke the LLC  */
+        DEBUG(3,"ray_cs untranslate Bridge encap\n");
+            delta = RX_MAC_HEADER_LENGTH 
+                + sizeof(struct snaphdr_t) - ETH_HLEN;
+            peth = (struct ethhdr *)(skb->data + delta);
+            peth->h_proto = type;
+        }
+        else {
+            if (org == RFC1042_ENCAP) {
+                switch (type) {
+                case RAY_IPX_TYPE:
+                case APPLEARP_TYPE:
+                    DEBUG(3,"ray_cs untranslate RFC IPX/AARP\n");
+                    delta = RX_MAC_HEADER_LENGTH - ETH_HLEN;
+                    peth = (struct ethhdr *)(skb->data + delta);
+                    peth->h_proto = htons(len - RX_MAC_HEADER_LENGTH);
+                    break;
+                default:
+                    DEBUG(3,"ray_cs untranslate RFC default\n");
+                    delta = RX_MAC_HEADER_LENGTH + 
+                        sizeof(struct snaphdr_t) - ETH_HLEN;
+                    peth = (struct ethhdr *)(skb->data + delta);
+                    peth->h_proto = type;
+                    break;
+                }
+            }
+            else {
+                printk("ray_cs untranslate very confused by packet\n");
+                delta = RX_MAC_HEADER_LENGTH - ETH_HLEN;
+                peth = (struct ethhdr *)(skb->data + delta);
+                peth->h_proto = type;
+            }
+        }
+    }
+/* TBD reserve  skb_reserve(skb, delta); */
+    skb_pull(skb, delta);
+    DEBUG(3,"untranslate after skb_pull(%d), skb->data = %p\n",delta,skb->data);
+    memcpy(peth->h_dest, destaddr, ADDRLEN);
+    memcpy(peth->h_source, srcaddr, ADDRLEN);
+#ifdef PCMCIA_DEBUG
+    if (pc_debug > 3) {
+    int i;
+    printk(KERN_DEBUG "skb->data after untranslate:");
+    for (i=0;i<64;i++)
+        printk("%02x ",skb->data[i]);
+    printk("\n");
+    }
+#endif
+} /* end untranslate */
+/*===========================================================================*/
+/* Copy data from circular receive buffer to PC memory.
+ * dest     = destination address in PC memory
+ * pkt_addr = source address in receive buffer
+ * len      = length of packet to copy
+ */
+static int copy_from_rx_buff(ray_dev_t *local, UCHAR *dest, int pkt_addr, int length)
+{
+    int wrap_bytes = (pkt_addr + length) - (RX_BUFF_END + 1);
+    if (wrap_bytes <= 0)
+    {
+        memcpy_fromio(dest,local->rmem + pkt_addr,length);
+    }
+    else /* Packet wrapped in circular buffer */
+    {
+        memcpy_fromio(dest,local->rmem+pkt_addr,length - wrap_bytes);
+        memcpy_fromio(dest + length - wrap_bytes, local->rmem, wrap_bytes);
+    }
+    return length;
+}
+/*===========================================================================*/
+static void release_frag_chain(ray_dev_t *local, struct rcs* prcs)
+{
+    struct rcs *prcslink = prcs;
+    int tmp = 17;
+    unsigned rcsindex = readb(&prcs->var.rx_packet.next_frag_rcs_index);
+
+    while (tmp--) {
+        writeb(CCS_BUFFER_FREE, &prcslink->buffer_status);
+        if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) {
+            DEBUG(1,"ray_cs interrupt bad rcsindex = 0x%x\n",rcsindex);
+            break;      
+        }   
+        prcslink = ((struct rcs *)(local->sram + CCS_BASE)) + rcsindex;
+        rcsindex = readb(&prcslink->var.rx_packet.next_frag_rcs_index);
+    }
+    writeb(CCS_BUFFER_FREE, &prcslink->buffer_status);
+}
+/*===========================================================================*/
+static void authenticate(ray_dev_t *local)
+{
+    dev_link_t *link = local->finder;
+    DEBUG(0,"ray_cs Starting authentication.\n");
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_cs authenticate - device not present\n");
+        return;
+    }
+
+    del_timer(&local->timer);
+    if (build_auth_frame(local, local->bss_id, OPEN_AUTH_REQUEST)) {
+        local->timer.function = &join_net;
+    }
+    else {
+        local->timer.function = &authenticate_timeout;
+    }
+    local->timer.expires = jiffies + HZ*2;
+    local->timer.data = (long)local;
+    add_timer(&local->timer);
+    local->authentication_state = AWAITING_RESPONSE;
+} /* end authenticate */
+/*===========================================================================*/
+static void rx_authenticate(ray_dev_t *local, struct rcs *prcs,
+                     unsigned int pkt_addr, int rx_len)
+{
+    UCHAR buff[256];
+    struct rx_msg *msg = (struct rx_msg *)buff;
+    
+    del_timer(&local->timer);
+
+    copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff);
+    /* if we are trying to get authenticated */
+    if (local->sparm.b4.a_network_type == ADHOC) {
+        DEBUG(1,"ray_cs rx_auth var= %02x %02x %02x %02x %02x %02x\n", msg->var[0],msg->var[1],msg->var[2],msg->var[3],msg->var[4],msg->var[5]);
+        if (msg->var[2] == 1) {
+                    DEBUG(0,"ray_cs Sending authentication response.\n");
+                    if (!build_auth_frame (local, msg->mac.addr_2, OPEN_AUTH_RESPONSE)) {
+                        local->authentication_state = NEED_TO_AUTH;
+                        memcpy(local->auth_id, msg->mac.addr_2, ADDRLEN);
+                    }
+        }
+    }
+    else /* Infrastructure network */
+    {
+        if (local->authentication_state == AWAITING_RESPONSE) {
+            /* Verify authentication sequence #2 and success */
+            if (msg->var[2] == 2) {
+                if ((msg->var[3] | msg->var[4]) == 0) {
+                    DEBUG(1,"Authentication successful\n");
+                    local->card_status = CARD_AUTH_COMPLETE;
+                    associate(local);
+                    local->authentication_state = AUTHENTICATED;
+                }
+                else {
+                    DEBUG(0,"Authentication refused\n");
+                    local->card_status = CARD_AUTH_REFUSED;
+                    join_net((u_long)local);
+                    local->authentication_state = UNAUTHENTICATED;
+                }
+            }
+        }
+    }
+
+} /* end rx_authenticate */
+/*===========================================================================*/
+static void associate(ray_dev_t *local)
+{
+    struct ccs *pccs;
+    dev_link_t *link = local->finder;
+    struct net_device *dev = link->priv;
+    int ccsindex;
+    if (!(link->state & DEV_PRESENT)) {
+        DEBUG(2,"ray_cs associate - device not present\n");
+        return;
+    }
+    /* If no tx buffers available, return*/
+    if ((ccsindex = get_free_ccs(local)) < 0)
+    {
+/* TBD should never be here but... what if we are? */
+        DEBUG(1,"ray_cs associate - No free ccs\n");
+        return;
+    }
+    DEBUG(1,"ray_cs Starting association with access point\n");
+    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
+    /* fill in the CCS */
+    writeb(CCS_START_ASSOCIATION, &pccs->cmd);
+    /* Interrupt the firmware to process the command */
+    if (interrupt_ecf(local, ccsindex)) {
+        DEBUG(1,"ray_cs associate failed - ECF not ready for intr\n");
+        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
+
+        del_timer(&local->timer);
+        local->timer.expires = jiffies + HZ*2;
+        local->timer.data = (long)local;
+        local->timer.function = &join_net;
+        add_timer(&local->timer);
+        local->card_status = CARD_ASSOC_FAILED;
+        return;
+    }
+    if (!sniffer) netif_start_queue(dev);
+
+} /* end associate */
+/*===========================================================================*/
+static void rx_deauthenticate(ray_dev_t *local, struct rcs *prcs, 
+                       unsigned int pkt_addr, int rx_len)
+{
+/*  UCHAR buff[256];
+    struct rx_msg *msg = (struct rx_msg *)buff;
+*/
+    DEBUG(0,"Deauthentication frame received\n");
+    local->authentication_state = UNAUTHENTICATED;
+    /* Need to reauthenticate or rejoin depending on reason code */
+/*  copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff);
+ */
+}
+/*===========================================================================*/
+static void clear_interrupt(ray_dev_t *local)
+{
+    writeb(0, local->amem + CIS_OFFSET + HCS_INTR_OFFSET);
+}
+/*===========================================================================*/
+#ifdef CONFIG_PROC_FS
+#define MAXDATA (PAGE_SIZE - 80)
+
+static char *card_status[] = {
+    "Card inserted - uninitialized",     /* 0 */
+    "Card not downloaded",               /* 1 */
+    "Waiting for download parameters",   /* 2 */
+    "Card doing acquisition",            /* 3 */
+    "Acquisition complete",              /* 4 */
+    "Authentication complete",           /* 5 */
+    "Association complete",              /* 6 */
+    "???", "???", "???", "???",          /* 7 8 9 10 undefined */
+    "Card init error",                   /* 11 */
+    "Download parameters error",         /* 12 */
+    "???",                               /* 13 */
+    "Acquisition failed",                /* 14 */
+    "Authentication refused",            /* 15 */
+    "Association failed"                 /* 16 */
+};
+
+static char *nettype[] = {"Adhoc", "Infra "};
+static char *framing[] = {"Encapsulation", "Translation"}
+;
+/*===========================================================================*/
+static int ray_cs_proc_read(char *buf, char **start, off_t offset, int len)
+{
+/* Print current values which are not available via other means
+ * eg ifconfig 
+ */
+    int i;
+    dev_link_t *link;
+    struct net_device *dev;
+    ray_dev_t *local;
+    UCHAR *p;
+    struct freq_hop_element *pfh;
+    UCHAR c[33];
+
+    link = dev_list;
+    if (!link)
+    	return 0;
+    dev = (struct net_device *)link->priv;
+    if (!dev)
+    	return 0;
+    local = (ray_dev_t *)dev->priv;
+    if (!local)
+    	return 0;
+
+    len = 0;
+
+    len += sprintf(buf + len, "Raylink Wireless LAN driver status\n");
+    len += sprintf(buf + len, "%s\n", rcsid);
+    /* build 4 does not report version, and field is 0x55 after memtest */
+    len += sprintf(buf + len, "Firmware version     = ");
+    if (local->fw_ver == 0x55)
+        len += sprintf(buf + len, "4 - Use dump_cis for more details\n");
+    else
+        len += sprintf(buf + len, "%2d.%02d.%02d\n",
+                   local->fw_ver, local->fw_bld, local->fw_var);
+
+    for (i=0; i<32; i++) c[i] = local->sparm.b5.a_current_ess_id[i];
+    c[32] = 0;
+    len += sprintf(buf + len, "%s network ESSID = \"%s\"\n", 
+                   nettype[local->sparm.b5.a_network_type], c);
+
+    p = local->bss_id;
+    len += sprintf(buf + len, 
+                   "BSSID                = %02x:%02x:%02x:%02x:%02x:%02x\n",
+                   p[0],p[1],p[2],p[3],p[4],p[5]);
+
+    len += sprintf(buf + len, "Country code         = %d\n", 
+                   local->sparm.b5.a_curr_country_code);
+
+    i = local->card_status;
+    if (i < 0) i = 10;
+    if (i > 16) i = 10;
+    len += sprintf(buf + len, "Card status          = %s\n", card_status[i]);
+
+    len += sprintf(buf + len, "Framing mode         = %s\n",framing[translate]);
+
+    len += sprintf(buf + len, "Last pkt signal lvl  = %d\n", local->last_rsl);
+
+    if (local->beacon_rxed) {
+	/* Pull some fields out of last beacon received */
+	len += sprintf(buf + len, "Beacon Interval      = %d Kus\n", 
+		       local->last_bcn.beacon_intvl[0]
+		       + 256 * local->last_bcn.beacon_intvl[1]);
+    
+    p = local->last_bcn.elements;
+    if (p[0] == C_ESSID_ELEMENT_ID) p += p[1] + 2;
+    else {
+        len += sprintf(buf + len, "Parse beacon failed at essid element id = %d\n",p[0]);
+        return len;
+    }
+
+    if (p[0] == C_SUPPORTED_RATES_ELEMENT_ID) {
+        len += sprintf(buf + len, "Supported rate codes = ");
+        for (i=2; i<p[1] + 2; i++) 
+            len += sprintf(buf + len, "0x%02x ", p[i]);
+        len += sprintf(buf + len, "\n");
+        p += p[1] + 2;
+    }
+    else {
+        len += sprintf(buf + len, "Parse beacon failed at rates element\n");
+        return len;
+    }
+
+	if (p[0] == C_FH_PARAM_SET_ELEMENT_ID) {
+	    pfh = (struct freq_hop_element *)p;
+	    len += sprintf(buf + len, "Hop dwell            = %d Kus\n",
+			   pfh->dwell_time[0] + 256 * pfh->dwell_time[1]);
+	    len += sprintf(buf + len, "Hop set              = %d \n", pfh->hop_set);
+	    len += sprintf(buf + len, "Hop pattern          = %d \n", pfh->hop_pattern);
+	    len += sprintf(buf + len, "Hop index            = %d \n", pfh->hop_index);
+	    p += p[1] + 2;
+	}
+	else {
+	    len += sprintf(buf + len, "Parse beacon failed at FH param element\n");
+	    return len;
+	}
+    } else {
+	len += sprintf(buf + len, "No beacons received\n");
+    }
+    return len;
+}
+
+#endif
+/*===========================================================================*/
+static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type)
+{
+    int addr;
+    struct ccs *pccs;
+    struct tx_msg *ptx;
+    int ccsindex;
+
+    /* If no tx buffers available, return */
+    if ((ccsindex = get_free_tx_ccs(local)) < 0)
+    {
+        DEBUG(1,"ray_cs send authenticate - No free tx ccs\n");
+        return -1;
+    }
+
+    pccs = ((struct ccs *)(local->sram + CCS_BASE)) + ccsindex;
+
+    /* Address in card space */
+    addr = TX_BUF_BASE + (ccsindex << 11);
+    /* fill in the CCS */
+    writeb(CCS_TX_REQUEST, &pccs->cmd);
+    writeb(addr >> 8, pccs->var.tx_request.tx_data_ptr);
+    writeb(0x20, pccs->var.tx_request.tx_data_ptr + 1);
+    writeb(TX_AUTHENTICATE_LENGTH_MSB, pccs->var.tx_request.tx_data_length);
+    writeb(TX_AUTHENTICATE_LENGTH_LSB,pccs->var.tx_request.tx_data_length + 1);
+    writeb(0, &pccs->var.tx_request.pow_sav_mode);
+
+    ptx = (struct tx_msg *)(local->sram + addr);
+    /* fill in the mac header */
+    writeb(PROTOCOL_VER | AUTHENTIC_TYPE, &ptx->mac.frame_ctl_1);
+    writeb(0, &ptx->mac.frame_ctl_2);
+
+    memcpy_toio(ptx->mac.addr_1, dest, ADDRLEN);
+    memcpy_toio(ptx->mac.addr_2, local->sparm.b4.a_mac_addr, ADDRLEN);
+    memcpy_toio(ptx->mac.addr_3, local->bss_id, ADDRLEN);
+
+    /* Fill in msg body with protocol 00 00, sequence 01 00 ,status 00 00 */
+    memset_io(ptx->var, 0, 6);
+    writeb(auth_type & 0xff, ptx->var + 2);
+
+    /* Interrupt the firmware to process the command */
+    if (interrupt_ecf(local, ccsindex)) {
+        DEBUG(1,"ray_cs send authentication request failed - ECF not ready for intr\n");
+        writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status);
+        return -1;
+    }
+    return 0;
+} /* End build_auth_frame */
+
+/*===========================================================================*/
+#ifdef CONFIG_PROC_FS
+static void raycs_write(const char *name, write_proc_t *w, void *data)
+{
+	struct proc_dir_entry * entry = create_proc_entry(name, S_IFREG | S_IWUSR, NULL);
+	if (entry) {
+		entry->write_proc = w;
+		entry->data = data;
+	}
+}
+
+static int write_essid(struct file *file, const char *buffer, unsigned long count, void *data)
+{
+	static char proc_essid[33];
+	int len = count;
+
+	if (len > 32)
+		len = 32;
+	memset(proc_essid, 0, 33);
+	if (copy_from_user(proc_essid, buffer, len))
+		return -EFAULT;
+	essid = proc_essid;
+	return count;
+}
+
+static int write_int(struct file *file, const char *buffer, unsigned long count, void *data)
+{
+	static char proc_number[10];
+	char *p;
+	int nr, len;
+
+	if (!count)
+		return 0;
+
+	if (count > 9)
+		return -EINVAL;
+	if (copy_from_user(proc_number, buffer, count))
+		return -EFAULT;
+	p = proc_number;
+	nr = 0;
+	len = count;
+	do {
+		unsigned int c = *p - '0';
+		if (c > 9)
+			return -EINVAL;
+		nr = nr*10 + c;
+		p++;
+	} while (--len);
+	*(int *)data = nr;
+	return count;
+}
+#endif
+
+static int __init init_ray_cs(void)
+{
+    int rc;
+    
+    DEBUG(1, "%s\n", rcsid);
+    rc = register_pcmcia_driver(&dev_info, &ray_attach, &ray_detach);
+    DEBUG(1, "raylink init_module register_pcmcia_driver returns 0x%x\n",rc);
+
+#ifdef CONFIG_PROC_FS
+    proc_mkdir("driver/ray_cs", 0);
+
+    create_proc_info_entry("driver/ray_cs/ray_cs", 0, NULL, &ray_cs_proc_read);
+    raycs_write("driver/ray_cs/essid", write_essid, NULL);
+    raycs_write("driver/ray_cs/net_type", write_int, &net_type);
+    raycs_write("driver/ray_cs/translate", write_int, &translate);
+#endif
+    if (translate != 0) translate = 1;
+    return 0;
+} /* init_ray_cs */
+
+/*===========================================================================*/
+
+static void __exit exit_ray_cs(void)
+{
+    DEBUG(0, "ray_cs: cleanup_module\n");
+
+
+#ifdef CONFIG_PROC_FS
+    remove_proc_entry("ray_cs", proc_root_driver);
+#endif
+
+    unregister_pcmcia_driver(&dev_info);
+    while (dev_list != NULL)
+        ray_detach(dev_list);
+
+#ifdef CONFIG_PROC_FS
+    remove_proc_entry("driver/ray_cs/ray_cs", NULL);
+    remove_proc_entry("driver/ray_cs/essid", NULL);
+    remove_proc_entry("driver/ray_cs/net_type", NULL);
+    remove_proc_entry("driver/ray_cs/translate", NULL);
+    remove_proc_entry("driver/ray_cs", NULL);
+#endif
+} /* exit_ray_cs */
+
+module_init(init_ray_cs);
+module_exit(exit_ray_cs);
+
+/*===========================================================================*/
diff -Nru a/drivers/net/wireless/ray_cs.h b/drivers/net/wireless/ray_cs.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/wireless/ray_cs.h	Sun Feb 23 22:25:26 2003
@@ -0,0 +1,78 @@
+/* Raytheon wireless LAN PCMCIA card driver for Linux 
+   A  PCMCIA client driver for the Raylink wireless network card
+   Written by Corey Thomas
+*/
+
+#ifndef RAYLINK_H
+
+struct beacon_rx {
+    struct mac_header mac;
+    UCHAR timestamp[8];
+    UCHAR beacon_intvl[2];
+    UCHAR capability[2];
+    UCHAR elements[sizeof(struct essid_element) 
+                  + sizeof(struct rates_element)
+                  + sizeof(struct freq_hop_element) 
+                  + sizeof(struct japan_call_sign_element)
+                  + sizeof(struct tim_element)];
+};
+
+/* Return values for get_free{,_tx}_ccs */
+#define ECCSFULL  (-1)
+#define ECCSBUSY  (-2)
+#define ECARDGONE (-3)
+
+typedef struct ray_dev_t {
+    int card_status;
+    int authentication_state;
+    dev_node_t  node;
+    window_handle_t amem_handle;   /* handle to window for attribute memory  */
+    window_handle_t rmem_handle;   /* handle to window for rx buffer on card */
+    UCHAR *sram;                   /* pointer to beginning of shared RAM     */
+    UCHAR *amem;                   /* pointer to attribute mem window        */
+    UCHAR *rmem;                   /* pointer to receive buffer window       */
+    dev_link_t *finder;            /* pointer back to dev_link_t for card    */
+    struct timer_list timer;
+    long tx_ccs_lock;
+    long ccs_lock;
+    int   dl_param_ccs;
+    union {
+        struct b4_startup_params b4;
+        struct b5_startup_params b5;
+    } sparm;
+    int timeout_flag;
+    UCHAR supported_rates[8];
+    UCHAR japan_call_sign[12];
+    struct startup_res_6 startup_res;
+    int num_multi;
+    /* Network parameters from start/join */
+    UCHAR bss_id[6];
+    UCHAR auth_id[6];
+    UCHAR net_default_tx_rate;
+    UCHAR encryption;
+    struct net_device_stats stats;
+
+    UCHAR net_type;
+    UCHAR sta_type;
+    UCHAR fw_ver;
+    UCHAR fw_bld;
+    UCHAR fw_var;
+    UCHAR ASIC_version;
+    UCHAR assoc_id[2];
+    UCHAR tib_length;
+    UCHAR last_rsl;
+    int beacon_rxed;
+    struct beacon_rx last_bcn;
+#ifdef WIRELESS_EXT
+    iw_stats	wstats;		/* Wireless specific stats */
+#endif
+#ifdef WIRELESS_SPY
+    int		spy_number;		/* Number of addresses to spy */
+    mac_addr	spy_address[IW_MAX_SPY + 1];	/* The addresses to spy */
+    iw_qual	spy_stat[IW_MAX_SPY + 1];	/* Statistics gathered */
+#endif	/* WIRELESS_SPY */
+
+} ray_dev_t;
+/*****************************************************************************/
+
+#endif /* RAYLINK_H */
diff -Nru a/drivers/net/wireless/rayctl.h b/drivers/net/wireless/rayctl.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/wireless/rayctl.h	Sun Feb 23 22:25:22 2003
@@ -0,0 +1,732 @@
+#ifndef RAYLINK_H
+
+typedef unsigned char UCHAR;
+
+/****** IEEE 802.11 constants ************************************************/
+#define ADDRLEN           6
+/* Frame control 1 bit fields */
+#define PROTOCOL_VER      0x00
+#define DATA_TYPE         0x08
+#define ASSOC_REQ_TYPE    0x00
+#define ASSOC_RESP_TYPE   0x10
+#define REASSOC_REQ_TYPE  0x20
+#define REASSOC_RESP_TYPE 0x30
+#define NULL_MSG_TYPE     0x48
+#define BEACON_TYPE       0x80
+#define DISASSOC_TYPE     0xA0
+#define PSPOLL_TYPE       0xA4
+#define AUTHENTIC_TYPE    0xB0
+#define DEAUTHENTIC_TYPE  0xC0
+/* Frame control 2 bit fields */
+#define FC2_TO_DS         0x01
+#define FC2_FROM_DS       0x02
+#define FC2_MORE_FRAG     0x04
+#define FC2_RETRY         0x08
+#define FC2_PSM           0x10
+#define FC2_MORE_DATA     0x20
+#define FC2_WEP           0x40
+#define FC2_ORDER         0x80
+/*****************************************************************************/
+/* 802.11 element ID's and lengths */
+#define C_BP_CAPABILITY_ESS             0x01
+#define C_BP_CAPABILITY_IBSS            0x02
+#define C_BP_CAPABILITY_CF_POLLABLE     0x04
+#define C_BP_CAPABILITY_CF_POLL_REQUEST 0x08
+#define C_BP_CAPABILITY_PRIVACY         0x10
+
+#define C_ESSID_ELEMENT_ID               0
+#define C_ESSID_ELEMENT_MAX_LENGTH       32
+
+#define C_SUPPORTED_RATES_ELEMENT_ID     1
+#define C_SUPPORTED_RATES_ELEMENT_LENGTH 2
+
+#define C_FH_PARAM_SET_ELEMENT_ID        2
+#define C_FH_PARAM_SET_ELEMENT_LNGTH     5
+
+#define C_CF_PARAM_SET_ELEMENT_ID        4
+#define C_CF_PARAM_SET_ELEMENT_LNGTH     6
+
+#define C_TIM_ELEMENT_ID                 5
+#define C_TIM_BITMAP_LENGTH            251
+#define C_TIM_BMCAST_BIT              0x01
+
+#define C_IBSS_ELEMENT_ID                6
+#define C_IBSS_ELEMENT_LENGTH            2
+
+#define C_JAPAN_CALL_SIGN_ELEMENT_ID    51
+#define C_JAPAN_CALL_SIGN_ELEMENT_LNGTH 12
+
+#define C_DISASSOC_REASON_CODE_LEN       2
+#define C_DISASSOC_REASON_CODE_DEFAULT   8
+
+#define C_CRC_LEN                        4
+#define C_NUM_SUPPORTED_RATES            8 
+/****** IEEE 802.11 mac header for type data packets *************************/
+struct mac_header {
+  UCHAR frame_ctl_1;                          
+  UCHAR frame_ctl_2;
+  UCHAR duration_lsb;
+  UCHAR duration_msb;
+  UCHAR addr_1[ADDRLEN];
+  UCHAR addr_2[ADDRLEN];
+  UCHAR addr_3[ADDRLEN];
+  UCHAR seq_frag_num[2];
+/*  UCHAR addr_4[ADDRLEN]; *//* only present for AP to AP (TO DS and FROM DS */
+};
+/****** IEEE 802.11 frame element structures *********************************/
+struct essid_element
+{
+  UCHAR id;
+  UCHAR length;
+  UCHAR text[C_ESSID_ELEMENT_MAX_LENGTH];
+};
+struct rates_element
+{
+  UCHAR id;
+  UCHAR length;
+  UCHAR value[8];
+};
+struct freq_hop_element
+{
+  UCHAR id;
+  UCHAR length;
+  UCHAR dwell_time[2];
+  UCHAR hop_set;
+  UCHAR hop_pattern;
+  UCHAR hop_index;
+};
+struct tim_element
+{
+  UCHAR id;
+  UCHAR length;
+  UCHAR dtim_count;
+  UCHAR dtim_period;    
+  UCHAR bitmap_control;
+  UCHAR tim[C_TIM_BITMAP_LENGTH];
+};
+struct ibss_element
+{
+  UCHAR id;
+  UCHAR length;
+  UCHAR atim_window[2];
+};
+struct japan_call_sign_element
+{
+  UCHAR id;
+  UCHAR length;
+  UCHAR call_sign[12];
+};
+/****** Beacon message structures ********************************************/
+/* .elements is a large lump of max size because elements are variable size  */
+struct infra_beacon
+{
+    UCHAR timestamp[8];
+    UCHAR beacon_intvl[2];
+    UCHAR capability[2];
+    UCHAR elements[sizeof(struct essid_element) 
+                  + sizeof(struct rates_element)
+                  + sizeof(struct freq_hop_element) 
+                  + sizeof(struct japan_call_sign_element)
+                  + sizeof(struct tim_element)];
+};
+struct adhoc_beacon
+{
+    UCHAR timestamp[8];
+    UCHAR beacon_intvl[2];
+    UCHAR capability[2];
+    UCHAR elements[sizeof(struct essid_element) 
+                  + sizeof(struct rates_element)
+                  + sizeof(struct freq_hop_element) 
+                  + sizeof(struct japan_call_sign_element)
+                  + sizeof(struct ibss_element)];
+};
+/*****************************************************************************/
+/*****************************************************************************/
+/* #define C_MAC_HDR_2_WEP 0x40 */
+/* TX/RX CCS constants */
+#define TX_HEADER_LENGTH 0x1C
+#define RX_MAC_HEADER_LENGTH 0x18
+#define TX_AUTHENTICATE_LENGTH (TX_HEADER_LENGTH + 6)
+#define TX_AUTHENTICATE_LENGTH_MSB (TX_AUTHENTICATE_LENGTH >> 8)
+#define TX_AUTHENTICATE_LENGTH_LSB (TX_AUTHENTICATE_LENGTH & 0xff)
+#define TX_DEAUTHENTICATE_LENGTH (TX_HEADER_LENGTH + 2)
+#define TX_DEAUTHENTICATE_LENGTH_MSB (TX_AUTHENTICATE_LENGTH >> 8)
+#define TX_DEAUTHENTICATE_LENGTH_LSB (TX_AUTHENTICATE_LENGTH & 0xff)
+#define FCS_LEN           4
+
+#define ADHOC                 0
+#define INFRA                 1
+
+#define TYPE_STA              0
+#define TYPE_AP               1
+
+#define PASSIVE_SCAN          1
+#define ACTIVE_SCAN           1
+
+#define PSM_CAM               0
+
+/* Country codes */
+#define USA                   1
+#define EUROPE                2
+#define JAPAN                 3
+#define KOREA                 4
+#define SPAIN                 5
+#define FRANCE                6
+#define ISRAEL                7
+#define AUSTRALIA             8
+#define JAPAN_TEST            9
+
+/* Hop pattern lengths */
+#define USA_HOP_MOD          79 
+#define EUROPE_HOP_MOD       79 
+#define JAPAN_HOP_MOD        23
+#define KOREA_HOP_MOD        23
+#define SPAIN_HOP_MOD        27
+#define FRANCE_HOP_MOD       35
+#define ISRAEL_HOP_MOD       35
+#define AUSTRALIA_HOP_MOD    47
+#define JAPAN_TEST_HOP_MOD   23
+
+#define ESSID_SIZE           32
+/**********************************************************************/
+/* CIS Register Constants */
+#define CIS_OFFSET             0x0f00
+/* Configuration Option Register (0x0F00) */
+#define COR_OFFSET             0x00
+#define COR_SOFT_RESET         0x80
+#define COR_LEVEL_IRQ          0x40
+#define COR_CONFIG_NUM         0x01
+#define COR_DEFAULT            (COR_LEVEL_IRQ | COR_CONFIG_NUM)
+
+/* Card Configuration and Status Register (0x0F01) */
+#define CCSR_OFFSET            0x01
+#define CCSR_HOST_INTR_PENDING 0x01
+#define CCSR_POWER_DOWN        0x04
+
+/* HCS Interrupt Register (0x0F05) */
+#define HCS_INTR_OFFSET        0x05
+/* #define HCS_INTR_OFFSET        0x0A */
+#define HCS_INTR_CLEAR         0x00
+
+/* ECF Interrupt Register (0x0F06) */
+#define ECF_INTR_OFFSET        0x06
+/* #define ECF_INTR_OFFSET        0x0C */
+#define ECF_INTR_SET           0x01
+
+/* Authorization Register 0 (0x0F08) */
+#define AUTH_0_ON              0x57
+
+/* Authorization Register 1 (0x0F09) */
+#define AUTH_1_ON              0x82
+
+/* Program Mode Register (0x0F0A) */
+#define PC2PM                  0x02
+#define PC2CAL                 0x10
+#define PC2MLSE                0x20
+
+/* PC Test Mode Register (0x0F0B) */
+#define PC_TEST_MODE           0x08
+
+/* Frequency Control Word (0x0F10) */
+/* Range 0x02 - 0xA6 */
+
+/* Test Mode Control 1-4 (0x0F14 - 0x0F17) */
+
+/**********************************************************************/
+
+/* Shared RAM Area */
+#define SCB_BASE               0x0000
+#define STATUS_BASE            0x0100
+#define HOST_TO_ECF_BASE       0x0200
+#define ECF_TO_HOST_BASE       0x0300
+#define CCS_BASE               0x0400
+#define RCS_BASE               0x0800
+#define INFRA_TIM_BASE         0x0C00
+#define SSID_LIST_BASE         0x0D00
+#define TX_BUF_BASE            0x1000
+#define RX_BUF_BASE            0x8000
+
+#define NUMBER_OF_CCS    64
+#define NUMBER_OF_RCS    64
+/*#define NUMBER_OF_TX_CCS 14 */
+#define NUMBER_OF_TX_CCS 14
+
+#define TX_BUF_SIZE      (2048 - sizeof(struct tx_msg))
+#define RX_BUFF_END      0x3FFF
+/* Values for buffer_status */
+#define CCS_BUFFER_FREE       0
+#define CCS_BUFFER_BUSY       1
+#define CCS_COMMAND_COMPLETE  2
+#define CCS_COMMAND_FAILED    3
+
+/* Values for cmd */
+#define CCS_DOWNLOAD_STARTUP_PARAMS    1
+#define CCS_UPDATE_PARAMS              2
+#define CCS_REPORT_PARAMS              3
+#define CCS_UPDATE_MULTICAST_LIST      4
+#define CCS_UPDATE_POWER_SAVINGS_MODE  5
+#define CCS_START_NETWORK              6
+#define CCS_JOIN_NETWORK               7
+#define CCS_START_ASSOCIATION          8
+#define CCS_TX_REQUEST                 9
+#define CCS_TEST_MEMORY              0xa
+#define CCS_SHUTDOWN                 0xb
+#define CCS_DUMP_MEMORY              0xc
+#define CCS_START_TIMER              0xe
+#define CCS_LAST_CMD                 CCS_START_TIMER
+
+/* Values for link field */
+#define CCS_END_LIST                 0xff
+
+/* values for buffer_status field */
+#define RCS_BUFFER_FREE       0
+#define RCS_BUFFER_BUSY       1
+#define RCS_COMPLETE          2
+#define RCS_FAILED            3
+#define RCS_BUFFER_RELEASE    0xFF
+
+/* values for interrupt_id field */
+#define PROCESS_RX_PACKET           0x80 /* */
+#define REJOIN_NET_COMPLETE         0x81 /* RCS ID: Rejoin Net Complete */
+#define ROAMING_INITIATED           0x82 /* RCS ID: Roaming Initiated   */
+#define JAPAN_CALL_SIGN_RXD         0x83 /* RCS ID: New Japan Call Sign */
+
+/*****************************************************************************/
+/* Memory types for dump memory command */
+#define C_MEM_PROG  0
+#define C_MEM_XDATA 1
+#define C_MEM_SFR   2
+#define C_MEM_IDATA 3
+
+/*** Return values for hw_xmit **********/
+#define XMIT_OK        (0)
+#define XMIT_MSG_BAD   (-1)
+#define XMIT_NO_CCS    (-2)
+#define XMIT_NO_INTR   (-3)
+#define XMIT_NEED_AUTH (-4)
+
+/*** Values for card status */
+#define CARD_INSERTED       (0)
+
+#define CARD_AWAITING_PARAM (1)
+#define CARD_INIT_ERROR     (11)
+
+#define CARD_DL_PARAM       (2)
+#define CARD_DL_PARAM_ERROR (12)
+
+#define CARD_DOING_ACQ      (3)
+
+#define CARD_ACQ_COMPLETE   (4)
+#define CARD_ACQ_FAILED     (14)
+
+#define CARD_AUTH_COMPLETE  (5)
+#define CARD_AUTH_REFUSED   (15)
+
+#define CARD_ASSOC_COMPLETE (6)
+#define CARD_ASSOC_FAILED   (16)
+
+/*** Values for authentication_state ***********************************/
+#define UNAUTHENTICATED     (0)
+#define AWAITING_RESPONSE   (1)
+#define AUTHENTICATED       (2)
+#define NEED_TO_AUTH        (3)
+
+/*** Values for authentication type ************************************/
+#define OPEN_AUTH_REQUEST   (1)
+#define OPEN_AUTH_RESPONSE  (2)
+#define BROADCAST_DEAUTH    (0xc0)
+/*** Values for timer functions ****************************************/
+#define TODO_NOTHING              (0)
+#define TODO_VERIFY_DL_START      (-1)
+#define TODO_START_NET            (-2)
+#define TODO_JOIN_NET             (-3)
+#define TODO_AUTHENTICATE_TIMEOUT (-4)
+#define TODO_SEND_CCS             (-5)
+/***********************************************************************/
+/* Parameter passing structure for update/report parameter CCS's */
+struct object_id {
+    void          *object_addr;
+    unsigned char object_length;
+};
+
+#define OBJID_network_type            0
+#define OBJID_acting_as_ap_status     1
+#define OBJID_current_ess_id          2
+#define OBJID_scanning_mode           3
+#define OBJID_power_mgt_state         4
+#define OBJID_mac_address             5
+#define OBJID_frag_threshold          6
+#define OBJID_hop_time                7
+#define OBJID_beacon_period           8
+#define OBJID_dtim_period             9
+#define OBJID_retry_max              10
+#define OBJID_ack_timeout            11
+#define OBJID_sifs                   12
+#define OBJID_difs                   13
+#define OBJID_pifs                   14
+#define OBJID_rts_threshold          15
+#define OBJID_scan_dwell_time        16
+#define OBJID_max_scan_dwell_time    17
+#define OBJID_assoc_resp_timeout     18
+#define OBJID_adhoc_scan_cycle_max   19
+#define OBJID_infra_scan_cycle_max   20
+#define OBJID_infra_super_cycle_max  21
+#define OBJID_promiscuous_mode       22
+#define OBJID_unique_word            23
+#define OBJID_slot_time              24
+#define OBJID_roaming_low_snr        25
+#define OBJID_low_snr_count_thresh   26
+#define OBJID_infra_missed_bcn       27
+#define OBJID_adhoc_missed_bcn       28
+#define OBJID_curr_country_code      29
+#define OBJID_hop_pattern            30
+#define OBJID_reserved               31
+#define OBJID_cw_max_msb             32
+#define OBJID_cw_min_msb             33
+#define OBJID_noise_filter_gain      34
+#define OBJID_noise_limit_offset     35
+#define OBJID_det_rssi_thresh_offset 36
+#define OBJID_med_busy_thresh_offset 37
+#define OBJID_det_sync_thresh        38
+#define OBJID_test_mode              39
+#define OBJID_test_min_chan_num      40
+#define OBJID_test_max_chan_num      41
+#define OBJID_allow_bcast_ID_prbrsp  42
+#define OBJID_privacy_must_start     43
+#define OBJID_privacy_can_join       44
+#define OBJID_basic_rate_set         45
+
+/**** Configuration/Status/Control Area ***************************/
+/*    System Control Block (SCB) Area
+ *    Located at Shared RAM offset 0
+ */
+struct scb {
+    UCHAR ccs_index;
+    UCHAR rcs_index;
+};
+
+/****** Status area at Shared RAM offset 0x0100 ******************************/
+struct status {
+    UCHAR mrx_overflow_for_host;         /* 0=ECF may write, 1=host may write*/
+    UCHAR mrx_checksum_error_for_host;   /* 0=ECF may write, 1=host may write*/
+    UCHAR rx_hec_error_for_host;         /* 0=ECF may write, 1=host may write*/
+    UCHAR reserved1;
+    short mrx_overflow;                  /* ECF increments on rx overflow    */
+    short mrx_checksum_error;            /* ECF increments on rx CRC error   */
+    short rx_hec_error;                  /* ECF incs on mac header CRC error */
+    UCHAR rxnoise;                       /* Average RSL measurement          */
+};
+
+/****** Host-to-ECF Data Area at Shared RAM offset 0x200 *********************/
+struct host_to_ecf_area {
+    
+};
+
+/****** ECF-to-Host Data Area at Shared RAM offset 0x0300 ********************/
+struct startup_res_518 {
+    UCHAR startup_word;
+    UCHAR station_addr[ADDRLEN];
+    UCHAR calc_prog_chksum;
+    UCHAR calc_cis_chksum;
+    UCHAR ecf_spare[7];
+    UCHAR japan_call_sign[12];
+};
+
+struct startup_res_6 {
+    UCHAR startup_word;
+    UCHAR station_addr[ADDRLEN];
+    UCHAR reserved;
+    UCHAR supp_rates[8];
+    UCHAR japan_call_sign[12];
+    UCHAR calc_prog_chksum;
+    UCHAR calc_cis_chksum;
+    UCHAR firmware_version[3];
+    UCHAR asic_version;
+    UCHAR tib_length;
+};
+
+struct start_join_net_params {
+    UCHAR net_type;
+    UCHAR ssid[ESSID_SIZE];
+    UCHAR reserved;
+    UCHAR privacy_can_join;
+};
+
+/****** Command Control Structure area at Shared ram offset 0x0400 ***********/
+/* Structures for command specific parameters (ccs.var) */
+struct update_param_cmd {
+    UCHAR object_id;
+    UCHAR number_objects;
+    UCHAR failure_cause;
+};
+struct report_param_cmd {
+    UCHAR object_id;
+    UCHAR number_objects;
+    UCHAR failure_cause;
+    UCHAR length;
+};
+struct start_network_cmd {
+    UCHAR update_param;
+    UCHAR bssid[ADDRLEN];
+    UCHAR net_initiated;
+    UCHAR net_default_tx_rate;
+    UCHAR encryption;
+};
+struct join_network_cmd {
+    UCHAR update_param;
+    UCHAR bssid[ADDRLEN];
+    UCHAR net_initiated;
+    UCHAR net_default_tx_rate;
+    UCHAR encryption;
+};
+struct tx_requested_cmd {
+ 
+    UCHAR tx_data_ptr[2];
+    UCHAR tx_data_length[2];
+    UCHAR host_reserved[2];
+    UCHAR reserved[3];
+    UCHAR tx_rate;
+    UCHAR pow_sav_mode;
+    UCHAR retries;
+    UCHAR antenna;
+};
+struct tx_requested_cmd_4 {
+ 
+    UCHAR tx_data_ptr[2];
+    UCHAR tx_data_length[2];
+    UCHAR dest_addr[ADDRLEN];
+    UCHAR pow_sav_mode;
+    UCHAR retries;
+    UCHAR station_id;
+};
+struct memory_dump_cmd {
+    UCHAR memory_type;
+    UCHAR memory_ptr[2];
+    UCHAR length;
+};
+struct update_association_cmd {
+    UCHAR status;
+    UCHAR aid[2];
+};
+struct start_timer_cmd {
+    UCHAR duration[2];
+};
+
+struct ccs {
+    UCHAR buffer_status;                 /* 0 = buffer free, 1 = buffer busy */
+                                         /* 2 = command complete, 3 = failed */
+    UCHAR cmd;                           /* command to ECF                   */
+    UCHAR link;                          /* link to next CCS, FF=end of list */
+    /* command specific parameters      */
+    union {
+        char reserved[13];
+        struct update_param_cmd update_param;
+        struct report_param_cmd report_param;
+        UCHAR nummulticast;
+        UCHAR mode;
+        struct start_network_cmd start_network;
+        struct join_network_cmd join_network;
+        struct tx_requested_cmd tx_request;
+        struct memory_dump_cmd memory_dump;
+        struct update_association_cmd update_assoc;
+        struct start_timer_cmd start_timer;
+    } var;
+};
+
+/*****************************************************************************/
+/* Transmit buffer structures */
+struct tib_structure {
+    UCHAR ccs_index;
+    UCHAR psm;
+    UCHAR pass_fail;
+    UCHAR retry_count;
+    UCHAR max_retries;
+    UCHAR frags_remaining;
+    UCHAR no_rb;
+    UCHAR rts_reqd;
+    UCHAR csma_tx_cntrl_2;
+    UCHAR sifs_tx_cntrl_2;
+    UCHAR tx_dma_addr_1[2];
+    UCHAR tx_dma_addr_2[2];
+    UCHAR var_dur_2mhz[2];
+    UCHAR var_dur_1mhz[2];
+    UCHAR max_dur_2mhz[2];
+    UCHAR max_dur_1mhz[2];
+    UCHAR hdr_len;
+    UCHAR max_frag_len[2];
+    UCHAR var_len[2];
+    UCHAR phy_hdr_4;
+    UCHAR mac_hdr_1;
+    UCHAR mac_hdr_2;
+    UCHAR sid[2];
+};
+
+struct phy_header {
+    UCHAR sfd[2];
+    UCHAR hdr_3;
+    UCHAR hdr_4;
+};
+struct rx_msg {
+    struct mac_header mac;
+    UCHAR  var[1];
+};
+
+struct tx_msg {
+    struct tib_structure tib;
+    struct phy_header phy;
+    struct mac_header mac;
+    UCHAR  var[1];
+};
+
+/****** ECF Receive Control Stucture (RCS) Area at Shared RAM offset 0x0800  */
+/* Structures for command specific parameters (rcs.var) */
+struct rx_packet_cmd {
+    UCHAR rx_data_ptr[2];
+    UCHAR rx_data_length[2];
+    UCHAR rx_sig_lev;
+    UCHAR next_frag_rcs_index;
+    UCHAR totalpacketlength[2];
+};
+struct rejoin_net_cmplt_cmd {
+    UCHAR reserved;
+    UCHAR bssid[ADDRLEN];
+};
+struct japan_call_sign_rxd {
+    UCHAR rxd_call_sign[8];
+    UCHAR reserved[5];
+};
+
+struct rcs {
+    UCHAR buffer_status;
+    UCHAR interrupt_id;
+    UCHAR link_field;
+    /* command specific parameters      */
+    union {
+        UCHAR reserved[13]; 
+        struct rx_packet_cmd rx_packet;
+        struct rejoin_net_cmplt_cmd rejoin_net_complete;
+        struct japan_call_sign_rxd japan_call_sign;
+    } var;
+};
+
+/****** Startup parameter structures for both versions of firmware ***********/
+struct b4_startup_params {
+    UCHAR a_network_type;                /* C_ADHOC, C_INFRA                 */
+    UCHAR a_acting_as_ap_status;         /* C_TYPE_STA, C_TYPE_AP            */
+    UCHAR a_current_ess_id[ESSID_SIZE];  /* Null terminated unless 32 long   */
+    UCHAR a_scanning_mode;               /* passive 0, active 1              */
+    UCHAR a_power_mgt_state;             /* CAM 0,                           */
+    UCHAR a_mac_addr[ADDRLEN];           /*                                  */
+    UCHAR a_frag_threshold[2];           /* 512                              */
+    UCHAR a_hop_time[2];                 /* 16k * 2**n, n=0-4 in Kus         */
+    UCHAR a_beacon_period[2];            /* n * a_hop_time  in Kus           */
+    UCHAR a_dtim_period;                 /* in beacons                       */
+    UCHAR a_retry_max;                   /*                                  */
+    UCHAR a_ack_timeout;                 /*                                  */
+    UCHAR a_sifs;                        /*                                  */
+    UCHAR a_difs;                        /*                                  */
+    UCHAR a_pifs;                        /*                                  */
+    UCHAR a_rts_threshold[2];            /*                                  */
+    UCHAR a_scan_dwell_time[2];          /*                                  */
+    UCHAR a_max_scan_dwell_time[2];      /*                                  */
+    UCHAR a_assoc_resp_timeout_thresh;   /*                                  */
+    UCHAR a_adhoc_scan_cycle_max;        /*                                  */
+    UCHAR a_infra_scan_cycle_max;        /*                                  */
+    UCHAR a_infra_super_scan_cycle_max;  /*                                  */
+    UCHAR a_promiscuous_mode;            /*                                  */
+    UCHAR a_unique_word[2];              /*                                  */
+    UCHAR a_slot_time;                   /*                                  */
+    UCHAR a_roaming_low_snr_thresh;      /*                                  */
+    UCHAR a_low_snr_count_thresh;        /*                                  */
+    UCHAR a_infra_missed_bcn_thresh;     /*                                  */
+    UCHAR a_adhoc_missed_bcn_thresh;     /*                                  */
+    UCHAR a_curr_country_code;           /* C_USA                            */
+    UCHAR a_hop_pattern;                 /*                                  */
+    UCHAR a_hop_pattern_length;          /*                                  */
+/* b4 - b5 differences start here */
+    UCHAR a_cw_max;                      /*                                  */
+    UCHAR a_cw_min;                      /*                                  */
+    UCHAR a_noise_filter_gain;           /*                                  */
+    UCHAR a_noise_limit_offset;          /*                                  */
+    UCHAR a_det_rssi_thresh_offset;      /*                                  */
+    UCHAR a_med_busy_thresh_offset;      /*                                  */
+    UCHAR a_det_sync_thresh;             /*                                  */
+    UCHAR a_test_mode;                   /*                                  */
+    UCHAR a_test_min_chan_num;           /*                                  */
+    UCHAR a_test_max_chan_num;           /*                                  */
+    UCHAR a_rx_tx_delay;                 /*                                  */
+    UCHAR a_current_bss_id[ADDRLEN];     /*                                  */
+    UCHAR a_hop_set;                     /*                                  */
+};
+struct b5_startup_params {
+    UCHAR a_network_type;                /* C_ADHOC, C_INFRA                 */
+    UCHAR a_acting_as_ap_status;         /* C_TYPE_STA, C_TYPE_AP            */
+    UCHAR a_current_ess_id[ESSID_SIZE];  /* Null terminated unless 32 long   */
+    UCHAR a_scanning_mode;               /* passive 0, active 1              */
+    UCHAR a_power_mgt_state;             /* CAM 0,                           */
+    UCHAR a_mac_addr[ADDRLEN];           /*                                  */
+    UCHAR a_frag_threshold[2];           /* 512                              */
+    UCHAR a_hop_time[2];                 /* 16k * 2**n, n=0-4 in Kus         */
+    UCHAR a_beacon_period[2];            /* n * a_hop_time  in Kus           */
+    UCHAR a_dtim_period;                 /* in beacons                       */
+    UCHAR a_retry_max;                   /* 4                                */
+    UCHAR a_ack_timeout;                 /*                                  */
+    UCHAR a_sifs;                        /*                                  */
+    UCHAR a_difs;                        /*                                  */
+    UCHAR a_pifs;                        /*                                  */
+    UCHAR a_rts_threshold[2];            /*                                  */
+    UCHAR a_scan_dwell_time[2];          /*                                  */
+    UCHAR a_max_scan_dwell_time[2];      /*                                  */
+    UCHAR a_assoc_resp_timeout_thresh;   /*                                  */
+    UCHAR a_adhoc_scan_cycle_max;        /*                                  */
+    UCHAR a_infra_scan_cycle_max;        /*                                  */
+    UCHAR a_infra_super_scan_cycle_max;  /*                                  */
+    UCHAR a_promiscuous_mode;            /*                                  */
+    UCHAR a_unique_word[2];              /*                                  */
+    UCHAR a_slot_time;                   /*                                  */
+    UCHAR a_roaming_low_snr_thresh;      /*                                  */
+    UCHAR a_low_snr_count_thresh;        /*                                  */
+    UCHAR a_infra_missed_bcn_thresh;     /*                                  */
+    UCHAR a_adhoc_missed_bcn_thresh;     /*                                  */
+    UCHAR a_curr_country_code;           /* C_USA                            */
+    UCHAR a_hop_pattern;                 /*                                  */
+    UCHAR a_hop_pattern_length;          /*                                  */
+/* b4 - b5 differences start here */
+    UCHAR a_cw_max[2];                   /*                                  */
+    UCHAR a_cw_min[2];                   /*                                  */
+    UCHAR a_noise_filter_gain;           /*                                  */
+    UCHAR a_noise_limit_offset;          /*                                  */
+    UCHAR a_det_rssi_thresh_offset;      /*                                  */
+    UCHAR a_med_busy_thresh_offset;      /*                                  */
+    UCHAR a_det_sync_thresh;             /*                                  */
+    UCHAR a_test_mode;                   /*                                  */
+    UCHAR a_test_min_chan_num;           /*                                  */
+    UCHAR a_test_max_chan_num;           /*                                  */
+    UCHAR a_allow_bcast_SSID_probe_rsp;
+    UCHAR a_privacy_must_start;
+    UCHAR a_privacy_can_join;
+    UCHAR a_basic_rate_set[8];
+};
+
+/*****************************************************************************/
+#define RAY_IOCG_PARMS (SIOCDEVPRIVATE)
+#define RAY_IOCS_PARMS (SIOCDEVPRIVATE + 1)
+#define RAY_DO_CMD     (SIOCDEVPRIVATE + 2)
+
+/****** ethernet <-> 802.11 translation **************************************/
+typedef struct snaphdr_t
+{
+  UCHAR   dsap;
+  UCHAR   ssap;
+  UCHAR   ctrl;
+  UCHAR   org[3];
+  UCHAR   ethertype[2];
+} snaphdr_t;
+
+#define BRIDGE_ENCAP  0xf80000
+#define RFC1042_ENCAP 0
+#define SNAP_ID       0x0003aaaa
+#define RAY_IPX_TYPE  0x8137
+#define APPLEARP_TYPE 0x80f3
+/*****************************************************************************/
+#endif /* #ifndef RAYLINK_H */
diff -Nru a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/wireless/strip.c	Sun Feb 23 22:25:25 2003
@@ -0,0 +1,2877 @@
+/*
+ * Copyright 1996 The Board of Trustees of The Leland Stanford
+ * Junior University. All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies.  Stanford University
+ * makes no representations about the suitability of this
+ * software for any purpose.  It is provided "as is" without
+ * express or implied warranty.
+ *
+ * strip.c	This module implements Starmode Radio IP (STRIP)
+ *		for kernel-based devices like TTY.  It interfaces between a
+ *		raw TTY, and the kernel's INET protocol layers (via DDI).
+ *
+ * Version:	@(#)strip.c	1.3	July 1997
+ *
+ * Author:	Stuart Cheshire <cheshire@cs.stanford.edu>
+ *
+ * Fixes:	v0.9 12th Feb 1996 (SC)
+ *		New byte stuffing (2+6 run-length encoding)
+ *		New watchdog timer task
+ *		New Protocol key (SIP0)
+ *		
+ *		v0.9.1 3rd March 1996 (SC)
+ *		Changed to dynamic device allocation -- no more compile
+ *		time (or boot time) limit on the number of STRIP devices.
+ *		
+ *		v0.9.2 13th March 1996 (SC)
+ *		Uses arp cache lookups (but doesn't send arp packets yet)
+ *		
+ *		v0.9.3 17th April 1996 (SC)
+ *		Fixed bug where STR_ERROR flag was getting set unneccessarily
+ *		(causing otherwise good packets to be unneccessarily dropped)
+ *		
+ *		v0.9.4 27th April 1996 (SC)
+ *		First attempt at using "&COMMAND" Starmode AT commands
+ *		
+ *		v0.9.5 29th May 1996 (SC)
+ *		First attempt at sending (unicast) ARP packets
+ *		
+ *		v0.9.6 5th June 1996 (Elliot)
+ *		Put "message level" tags in every "printk" statement
+ *		
+ *		v0.9.7 13th June 1996 (laik)
+ *		Added support for the /proc fs
+ *
+ *              v0.9.8 July 1996 (Mema)
+ *              Added packet logging
+ *
+ *              v1.0 November 1996 (SC)
+ *              Fixed (severe) memory leaks in the /proc fs code
+ *              Fixed race conditions in the logging code
+ *
+ *              v1.1 January 1997 (SC)
+ *              Deleted packet logging (use tcpdump instead)
+ *              Added support for Metricom Firmware v204 features
+ *              (like message checksums)
+ *
+ *              v1.2 January 1997 (SC)
+ *              Put portables list back in
+ *
+ *              v1.3 July 1997 (SC)
+ *              Made STRIP driver set the radio's baud rate automatically.
+ *              It is no longer necessarily to manually set the radio's
+ *              rate permanently to 115200 -- the driver handles setting
+ *              the rate automatically.
+ */
+
+#ifdef MODULE
+static const char StripVersion[] = "1.3-STUART.CHESHIRE-MODULAR";
+#else
+static const char StripVersion[] = "1.3-STUART.CHESHIRE";
+#endif
+
+#define TICKLE_TIMERS 0
+#define EXT_COUNTERS 1
+
+
+/************************************************************************/
+/* Header files								*/
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/version.h>
+#include <linux/init.h>
+#include <asm/system.h>
+#include <asm/uaccess.h>
+#include <asm/bitops.h>
+
+/*
+ * isdigit() and isspace() use the ctype[] array, which is not available
+ * to kernel modules.  If compiling as a module,  use  a local definition
+ * of isdigit() and isspace() until  _ctype is added to ksyms.
+ */
+#ifdef MODULE
+# define isdigit(c) ('0' <= (c) && (c)  <= '9')
+# define isspace(c) ((c) == ' ' || (c)  == '\t')
+#else
+# include <linux/ctype.h>
+#endif
+
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/in.h>
+#include <linux/tty.h>
+#include <linux/errno.h>
+#include <linux/netdevice.h>
+#include <linux/inetdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include <linux/if_arp.h>
+#include <linux/if_strip.h>
+#include <linux/proc_fs.h>
+#include <linux/serial.h>
+#include <linux/serialP.h>
+#include <net/arp.h>
+
+#include <linux/ip.h>
+#include <linux/tcp.h>
+#include <linux/time.h>
+
+
+/************************************************************************/
+/* Useful structures and definitions					*/
+
+/*
+ * A MetricomKey identifies the protocol being carried inside a Metricom
+ * Starmode packet.
+ */
+
+typedef union
+{
+    __u8 c[4];
+    __u32 l;
+} MetricomKey;
+
+/*
+ * An IP address can be viewed as four bytes in memory (which is what it is) or as
+ * a single 32-bit long (which is convenient for assignment, equality testing etc.)
+ */
+
+typedef union
+{
+    __u8 b[4];
+    __u32 l;
+} IPaddr;
+
+/*
+ * A MetricomAddressString is used to hold a printable representation of
+ * a Metricom address.
+ */
+
+typedef struct
+{
+    __u8 c[24];
+} MetricomAddressString;
+
+/* Encapsulation can expand packet of size x to 65/64x + 1
+ * Sent packet looks like "<CR>*<address>*<key><encaps payload><CR>"
+ *                           1 1   1-18  1  4         ?         1
+ * eg.                     <CR>*0000-1234*SIP0<encaps payload><CR>
+ * We allow 31 bytes for the stars, the key, the address and the <CR>s
+ */
+#define STRIP_ENCAP_SIZE(X) (32 + (X)*65L/64L)
+
+/*
+ * A STRIP_Header is never really sent over the radio, but making a dummy
+ * header for internal use within the kernel that looks like an Ethernet
+ * header makes certain other software happier. For example, tcpdump
+ * already understands Ethernet headers.
+ */
+
+typedef struct
+{
+    MetricomAddress dst_addr;		/* Destination address, e.g. "0000-1234"   */
+    MetricomAddress src_addr;		/* Source address, e.g. "0000-5678"        */
+    unsigned short  protocol;		/* The protocol type, using Ethernet codes */
+} STRIP_Header;
+
+typedef struct
+{
+    char c[60];
+} MetricomNode;
+
+#define NODE_TABLE_SIZE 32
+typedef struct
+{
+    struct timeval timestamp;
+    int            num_nodes;
+    MetricomNode   node[NODE_TABLE_SIZE];
+} MetricomNodeTable;
+
+enum { FALSE = 0, TRUE = 1 };
+
+/*
+ * Holds the radio's firmware version.
+ */
+typedef struct
+{
+    char c[50];
+} FirmwareVersion;
+
+/*
+ * Holds the radio's serial number.
+ */
+typedef struct
+{
+    char c[18];
+} SerialNumber;
+
+/*
+ * Holds the radio's battery voltage.
+ */
+typedef struct
+{
+    char c[11];
+} BatteryVoltage;
+
+typedef struct
+{
+    char c[8];
+} char8;
+
+enum
+{
+    NoStructure = 0,		/* Really old firmware */
+    StructuredMessages = 1,	/* Parsable AT response msgs */
+    ChecksummedMessages = 2	/* Parsable AT response msgs with checksums */
+} FirmwareLevel;
+
+struct strip
+{
+    int magic;
+    /*
+     * These are pointers to the malloc()ed frame buffers.
+     */
+
+    unsigned char     *rx_buff;			/* buffer for received IP packet*/
+    unsigned char     *sx_buff;			/* buffer for received serial data*/
+    int                sx_count;		/* received serial data counter */
+    int                sx_size;			/* Serial buffer size		*/
+    unsigned char     *tx_buff;			/* transmitter buffer           */
+    unsigned char     *tx_head;			/* pointer to next byte to XMIT */
+    int                tx_left;			/* bytes left in XMIT queue     */
+    int                tx_size;			/* Serial buffer size		*/
+
+    /*
+     * STRIP interface statistics.
+     */
+
+    unsigned long      rx_packets;		/* inbound frames counter	*/
+    unsigned long      tx_packets;		/* outbound frames counter	*/
+    unsigned long      rx_errors;		/* Parity, etc. errors		*/
+    unsigned long      tx_errors;		/* Planned stuff		*/
+    unsigned long      rx_dropped;		/* No memory for skb		*/
+    unsigned long      tx_dropped;		/* When MTU change		*/
+    unsigned long      rx_over_errors;		/* Frame bigger then STRIP buf. */
+
+    unsigned long      pps_timer;		/* Timer to determine pps	*/
+    unsigned long      rx_pps_count;		/* Counter to determine pps	*/
+    unsigned long      tx_pps_count;		/* Counter to determine pps	*/
+    unsigned long      sx_pps_count;		/* Counter to determine pps	*/
+    unsigned long      rx_average_pps;		/* rx packets per second * 8	*/
+    unsigned long      tx_average_pps;		/* tx packets per second * 8	*/
+    unsigned long      sx_average_pps;		/* sent packets per second * 8	*/
+
+#ifdef EXT_COUNTERS
+    unsigned long      rx_bytes;                /* total received bytes */
+    unsigned long      tx_bytes;                /* total received bytes */
+    unsigned long      rx_rbytes;               /* bytes thru radio i/f */
+    unsigned long      tx_rbytes;               /* bytes thru radio i/f */
+    unsigned long      rx_sbytes;               /* tot bytes thru serial i/f */
+    unsigned long      tx_sbytes;               /* tot bytes thru serial i/f */
+    unsigned long      rx_ebytes;               /* tot stat/err bytes */
+    unsigned long      tx_ebytes;               /* tot stat/err bytes */
+#endif
+
+    /*
+     * Internal variables.
+     */
+
+    struct strip      *next;			/* The next struct in the list	*/
+    struct strip     **referrer;		/* The pointer that points to us*/
+    int                discard;			/* Set if serial error		*/
+    int                working;			/* Is radio working correctly?	*/
+    int                firmware_level;		/* Message structuring level	*/
+    int                next_command;		/* Next periodic command	*/
+    unsigned int       user_baud;		/* The user-selected baud rate  */
+    int                mtu;			/* Our mtu (to spot changes!)	*/
+    long               watchdog_doprobe;	/* Next time to test the radio	*/
+    long               watchdog_doreset;	/* Time to do next reset	*/
+    long               gratuitous_arp;		/* Time to send next ARP refresh*/
+    long               arp_interval;		/* Next ARP interval		*/
+    struct timer_list  idle_timer;		/* For periodic wakeup calls	*/
+    MetricomAddress    true_dev_addr;		/* True address of radio	*/
+    int                manual_dev_addr;		/* Hack: See note below         */
+
+    FirmwareVersion    firmware_version;	/* The radio's firmware version */
+    SerialNumber       serial_number;		/* The radio's serial number    */
+    BatteryVoltage     battery_voltage;		/* The radio's battery voltage  */
+
+    /*
+     * Other useful structures.
+     */
+
+    struct tty_struct *tty;			/* ptr to TTY structure		*/
+    struct net_device      dev;			/* Our device structure		*/
+
+    /*
+     * Neighbour radio records
+     */
+
+    MetricomNodeTable  portables;
+    MetricomNodeTable  poletops;
+};
+
+/*
+ * Note: manual_dev_addr hack
+ * 
+ * It is not possible to change the hardware address of a Metricom radio,
+ * or to send packets with a user-specified hardware source address, thus
+ * trying to manually set a hardware source address is a questionable
+ * thing to do.  However, if the user *does* manually set the hardware
+ * source address of a STRIP interface, then the kernel will believe it,
+ * and use it in certain places. For example, the hardware address listed
+ * by ifconfig will be the manual address, not the true one.
+ * (Both addresses are listed in /proc/net/strip.)
+ * Also, ARP packets will be sent out giving the user-specified address as
+ * the source address, not the real address. This is dangerous, because
+ * it means you won't receive any replies -- the ARP replies will go to
+ * the specified address, which will be some other radio. The case where
+ * this is useful is when that other radio is also connected to the same
+ * machine. This allows you to connect a pair of radios to one machine,
+ * and to use one exclusively for inbound traffic, and the other
+ * exclusively for outbound traffic. Pretty neat, huh?
+ * 
+ * Here's the full procedure to set this up:
+ * 
+ * 1. "slattach" two interfaces, e.g. st0 for outgoing packets,
+ *    and st1 for incoming packets
+ * 
+ * 2. "ifconfig" st0 (outbound radio) to have the hardware address
+ *    which is the real hardware address of st1 (inbound radio).
+ *    Now when it sends out packets, it will masquerade as st1, and
+ *    replies will be sent to that radio, which is exactly what we want.
+ * 
+ * 3. Set the route table entry ("route add default ..." or
+ *    "route add -net ...", as appropriate) to send packets via the st0
+ *    interface (outbound radio). Do not add any route which sends packets
+ *    out via the st1 interface -- that radio is for inbound traffic only.
+ * 
+ * 4. "ifconfig" st1 (inbound radio) to have hardware address zero.
+ *    This tells the STRIP driver to "shut down" that interface and not
+ *    send any packets through it. In particular, it stops sending the
+ *    periodic gratuitous ARP packets that a STRIP interface normally sends.
+ *    Also, when packets arrive on that interface, it will search the
+ *    interface list to see if there is another interface who's manual
+ *    hardware address matches its own real address (i.e. st0 in this
+ *    example) and if so it will transfer ownership of the skbuff to
+ *    that interface, so that it looks to the kernel as if the packet
+ *    arrived on that interface. This is necessary because when the
+ *    kernel sends an ARP packet on st0, it expects to get a reply on
+ *    st0, and if it sees the reply come from st1 then it will ignore
+ *    it (to be accurate, it puts the entry in the ARP table, but
+ *    labelled in such a way that st0 can't use it).
+ * 
+ * Thanks to Petros Maniatis for coming up with the idea of splitting
+ * inbound and outbound traffic between two interfaces, which turned
+ * out to be really easy to implement, even if it is a bit of a hack.
+ * 
+ * Having set a manual address on an interface, you can restore it
+ * to automatic operation (where the address is automatically kept
+ * consistent with the real address of the radio) by setting a manual
+ * address of all ones, e.g. "ifconfig st0 hw strip FFFFFFFFFFFF"
+ * This 'turns off' manual override mode for the device address.
+ * 
+ * Note: The IEEE 802 headers reported in tcpdump will show the *real*
+ * radio addresses the packets were sent and received from, so that you
+ * can see what is really going on with packets, and which interfaces
+ * they are really going through.
+ */
+
+
+/************************************************************************/
+/* Constants								*/
+
+/*
+ * CommandString1 works on all radios
+ * Other CommandStrings are only used with firmware that provides structured responses.
+ * 
+ * ats319=1 Enables Info message for node additions and deletions
+ * ats319=2 Enables Info message for a new best node
+ * ats319=4 Enables checksums
+ * ats319=8 Enables ACK messages
+ */
+
+static const int MaxCommandStringLength = 32;
+static const int CompatibilityCommand = 1;
+
+static const char CommandString0[] = "*&COMMAND*ATS319=7";	/* Turn on checksums & info messages */
+static const char CommandString1[] = "*&COMMAND*ATS305?";	/* Query radio name */
+static const char CommandString2[] = "*&COMMAND*ATS325?";	/* Query battery voltage */
+static const char CommandString3[] = "*&COMMAND*ATS300?";	/* Query version information */
+static const char CommandString4[] = "*&COMMAND*ATS311?";	/* Query poletop list */
+static const char CommandString5[] = "*&COMMAND*AT~LA";		/* Query portables list */
+typedef struct { const char *string; long length; } StringDescriptor;
+
+static const StringDescriptor CommandString[] =
+    {
+    { CommandString0, sizeof(CommandString0)-1 },
+    { CommandString1, sizeof(CommandString1)-1 },
+    { CommandString2, sizeof(CommandString2)-1 },
+    { CommandString3, sizeof(CommandString3)-1 },
+    { CommandString4, sizeof(CommandString4)-1 },
+    { CommandString5, sizeof(CommandString5)-1 }
+    };
+
+#define GOT_ALL_RADIO_INFO(S)      \
+    ((S)->firmware_version.c[0] && \
+     (S)->battery_voltage.c[0]  && \
+     memcmp(&(S)->true_dev_addr, zero_address.c, sizeof(zero_address)))
+
+static const char            hextable[16]      = "0123456789ABCDEF";
+
+static const MetricomAddress zero_address;
+static const MetricomAddress broadcast_address = { { 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF } };
+
+static const MetricomKey     SIP0Key           = { { "SIP0" } };
+static const MetricomKey     ARP0Key           = { { "ARP0" } };
+static const MetricomKey     ATR_Key           = { { "ATR " } };
+static const MetricomKey     ACK_Key           = { { "ACK_" } };
+static const MetricomKey     INF_Key           = { { "INF_" } };
+static const MetricomKey     ERR_Key           = { { "ERR_" } };
+
+static const long            MaxARPInterval    = 60 * HZ;          /* One minute */
+
+/*
+ * Maximum Starmode packet length is 1183 bytes. Allowing 4 bytes for
+ * protocol key, 4 bytes for checksum, one byte for CR, and 65/64 expansion
+ * for STRIP encoding, that translates to a maximum payload MTU of 1155.
+ * Note: A standard NFS 1K data packet is a total of 0x480 (1152) bytes
+ * long, including IP header, UDP header, and NFS header. Setting the STRIP
+ * MTU to 1152 allows us to send default sized NFS packets without fragmentation.
+ */
+static const unsigned short  MAX_SEND_MTU          = 1152;
+static const unsigned short  MAX_RECV_MTU          = 1500; /* Hoping for Ethernet sized packets in the future! */
+static const unsigned short  DEFAULT_STRIP_MTU      = 1152;
+static const int             STRIP_MAGIC            = 0x5303;
+static const long            LongTime               = 0x7FFFFFFF;
+
+
+/************************************************************************/
+/* Global variables							*/
+
+static struct strip *struct_strip_list;
+
+
+/************************************************************************/
+/* Macros								*/
+
+/* Returns TRUE if text T begins with prefix P */
+#define has_prefix(T,L,P) (((L) >= sizeof(P)-1) && !strncmp((T), (P), sizeof(P)-1))
+
+/* Returns TRUE if text T of length L is equal to string S */
+#define text_equal(T,L,S) (((L) == sizeof(S)-1) && !strncmp((T), (S), sizeof(S)-1))
+
+#define READHEX(X) ((X)>='0' && (X)<='9' ? (X)-'0' :      \
+                    (X)>='a' && (X)<='f' ? (X)-'a'+10 :   \
+                    (X)>='A' && (X)<='F' ? (X)-'A'+10 : 0 )
+
+#define READHEX16(X) ((__u16)(READHEX(X)))
+
+#define READDEC(X) ((X)>='0' && (X)<='9' ? (X)-'0' : 0)
+
+#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
+#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
+#define ELEMENTS_OF(X) (sizeof(X) / sizeof((X)[0]))
+#define ARRAY_END(X) (&((X)[ELEMENTS_OF(X)]))
+
+#define JIFFIE_TO_SEC(X) ((X) / HZ)
+
+
+/************************************************************************/
+/* Utility routines							*/
+
+typedef unsigned long InterruptStatus;
+
+static inline InterruptStatus DisableInterrupts(void)
+{
+    InterruptStatus x;
+    save_flags(x);
+    cli();
+    return(x);
+}
+
+static inline void RestoreInterrupts(InterruptStatus x)
+{
+    restore_flags(x);
+}
+
+static int arp_query(unsigned char *haddr, u32 paddr, struct net_device * dev)
+{
+    struct neighbour *neighbor_entry;
+
+    neighbor_entry = neigh_lookup(&arp_tbl, &paddr, dev);
+
+    if (neighbor_entry != NULL)
+    {
+	neighbor_entry->used = jiffies;
+	if (neighbor_entry->nud_state & NUD_VALID)
+	{
+	    memcpy(haddr, neighbor_entry->ha, dev->addr_len);
+	    return 1;
+	}
+    }
+    return 0;
+}
+
+static void DumpData(char *msg, struct strip *strip_info, __u8 *ptr, __u8 *end)
+{
+    static const int MAX_DumpData = 80;
+    __u8 pkt_text[MAX_DumpData], *p = pkt_text;
+
+    *p++ = '\"';
+
+    while (ptr<end && p < &pkt_text[MAX_DumpData-4])
+    {
+        if (*ptr == '\\')
+        {
+            *p++ = '\\';
+            *p++ = '\\';
+        }
+        else
+        {
+            if (*ptr >= 32 && *ptr <= 126)
+            {
+                *p++ = *ptr;
+            }
+            else
+            {
+                sprintf(p, "\\%02X", *ptr);
+                p+= 3;
+            }
+        }
+        ptr++;
+    }
+
+    if (ptr == end)
+    {
+        *p++ = '\"';
+    }
+
+    *p++ = 0;
+
+    printk(KERN_INFO "%s: %-13s%s\n", strip_info->dev.name, msg, pkt_text);
+}
+
+#if 0
+static void HexDump(char *msg, struct strip *strip_info, __u8 *start, __u8 *end)
+{
+    __u8 *ptr = start;
+    printk(KERN_INFO "%s: %s: %d bytes\n", strip_info->dev.name, msg, end-ptr);
+
+    while (ptr < end)
+    {
+        long offset = ptr - start;
+        __u8 text[80], *p = text;
+        while (ptr < end && p < &text[16*3])
+        {
+            *p++ = hextable[*ptr >> 4];
+            *p++ = hextable[*ptr++ & 0xF];
+            *p++ = ' ';
+        }
+        p[-1] = 0;
+        printk(KERN_INFO "%s: %4lX %s\n", strip_info->dev.name, offset, text);
+    }
+}
+#endif
+
+
+/************************************************************************/
+/* Byte stuffing/unstuffing routines					*/
+
+/* Stuffing scheme:
+ * 00    Unused (reserved character)
+ * 01-3F Run of 2-64 different characters
+ * 40-7F Run of 1-64 different characters plus a single zero at the end
+ * 80-BF Run of 1-64 of the same character
+ * C0-FF Run of 1-64 zeroes (ASCII 0)
+ */
+
+typedef enum
+{
+    Stuff_Diff      = 0x00,
+    Stuff_DiffZero  = 0x40,
+    Stuff_Same      = 0x80,
+    Stuff_Zero      = 0xC0,
+    Stuff_NoCode    = 0xFF,	/* Special code, meaning no code selected */
+
+    Stuff_CodeMask  = 0xC0,
+    Stuff_CountMask = 0x3F,
+    Stuff_MaxCount  = 0x3F,
+    Stuff_Magic     = 0x0D	/* The value we are eliminating */
+} StuffingCode;
+
+/* StuffData encodes the data starting at "src" for "length" bytes.
+ * It writes it to the buffer pointed to by "dst" (which must be at least
+ * as long as 1 + 65/64 of the input length). The output may be up to 1.6%
+ * larger than the input for pathological input, but will usually be smaller.
+ * StuffData returns the new value of the dst pointer as its result.
+ * "code_ptr_ptr" points to a "__u8 *" which is used to hold encoding state
+ * between calls, allowing an encoded packet to be incrementally built up
+ * from small parts. On the first call, the "__u8 *" pointed to should be
+ * initialized to NULL; between subsequent calls the calling routine should
+ * leave the value alone and simply pass it back unchanged so that the
+ * encoder can recover its current state.
+ */
+
+#define StuffData_FinishBlock(X) \
+(*code_ptr = (X) ^ Stuff_Magic, code = Stuff_NoCode)
+
+static __u8 *StuffData(__u8 *src, __u32 length, __u8 *dst, __u8 **code_ptr_ptr)
+{
+    __u8 *end = src + length;
+    __u8 *code_ptr = *code_ptr_ptr;
+     __u8 code = Stuff_NoCode, count = 0;
+
+    if (!length)
+        return(dst);
+
+    if (code_ptr)
+    {
+        /*
+         * Recover state from last call, if applicable
+         */
+        code  = (*code_ptr ^ Stuff_Magic) & Stuff_CodeMask;
+        count = (*code_ptr ^ Stuff_Magic) & Stuff_CountMask;
+    }
+
+    while (src < end)
+    {
+        switch (code)
+        {
+            /* Stuff_NoCode: If no current code, select one */
+            case Stuff_NoCode:
+                /* Record where we're going to put this code */
+                code_ptr = dst++;
+                count = 0;    /* Reset the count (zero means one instance) */
+                /* Tentatively start a new block */
+                if (*src == 0)
+                {
+                    code = Stuff_Zero;
+                    src++;
+                }
+                else
+                {
+                    code = Stuff_Same;
+                    *dst++ = *src++ ^ Stuff_Magic;
+                }
+                /* Note: We optimistically assume run of same -- */
+                /* which will be fixed later in Stuff_Same */
+                /* if it turns out not to be true. */
+                break;
+
+            /* Stuff_Zero: We already have at least one zero encoded */
+            case Stuff_Zero:
+                /* If another zero, count it, else finish this code block */
+                if (*src == 0)
+                {
+                    count++;
+                    src++;
+                }
+                else
+                {
+                    StuffData_FinishBlock(Stuff_Zero + count);
+                }
+                break;
+
+            /* Stuff_Same: We already have at least one byte encoded */
+            case Stuff_Same:
+                /* If another one the same, count it */
+                if ((*src ^ Stuff_Magic) == code_ptr[1])
+                {
+                    count++;
+                    src++;
+                    break;
+                }
+                /* else, this byte does not match this block. */
+                /* If we already have two or more bytes encoded, finish this code block */
+                if (count)
+                {
+                    StuffData_FinishBlock(Stuff_Same + count);
+                    break;
+                }
+                /* else, we only have one so far, so switch to Stuff_Diff code */
+                code = Stuff_Diff;
+                /* and fall through to Stuff_Diff case below
+                 * Note cunning cleverness here: case Stuff_Diff compares 
+                 * the current character with the previous two to see if it
+                 * has a run of three the same. Won't this be an error if
+                 * there aren't two previous characters stored to compare with?
+                 * No. Because we know the current character is *not* the same
+                 * as the previous one, the first test below will necessarily
+                 * fail and the send half of the "if" won't be executed.
+                 */
+
+            /* Stuff_Diff: We have at least two *different* bytes encoded */
+            case Stuff_Diff:
+                /* If this is a zero, must encode a Stuff_DiffZero, and begin a new block */
+                if (*src == 0)
+                {
+                    StuffData_FinishBlock(Stuff_DiffZero + count);
+                }
+                /* else, if we have three in a row, it is worth starting a Stuff_Same block */
+                else if ((*src ^ Stuff_Magic)==dst[-1] && dst[-1]==dst[-2])
+                {
+                    /* Back off the last two characters we encoded */
+                    code += count-2;
+                    /* Note: "Stuff_Diff + 0" is an illegal code */
+                    if (code == Stuff_Diff + 0)
+                    {
+                        code = Stuff_Same + 0;
+                    }
+                    StuffData_FinishBlock(code);
+                    code_ptr = dst-2;
+                    /* dst[-1] already holds the correct value */
+                    count = 2;        /* 2 means three bytes encoded */
+                    code = Stuff_Same;
+                }
+                /* else, another different byte, so add it to the block */
+                else
+                {
+                    *dst++ = *src ^ Stuff_Magic;
+                    count++;
+                }
+                src++;    /* Consume the byte */
+                break;
+        }
+        if (count == Stuff_MaxCount)
+        {
+            StuffData_FinishBlock(code + count);
+        }
+    }
+    if (code == Stuff_NoCode)
+    {
+        *code_ptr_ptr = NULL;
+    }
+    else
+    {
+        *code_ptr_ptr = code_ptr;
+        StuffData_FinishBlock(code + count);
+    }
+    return(dst);
+}
+
+/*
+ * UnStuffData decodes the data at "src", up to (but not including) "end".
+ * It writes the decoded data into the buffer pointed to by "dst", up to a
+ * maximum of "dst_length", and returns the new value of "src" so that a
+ * follow-on call can read more data, continuing from where the first left off.
+ * 
+ * There are three types of results:
+ * 1. The source data runs out before extracting "dst_length" bytes:
+ *    UnStuffData returns NULL to indicate failure.
+ * 2. The source data produces exactly "dst_length" bytes:
+ *    UnStuffData returns new_src = end to indicate that all bytes were consumed.
+ * 3. "dst_length" bytes are extracted, with more remaining.
+ *    UnStuffData returns new_src < end to indicate that there are more bytes
+ *    to be read.
+ * 
+ * Note: The decoding may be destructive, in that it may alter the source
+ * data in the process of decoding it (this is necessary to allow a follow-on
+ * call to resume correctly).
+ */
+
+static __u8 *UnStuffData(__u8 *src, __u8 *end, __u8 *dst, __u32 dst_length)
+{
+    __u8 *dst_end = dst + dst_length;
+    /* Sanity check */
+    if (!src || !end || !dst || !dst_length)
+        return(NULL);
+    while (src < end && dst < dst_end)
+    {
+        int count = (*src ^ Stuff_Magic) & Stuff_CountMask;
+        switch ((*src ^ Stuff_Magic) & Stuff_CodeMask)
+        {
+            case Stuff_Diff:
+                if (src+1+count >= end)
+                    return(NULL);
+                do
+                {
+                    *dst++ = *++src ^ Stuff_Magic;
+                }
+                while(--count >= 0 && dst < dst_end);
+                if (count < 0)
+                    src += 1;
+                else
+                {
+                    if (count == 0)
+                        *src = Stuff_Same ^ Stuff_Magic;
+                    else
+                        *src = (Stuff_Diff + count) ^ Stuff_Magic;
+                }
+                break;
+            case Stuff_DiffZero:
+                if (src+1+count >= end)
+                    return(NULL);
+                do
+                {
+                    *dst++ = *++src ^ Stuff_Magic;
+                }
+                while(--count >= 0 && dst < dst_end);
+                if (count < 0)
+                    *src = Stuff_Zero ^ Stuff_Magic;
+                else
+                    *src = (Stuff_DiffZero + count) ^ Stuff_Magic;
+                break;
+            case Stuff_Same:
+                if (src+1 >= end)
+                    return(NULL);
+                do
+                {
+                    *dst++ = src[1] ^ Stuff_Magic;
+                }
+                while(--count >= 0 && dst < dst_end);
+                if (count < 0)
+                    src += 2;
+                else
+                    *src = (Stuff_Same + count) ^ Stuff_Magic;
+                break;
+            case Stuff_Zero:
+                do
+                {
+                    *dst++ = 0;
+                }
+                while(--count >= 0 && dst < dst_end);
+                if (count < 0)
+                    src += 1;
+                else
+                    *src = (Stuff_Zero + count) ^ Stuff_Magic;
+                break;
+        }
+    }
+    if (dst < dst_end)
+        return(NULL);
+    else
+        return(src);
+}
+
+
+/************************************************************************/
+/* General routines for STRIP						*/
+
+/*
+ * get_baud returns the current baud rate, as one of the constants defined in
+ * termbits.h
+ * If the user has issued a baud rate override using the 'setserial' command
+ * and the logical current rate is set to 38.4, then the true baud rate
+ * currently in effect (57.6 or 115.2) is returned.
+ */
+static unsigned int get_baud(struct tty_struct *tty)
+    {
+    if (!tty || !tty->termios) return(0);
+    if ((tty->termios->c_cflag & CBAUD) == B38400 && tty->driver_data)
+        {
+        struct async_struct *info = (struct async_struct *)tty->driver_data;
+        if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI ) return(B57600);
+        if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) return(B115200);
+        }
+    return(tty->termios->c_cflag & CBAUD);
+    }
+
+/*
+ * set_baud sets the baud rate to the rate defined by baudcode
+ * Note: The rate B38400 should be avoided, because the user may have
+ * issued a 'setserial' speed override to map that to a different speed.
+ * We could achieve a true rate of 38400 if we needed to by cancelling
+ * any user speed override that is in place, but that might annoy the
+ * user, so it is simplest to just avoid using 38400.
+ */
+static void set_baud(struct tty_struct *tty, unsigned int baudcode)
+    {
+    struct termios old_termios = *(tty->termios);
+    tty->termios->c_cflag &= ~CBAUD; /* Clear the old baud setting */
+    tty->termios->c_cflag |= baudcode; /* Set the new baud setting */
+    tty->driver.set_termios(tty, &old_termios);
+    }
+
+/*
+ * Convert a string to a Metricom Address.
+ */
+
+#define IS_RADIO_ADDRESS(p) (                                                 \
+  isdigit((p)[0]) && isdigit((p)[1]) && isdigit((p)[2]) && isdigit((p)[3]) && \
+  (p)[4] == '-' &&                                                            \
+  isdigit((p)[5]) && isdigit((p)[6]) && isdigit((p)[7]) && isdigit((p)[8])    )
+
+static int string_to_radio_address(MetricomAddress *addr, __u8 *p)
+{
+    if (!IS_RADIO_ADDRESS(p)) return(1);
+    addr->c[0] = 0;
+    addr->c[1] = 0;
+    addr->c[2] = READHEX(p[0]) << 4 | READHEX(p[1]);
+    addr->c[3] = READHEX(p[2]) << 4 | READHEX(p[3]);
+    addr->c[4] = READHEX(p[5]) << 4 | READHEX(p[6]);
+    addr->c[5] = READHEX(p[7]) << 4 | READHEX(p[8]);
+    return(0);
+}
+
+/*
+ * Convert a Metricom Address to a string.
+ */
+
+static __u8 *radio_address_to_string(const MetricomAddress *addr, MetricomAddressString *p)
+{
+    sprintf(p->c, "%02X%02X-%02X%02X", addr->c[2], addr->c[3], addr->c[4], addr->c[5]);
+    return(p->c);
+}
+
+/*
+ * Note: Must make sure sx_size is big enough to receive a stuffed
+ * MAX_RECV_MTU packet. Additionally, we also want to ensure that it's
+ * big enough to receive a large radio neighbour list (currently 4K).
+ */
+
+static int allocate_buffers(struct strip *strip_info)
+{
+    struct net_device *dev = &strip_info->dev;
+    int sx_size    = MAX(STRIP_ENCAP_SIZE(MAX_RECV_MTU), 4096);
+    int tx_size    = STRIP_ENCAP_SIZE(dev->mtu) + MaxCommandStringLength;
+    __u8 *r = kmalloc(MAX_RECV_MTU, GFP_ATOMIC);
+    __u8 *s = kmalloc(sx_size,      GFP_ATOMIC);
+    __u8 *t = kmalloc(tx_size,      GFP_ATOMIC);
+    if (r && s && t)
+    {
+        strip_info->rx_buff = r;
+        strip_info->sx_buff = s;
+        strip_info->tx_buff = t;
+        strip_info->sx_size = sx_size;
+        strip_info->tx_size = tx_size;
+        strip_info->mtu     = dev->mtu;
+        return(1);
+    }
+    if (r) kfree(r);
+    if (s) kfree(s);
+    if (t) kfree(t);
+    return(0);
+}
+
+/*
+ * MTU has been changed by the IP layer. Unfortunately we are not told
+ * about this, but we spot it ourselves and fix things up. We could be in
+ * an upcall from the tty driver, or in an ip packet queue.
+ */
+
+static void strip_changedmtu(struct strip *strip_info)
+{
+    int old_mtu           = strip_info->mtu;
+    struct net_device *dev    = &strip_info->dev;
+    unsigned char *orbuff = strip_info->rx_buff;
+    unsigned char *osbuff = strip_info->sx_buff;
+    unsigned char *otbuff = strip_info->tx_buff;
+    InterruptStatus intstat;
+
+    if (dev->mtu > MAX_SEND_MTU)
+    {
+        printk(KERN_ERR "%s: MTU exceeds maximum allowable (%d), MTU change cancelled.\n",
+            strip_info->dev.name, MAX_SEND_MTU);
+        dev->mtu = old_mtu;
+        return;
+    }
+
+    /*
+     * Have to disable interrupts here because we're reallocating and resizing
+     * the serial buffers, and we can't have data arriving in them while we're
+     * moving them around in memory. This may cause data to be lost on the serial
+     * port, but hopefully people won't change MTU that often.
+     * Also note, this may not work on a symmetric multi-processor system.
+     */
+    intstat = DisableInterrupts();
+
+    if (!allocate_buffers(strip_info))
+    {
+        RestoreInterrupts(intstat);
+        printk(KERN_ERR "%s: unable to grow strip buffers, MTU change cancelled.\n",
+            strip_info->dev.name);
+        dev->mtu = old_mtu;
+        return;
+    }
+
+    if (strip_info->sx_count)
+    {
+        if (strip_info->sx_count <= strip_info->sx_size)
+            memcpy(strip_info->sx_buff, osbuff, strip_info->sx_count);
+        else
+        {
+            strip_info->discard = strip_info->sx_count;
+            strip_info->rx_over_errors++;
+        }
+    }
+
+    if (strip_info->tx_left)
+    {
+        if (strip_info->tx_left <= strip_info->tx_size)
+            memcpy(strip_info->tx_buff, strip_info->tx_head, strip_info->tx_left);
+        else
+        {
+            strip_info->tx_left = 0;
+            strip_info->tx_dropped++;
+        }
+    }
+    strip_info->tx_head = strip_info->tx_buff;
+
+    RestoreInterrupts(intstat);
+
+    printk(KERN_NOTICE "%s: strip MTU changed fom %d to %d.\n",
+        strip_info->dev.name, old_mtu, strip_info->mtu);
+
+    if (orbuff) kfree(orbuff);
+    if (osbuff) kfree(osbuff);
+    if (otbuff) kfree(otbuff);
+}
+
+static void strip_unlock(struct strip *strip_info)
+{
+    /*
+     * Set the timer to go off in one second.
+     */
+    strip_info->idle_timer.expires = jiffies + 1*HZ;
+    add_timer(&strip_info->idle_timer);
+    netif_wake_queue(&strip_info->dev);
+}
+
+
+/************************************************************************/
+/* Callback routines for exporting information through /proc		*/
+
+/*
+ * This function updates the total amount of data printed so far. It then
+ * determines if the amount of data printed into a buffer  has reached the
+ * offset requested. If it hasn't, then the buffer is shifted over so that
+ * the next bit of data can be printed over the old bit. If the total
+ * amount printed so far exceeds the total amount requested, then this
+ * function returns 1, otherwise 0.
+ */
+static int 
+shift_buffer(char *buffer, int requested_offset, int requested_len,
+             int *total, int *slop, char **buf)
+{
+    int printed;
+
+    /* printk(KERN_DEBUG "shift: buffer: %d o: %d l: %d t: %d buf: %d\n",
+           (int) buffer, requested_offset, requested_len, *total,
+           (int) *buf); */
+    printed = *buf - buffer;
+    if (*total + printed <= requested_offset) {
+        *total += printed;
+        *buf = buffer;
+    }
+    else {
+        if (*total < requested_offset) {
+            *slop = requested_offset - *total;
+        }
+        *total = requested_offset + printed - *slop;
+    }
+    if (*total > requested_offset + requested_len) {
+        return 1;
+    }
+    else {
+        return 0;
+    }
+}
+
+/*
+ * This function calculates the actual start of the requested data
+ * in the buffer. It also calculates actual length of data returned,
+ * which could be less that the amount of data requested.
+ */
+static int
+calc_start_len(char *buffer, char **start, int requested_offset,
+               int requested_len, int total, char *buf)
+{
+    int return_len, buffer_len;
+
+    buffer_len = buf - buffer;
+    if (buffer_len >= 4095) {
+ 	printk(KERN_ERR "STRIP: exceeded /proc buffer size\n");
+    }
+
+    /*
+     * There may be bytes before and after the
+     * chunk that was actually requested.
+     */
+    return_len = total - requested_offset;
+    if (return_len < 0) {
+        return_len = 0;
+    }
+    *start = buf - return_len;
+    if (return_len > requested_len) {
+        return_len = requested_len;
+    }
+    /* printk(KERN_DEBUG "return_len: %d\n", return_len); */
+    return return_len;
+}
+
+/*
+ * If the time is in the near future, time_delta prints the number of
+ * seconds to go into the buffer and returns the address of the buffer.
+ * If the time is not in the near future, it returns the address of the
+ * string "Not scheduled" The buffer must be long enough to contain the
+ * ascii representation of the number plus 9 charactes for the " seconds"
+ * and the null character.
+ */
+static char *time_delta(char buffer[], long time)
+{
+    time -= jiffies;
+    if (time > LongTime / 2) return("Not scheduled");
+    if(time < 0) time = 0;  /* Don't print negative times */
+    sprintf(buffer, "%ld seconds", time / HZ);
+    return(buffer);
+}
+
+static int sprintf_neighbours(char *buffer, MetricomNodeTable *table, char *title)
+{
+    /* We wrap this in a do/while loop, so if the table changes */
+    /* while we're reading it, we just go around and try again. */
+    struct timeval t;
+    char *ptr;
+    do
+        {
+        int i;
+        t = table->timestamp;
+        ptr = buffer;
+        if (table->num_nodes) ptr += sprintf(ptr, "\n %s\n", title);
+        for (i=0; i<table->num_nodes; i++)
+            {
+            InterruptStatus intstat = DisableInterrupts();
+            MetricomNode node = table->node[i];
+            RestoreInterrupts(intstat);
+            ptr += sprintf(ptr, "  %s\n", node.c);
+            }
+        } while (table->timestamp.tv_sec != t.tv_sec || table->timestamp.tv_usec != t.tv_usec);
+    return ptr - buffer;
+}
+
+/*
+ * This function prints radio status information into the specified buffer.
+ * I think the buffer size is 4K, so this routine should never print more
+ * than 4K of data into it. With the maximum of 32 portables and 32 poletops
+ * reported, the routine outputs 3107 bytes into the buffer.
+ */
+static int
+sprintf_status_info(char *buffer, struct strip *strip_info)
+{
+    char temp[32];
+    char *p = buffer;
+    MetricomAddressString addr_string;
+
+    /* First, we must copy all of our data to a safe place, */
+    /* in case a serial interrupt comes in and changes it.  */
+    InterruptStatus intstat = DisableInterrupts();
+    int                tx_left             = strip_info->tx_left;
+    unsigned long      rx_average_pps      = strip_info->rx_average_pps;
+    unsigned long      tx_average_pps      = strip_info->tx_average_pps;
+    unsigned long      sx_average_pps      = strip_info->sx_average_pps;
+    int                working             = strip_info->working;
+    int                firmware_level      = strip_info->firmware_level;
+    long               watchdog_doprobe    = strip_info->watchdog_doprobe;
+    long               watchdog_doreset    = strip_info->watchdog_doreset;
+    long               gratuitous_arp      = strip_info->gratuitous_arp;
+    long               arp_interval        = strip_info->arp_interval;
+    FirmwareVersion    firmware_version    = strip_info->firmware_version;
+    SerialNumber       serial_number       = strip_info->serial_number;
+    BatteryVoltage     battery_voltage     = strip_info->battery_voltage;
+    char*              if_name             = strip_info->dev.name;
+    MetricomAddress    true_dev_addr       = strip_info->true_dev_addr;
+    MetricomAddress    dev_dev_addr        = *(MetricomAddress*)strip_info->dev.dev_addr;
+    int                manual_dev_addr     = strip_info->manual_dev_addr;
+#ifdef EXT_COUNTERS
+    unsigned long      rx_bytes            = strip_info->rx_bytes;
+    unsigned long      tx_bytes            = strip_info->tx_bytes;
+    unsigned long      rx_rbytes           = strip_info->rx_rbytes;
+    unsigned long      tx_rbytes           = strip_info->tx_rbytes;
+    unsigned long      rx_sbytes           = strip_info->rx_sbytes;
+    unsigned long      tx_sbytes           = strip_info->tx_sbytes;
+    unsigned long      rx_ebytes           = strip_info->rx_ebytes;
+    unsigned long      tx_ebytes           = strip_info->tx_ebytes;
+#endif
+    RestoreInterrupts(intstat);
+
+    p += sprintf(p, "\nInterface name\t\t%s\n", if_name);
+    p += sprintf(p, " Radio working:\t\t%s\n", working ? "Yes" : "No");
+    radio_address_to_string(&true_dev_addr, &addr_string);
+    p += sprintf(p, " Radio address:\t\t%s\n", addr_string.c);
+    if (manual_dev_addr)
+    {
+        radio_address_to_string(&dev_dev_addr, &addr_string);
+        p += sprintf(p, " Device address:\t%s\n", addr_string.c);
+    }
+    p += sprintf(p, " Firmware version:\t%s", !working        ? "Unknown" :
+                                              !firmware_level ? "Should be upgraded" :
+                                              firmware_version.c);
+    if (firmware_level >= ChecksummedMessages) p += sprintf(p, " (Checksums Enabled)");
+    p += sprintf(p, "\n");
+    p += sprintf(p, " Serial number:\t\t%s\n", serial_number.c);
+    p += sprintf(p, " Battery voltage:\t%s\n", battery_voltage.c);
+    p += sprintf(p, " Transmit queue (bytes):%d\n", tx_left);
+    p += sprintf(p, " Receive packet rate:   %ld packets per second\n", rx_average_pps / 8);
+    p += sprintf(p, " Transmit packet rate:  %ld packets per second\n", tx_average_pps / 8);
+    p += sprintf(p, " Sent packet rate:      %ld packets per second\n", sx_average_pps / 8);
+    p += sprintf(p, " Next watchdog probe:\t%s\n", time_delta(temp, watchdog_doprobe));
+    p += sprintf(p, " Next watchdog reset:\t%s\n", time_delta(temp, watchdog_doreset));
+    p += sprintf(p, " Next gratuitous ARP:\t");
+
+    if (!memcmp(strip_info->dev.dev_addr, zero_address.c, sizeof(zero_address)))
+        p += sprintf(p, "Disabled\n");
+    else
+    {
+        p += sprintf(p, "%s\n", time_delta(temp, gratuitous_arp));
+        p += sprintf(p, " Next ARP interval:\t%ld seconds\n", JIFFIE_TO_SEC(arp_interval));
+    }
+
+    if (working)
+        {
+#ifdef EXT_COUNTERS
+          p += sprintf(p, "\n");
+          p += sprintf(p, " Total bytes:         \trx:\t%lu\ttx:\t%lu\n", rx_bytes, tx_bytes);
+          p += sprintf(p, "  thru radio:         \trx:\t%lu\ttx:\t%lu\n", rx_rbytes, tx_rbytes);
+          p += sprintf(p, "  thru serial port:   \trx:\t%lu\ttx:\t%lu\n", rx_sbytes, tx_sbytes);
+          p += sprintf(p, " Total stat/err bytes:\trx:\t%lu\ttx:\t%lu\n", rx_ebytes, tx_ebytes);
+#endif
+        p += sprintf_neighbours(p, &strip_info->poletops, "Poletops:");
+        p += sprintf_neighbours(p, &strip_info->portables, "Portables:");
+        }
+
+    return p - buffer;
+}
+
+/*
+ * This function is exports status information from the STRIP driver through
+ * the /proc file system.
+ */
+
+static int get_status_info(char *buffer, char **start, off_t req_offset, int req_len)
+{
+    int           total = 0, slop = 0;
+    struct strip *strip_info = struct_strip_list;
+    char         *buf = buffer;
+
+    buf += sprintf(buf, "strip_version: %s\n", StripVersion);
+    if (shift_buffer(buffer, req_offset, req_len, &total, &slop, &buf)) goto exit;
+
+    while (strip_info != NULL)
+        {
+        buf += sprintf_status_info(buf, strip_info);
+        if (shift_buffer(buffer, req_offset, req_len, &total, &slop, &buf)) break;
+        strip_info = strip_info->next;
+        }
+    exit:
+    return(calc_start_len(buffer, start, req_offset, req_len, total, buf));
+}
+
+/************************************************************************/
+/* Sending routines							*/
+
+static void ResetRadio(struct strip *strip_info)
+{
+    struct tty_struct *tty = strip_info->tty;
+    static const char init[] = "ate0q1dt**starmode\r**";
+    StringDescriptor s = { init, sizeof(init)-1 };
+
+    /* 
+     * If the radio isn't working anymore,
+     * we should clear the old status information.
+     */
+    if (strip_info->working)
+    {
+        printk(KERN_INFO "%s: No response: Resetting radio.\n", strip_info->dev.name);
+        strip_info->firmware_version.c[0] = '\0';
+        strip_info->serial_number.c[0] = '\0';
+        strip_info->battery_voltage.c[0] = '\0';
+        strip_info->portables.num_nodes = 0;
+        do_gettimeofday(&strip_info->portables.timestamp);
+        strip_info->poletops.num_nodes = 0;
+        do_gettimeofday(&strip_info->poletops.timestamp);
+    }
+
+    strip_info->pps_timer      = jiffies;
+    strip_info->rx_pps_count   = 0;
+    strip_info->tx_pps_count   = 0;
+    strip_info->sx_pps_count   = 0;
+    strip_info->rx_average_pps = 0;
+    strip_info->tx_average_pps = 0;
+    strip_info->sx_average_pps = 0;
+
+    /* Mark radio address as unknown */
+    *(MetricomAddress*)&strip_info->true_dev_addr = zero_address;
+    if (!strip_info->manual_dev_addr)
+        *(MetricomAddress*)strip_info->dev.dev_addr = zero_address;
+    strip_info->working = FALSE;
+    strip_info->firmware_level = NoStructure;
+    strip_info->next_command   = CompatibilityCommand;
+    strip_info->watchdog_doprobe = jiffies + 10 * HZ;
+    strip_info->watchdog_doreset = jiffies + 1 * HZ;
+
+    /* If the user has selected a baud rate above 38.4 see what magic we have to do */
+    if (strip_info->user_baud > B38400)
+        {
+        /*
+         * Subtle stuff: Pay attention :-)
+         * If the serial port is currently at the user's selected (>38.4) rate,
+         * then we temporarily switch to 19.2 and issue the ATS304 command
+         * to tell the radio to switch to the user's selected rate.
+         * If the serial port is not currently at that rate, that means we just
+         * issued the ATS304 command last time through, so this time we restore
+         * the user's selected rate and issue the normal starmode reset string.
+         */
+        if (strip_info->user_baud == get_baud(tty))
+	    {
+	    static const char b0[] = "ate0q1s304=57600\r";
+	    static const char b1[] = "ate0q1s304=115200\r";
+	    static const StringDescriptor baudstring[2] =
+                { { b0, sizeof(b0)-1 }, { b1, sizeof(b1)-1 } };
+	    set_baud(tty, B19200);
+	    if      (strip_info->user_baud == B57600 ) s = baudstring[0];
+	    else if (strip_info->user_baud == B115200) s = baudstring[1];
+	    else s = baudstring[1]; /* For now */
+	    }
+        else set_baud(tty, strip_info->user_baud);
+        }
+
+    tty->driver.write(tty, 0, s.string, s.length);
+#ifdef EXT_COUNTERS
+    strip_info->tx_ebytes += s.length;
+#endif
+}
+
+/*
+ * Called by the driver when there's room for more data.  If we have
+ * more packets to send, we send them here.
+ */
+
+static void strip_write_some_more(struct tty_struct *tty)
+{
+    struct strip *strip_info = (struct strip *) tty->disc_data;
+
+    /* First make sure we're connected. */
+    if (!strip_info || strip_info->magic != STRIP_MAGIC || 
+    	!netif_running(&strip_info->dev))
+        return;
+
+    if (strip_info->tx_left > 0)
+    {
+        /*
+         * If some data left, send it
+         * Note: There's a kernel design bug here. The write_wakeup routine has to
+         * know how many bytes were written in the previous call, but the number of
+         * bytes written is returned as the result of the tty->driver.write call,
+         * and there's no guarantee that the tty->driver.write routine will have
+         * returned before the write_wakeup routine is invoked. If the PC has fast
+         * Serial DMA hardware, then it's quite possible that the write could complete
+         * almost instantaneously, meaning that my write_wakeup routine could be
+         * called immediately, before tty->driver.write has had a chance to return
+         * the number of bytes that it wrote. In an attempt to guard against this,
+         * I disable interrupts around the call to tty->driver.write, although even
+         * this might not work on a symmetric multi-processor system.
+         */
+        InterruptStatus intstat = DisableInterrupts();
+        int num_written = tty->driver.write(tty, 0, strip_info->tx_head, strip_info->tx_left);
+        strip_info->tx_left -= num_written;
+        strip_info->tx_head += num_written;
+#ifdef EXT_COUNTERS
+        strip_info->tx_sbytes += num_written;
+#endif
+        RestoreInterrupts(intstat);
+    }
+    else            /* Else start transmission of another packet */
+    {
+        tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
+        strip_unlock(strip_info);
+    }
+}
+
+static __u8 *add_checksum(__u8 *buffer, __u8 *end)
+{
+    __u16 sum = 0;
+    __u8 *p = buffer;
+    while (p < end) sum += *p++;
+    end[3] = hextable[sum & 0xF]; sum >>= 4;
+    end[2] = hextable[sum & 0xF]; sum >>= 4;
+    end[1] = hextable[sum & 0xF]; sum >>= 4;
+    end[0] = hextable[sum & 0xF];
+    return(end+4);
+}
+
+static unsigned char *strip_make_packet(unsigned char *buffer, struct strip *strip_info, struct sk_buff *skb)
+{
+    __u8           *ptr = buffer;
+    __u8           *stuffstate = NULL;
+    STRIP_Header   *header     = (STRIP_Header *)skb->data;
+    MetricomAddress haddr      = header->dst_addr;
+    int             len        = skb->len - sizeof(STRIP_Header);
+    MetricomKey     key;
+
+    /*HexDump("strip_make_packet", strip_info, skb->data, skb->data + skb->len);*/
+
+    if      (header->protocol == htons(ETH_P_IP))  key = SIP0Key;
+    else if (header->protocol == htons(ETH_P_ARP)) key = ARP0Key;
+    else
+    {
+        printk(KERN_ERR "%s: strip_make_packet: Unknown packet type 0x%04X\n",
+            strip_info->dev.name, ntohs(header->protocol));
+        return(NULL);
+    }
+
+    if (len > strip_info->mtu)
+    {
+        printk(KERN_ERR "%s: Dropping oversized transmit packet: %d bytes\n",
+            strip_info->dev.name, len);
+        return(NULL);
+    }
+
+    /*
+     * If we're sending to ourselves, discard the packet.
+     * (Metricom radios choke if they try to send a packet to their own address.)
+     */
+    if (!memcmp(haddr.c, strip_info->true_dev_addr.c, sizeof(haddr)))
+    {
+        printk(KERN_ERR "%s: Dropping packet addressed to self\n", strip_info->dev.name);
+        return(NULL);
+    }
+
+    /*
+     * If this is a broadcast packet, send it to our designated Metricom
+     * 'broadcast hub' radio (First byte of address being 0xFF means broadcast)
+     */
+    if (haddr.c[0] == 0xFF)
+    {
+	u32 brd = 0;
+ 	struct in_device *in_dev = in_dev_get(&strip_info->dev);
+	if (in_dev == NULL)
+		return NULL;
+	read_lock(&in_dev->lock);
+	if (in_dev->ifa_list)
+		brd = in_dev->ifa_list->ifa_broadcast;
+	read_unlock(&in_dev->lock);
+	in_dev_put(in_dev);
+
+	/* arp_query returns 1 if it succeeds in looking up the address, 0 if it fails */
+        if (!arp_query(haddr.c, brd, &strip_info->dev))
+        {
+            printk(KERN_ERR "%s: Unable to send packet (no broadcast hub configured)\n",
+                strip_info->dev.name);
+            return(NULL);
+        }
+	/*
+	 * If we are the broadcast hub, don't bother sending to ourselves.
+	 * (Metricom radios choke if they try to send a packet to their own address.)
+	 */
+        if (!memcmp(haddr.c, strip_info->true_dev_addr.c, sizeof(haddr))) return(NULL);
+    }
+
+    *ptr++ = 0x0D;
+    *ptr++ = '*';
+    *ptr++ = hextable[haddr.c[2] >> 4];
+    *ptr++ = hextable[haddr.c[2] & 0xF];
+    *ptr++ = hextable[haddr.c[3] >> 4];
+    *ptr++ = hextable[haddr.c[3] & 0xF];
+    *ptr++ = '-';
+    *ptr++ = hextable[haddr.c[4] >> 4];
+    *ptr++ = hextable[haddr.c[4] & 0xF];
+    *ptr++ = hextable[haddr.c[5] >> 4];
+    *ptr++ = hextable[haddr.c[5] & 0xF];
+    *ptr++ = '*';
+    *ptr++ = key.c[0];
+    *ptr++ = key.c[1];
+    *ptr++ = key.c[2];
+    *ptr++ = key.c[3];
+
+    ptr = StuffData(skb->data + sizeof(STRIP_Header), len, ptr, &stuffstate);
+
+    if (strip_info->firmware_level >= ChecksummedMessages) ptr = add_checksum(buffer+1, ptr);
+
+    *ptr++ = 0x0D;
+    return(ptr);
+}
+
+static void strip_send(struct strip *strip_info, struct sk_buff *skb)
+{
+    MetricomAddress haddr;
+    unsigned char *ptr = strip_info->tx_buff;
+    int doreset = (long)jiffies - strip_info->watchdog_doreset >= 0;
+    int doprobe = (long)jiffies - strip_info->watchdog_doprobe >= 0 && !doreset;
+    u32 addr, brd;
+
+    /*
+     * 1. If we have a packet, encapsulate it and put it in the buffer
+     */
+    if (skb)
+    {
+        char *newptr = strip_make_packet(ptr, strip_info, skb);
+        strip_info->tx_pps_count++;
+        if (!newptr) strip_info->tx_dropped++;
+        else
+        {
+            ptr = newptr;
+            strip_info->sx_pps_count++;
+            strip_info->tx_packets++;        /* Count another successful packet */
+#ifdef EXT_COUNTERS
+            strip_info->tx_bytes += skb->len;
+            strip_info->tx_rbytes += ptr - strip_info->tx_buff;
+#endif
+            /*DumpData("Sending:", strip_info, strip_info->tx_buff, ptr);*/
+            /*HexDump("Sending", strip_info, strip_info->tx_buff, ptr);*/
+        }
+    }
+
+    /*
+     * 2. If it is time for another tickle, tack it on, after the packet
+     */
+    if (doprobe)
+    {
+        StringDescriptor ts = CommandString[strip_info->next_command];
+#if TICKLE_TIMERS
+        {
+        struct timeval tv;
+        do_gettimeofday(&tv);
+        printk(KERN_INFO "**** Sending tickle string %d      at %02d.%06d\n",
+            strip_info->next_command, tv.tv_sec % 100, tv.tv_usec);
+        }
+#endif
+        if (ptr == strip_info->tx_buff) *ptr++ = 0x0D;
+
+        *ptr++ = '*'; /* First send "**" to provoke an error message */
+        *ptr++ = '*';
+
+        /* Then add the command */
+        memcpy(ptr, ts.string, ts.length);
+
+        /* Add a checksum ? */
+        if (strip_info->firmware_level < ChecksummedMessages) ptr += ts.length;
+        else ptr = add_checksum(ptr, ptr + ts.length);
+
+        *ptr++ = 0x0D; /* Terminate the command with a <CR> */
+
+        /* Cycle to next periodic command? */
+        if (strip_info->firmware_level >= StructuredMessages)
+                if (++strip_info->next_command >= ELEMENTS_OF(CommandString))
+                        strip_info->next_command = 0;
+#ifdef EXT_COUNTERS
+        strip_info->tx_ebytes += ts.length;
+#endif
+        strip_info->watchdog_doprobe = jiffies + 10 * HZ;
+        strip_info->watchdog_doreset = jiffies + 1 * HZ;
+        /*printk(KERN_INFO "%s: Routine radio test.\n", strip_info->dev.name);*/
+    }
+
+    /*
+     * 3. Set up the strip_info ready to send the data (if any).
+     */
+    strip_info->tx_head = strip_info->tx_buff;
+    strip_info->tx_left = ptr - strip_info->tx_buff;
+    strip_info->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP);
+
+    /*
+     * 4. Debugging check to make sure we're not overflowing the buffer.
+     */
+    if (strip_info->tx_size - strip_info->tx_left < 20)
+        printk(KERN_ERR "%s: Sending%5d bytes;%5d bytes free.\n", strip_info->dev.name,
+            strip_info->tx_left, strip_info->tx_size - strip_info->tx_left);
+
+    /*
+     * 5. If watchdog has expired, reset the radio. Note: if there's data waiting in
+     * the buffer, strip_write_some_more will send it after the reset has finished
+     */
+    if (doreset) { ResetRadio(strip_info); return; }
+
+    if (1) {
+	    struct in_device *in_dev = in_dev_get(&strip_info->dev);
+	    brd = addr = 0;
+	    if (in_dev) {
+		    read_lock(&in_dev->lock);
+		    if (in_dev->ifa_list) {
+			    brd = in_dev->ifa_list->ifa_broadcast;
+			    addr = in_dev->ifa_list->ifa_local;
+		    }
+		    read_unlock(&in_dev->lock);
+		    in_dev_put(in_dev);
+	    }
+    }
+    
+
+    /*
+     * 6. If it is time for a periodic ARP, queue one up to be sent.
+     * We only do this if:
+     *  1. The radio is working
+     *  2. It's time to send another periodic ARP
+     *  3. We really know what our address is (and it is not manually set to zero)
+     *  4. We have a designated broadcast address configured
+     * If we queue up an ARP packet when we don't have a designated broadcast
+     * address configured, then the packet will just have to be discarded in
+     * strip_make_packet. This is not fatal, but it causes misleading information
+     * to be displayed in tcpdump. tcpdump will report that periodic APRs are
+     * being sent, when in fact they are not, because they are all being dropped
+     * in the strip_make_packet routine.
+     */
+    if (strip_info->working && (long)jiffies - strip_info->gratuitous_arp >= 0 &&
+        memcmp(strip_info->dev.dev_addr, zero_address.c, sizeof(zero_address)) &&
+        arp_query(haddr.c, brd, &strip_info->dev))
+    {
+        /*printk(KERN_INFO "%s: Sending gratuitous ARP with interval %ld\n",
+            strip_info->dev.name, strip_info->arp_interval / HZ);*/
+        strip_info->gratuitous_arp = jiffies + strip_info->arp_interval;
+        strip_info->arp_interval *= 2;
+        if (strip_info->arp_interval > MaxARPInterval)
+            strip_info->arp_interval = MaxARPInterval;
+	if (addr)
+	    arp_send(
+		ARPOP_REPLY, ETH_P_ARP,
+		addr, /* Target address of ARP packet is our address */
+		&strip_info->dev,	       /* Device to send packet on */
+		addr, /* Source IP address this ARP packet comes from */
+		NULL,			       /* Destination HW address is NULL (broadcast it) */
+		strip_info->dev.dev_addr,      /* Source HW address is our HW address */
+		strip_info->dev.dev_addr);     /* Target HW address is our HW address (redundant) */
+    }
+
+    /*
+     * 7. All ready. Start the transmission
+     */
+    strip_write_some_more(strip_info->tty);
+}
+
+/* Encapsulate a datagram and kick it into a TTY queue. */
+static int strip_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+    struct strip *strip_info = (struct strip *)(dev->priv);
+
+    if (!netif_running(dev))
+    {
+        printk(KERN_ERR "%s: xmit call when iface is down\n", dev->name);
+        return(1);
+    }
+
+    netif_stop_queue(dev);
+    
+    del_timer(&strip_info->idle_timer);
+
+    /* See if someone has been ifconfigging */
+    if (strip_info->mtu != strip_info->dev.mtu)
+        strip_changedmtu(strip_info);
+
+    if (jiffies - strip_info->pps_timer > HZ)
+    {
+        unsigned long t = jiffies - strip_info->pps_timer;
+        unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t/2) / t;
+        unsigned long tx_pps_count = (strip_info->tx_pps_count * HZ * 8 + t/2) / t;
+        unsigned long sx_pps_count = (strip_info->sx_pps_count * HZ * 8 + t/2) / t;
+
+        strip_info->pps_timer = jiffies;
+        strip_info->rx_pps_count = 0;
+        strip_info->tx_pps_count = 0;
+        strip_info->sx_pps_count = 0;
+
+        strip_info->rx_average_pps = (strip_info->rx_average_pps + rx_pps_count + 1) / 2;
+        strip_info->tx_average_pps = (strip_info->tx_average_pps + tx_pps_count + 1) / 2;
+        strip_info->sx_average_pps = (strip_info->sx_average_pps + sx_pps_count + 1) / 2;
+
+        if (rx_pps_count / 8 >= 10)
+            printk(KERN_INFO "%s: WARNING: Receiving %ld packets per second.\n",
+                strip_info->dev.name, rx_pps_count / 8);
+        if (tx_pps_count / 8 >= 10)
+            printk(KERN_INFO "%s: WARNING: Tx        %ld packets per second.\n",
+                strip_info->dev.name, tx_pps_count / 8);
+        if (sx_pps_count / 8 >= 10)
+            printk(KERN_INFO "%s: WARNING: Sending   %ld packets per second.\n",
+                strip_info->dev.name, sx_pps_count / 8);
+    }
+
+    strip_send(strip_info, skb);
+
+    if (skb)
+    	dev_kfree_skb(skb);
+    return(0);
+}
+
+/*
+ * IdleTask periodically calls strip_xmit, so even when we have no IP packets
+ * to send for an extended period of time, the watchdog processing still gets
+ * done to ensure that the radio stays in Starmode
+ */
+
+static void strip_IdleTask(unsigned long parameter)
+{
+    strip_xmit(NULL, (struct net_device *)parameter);
+}
+
+/*
+ * Create the MAC header for an arbitrary protocol layer
+ *
+ * saddr!=NULL        means use this specific address (n/a for Metricom)
+ * saddr==NULL        means use default device source address
+ * daddr!=NULL        means use this destination address
+ * daddr==NULL        means leave destination address alone
+ *                 (e.g. unresolved arp -- kernel will call
+ *                 rebuild_header later to fill in the address)
+ */
+
+static int strip_header(struct sk_buff *skb, struct net_device *dev,
+        unsigned short type, void *daddr, void *saddr, unsigned len)
+{
+    struct strip *strip_info = (struct strip *)(dev->priv);
+    STRIP_Header *header = (STRIP_Header *)skb_push(skb, sizeof(STRIP_Header));
+
+    /*printk(KERN_INFO "%s: strip_header 0x%04X %s\n", dev->name, type,
+        type == ETH_P_IP ? "IP" : type == ETH_P_ARP ? "ARP" : "");*/
+
+    header->src_addr = strip_info->true_dev_addr;
+    header->protocol = htons(type);
+
+    /*HexDump("strip_header", (struct strip *)(dev->priv), skb->data, skb->data + skb->len);*/
+
+    if (!daddr) return(-dev->hard_header_len);
+
+    header->dst_addr = *(MetricomAddress*)daddr;
+    return(dev->hard_header_len);
+}
+
+/*
+ * Rebuild the MAC header. This is called after an ARP
+ * (or in future other address resolution) has completed on this
+ * sk_buff. We now let ARP fill in the other fields.
+ * I think this should return zero if packet is ready to send,
+ * or non-zero if it needs more time to do an address lookup
+ */
+
+static int strip_rebuild_header(struct sk_buff *skb)
+{
+#ifdef CONFIG_INET
+    STRIP_Header *header = (STRIP_Header *) skb->data;
+
+    /* Arp find returns zero if if knows the address, */
+    /* or if it doesn't know the address it sends an ARP packet and returns non-zero */
+    return arp_find(header->dst_addr.c, skb)? 1 : 0;
+#else
+    return 0;
+#endif
+}
+
+
+/************************************************************************/
+/* Receiving routines							*/
+
+static int strip_receive_room(struct tty_struct *tty)
+{
+    return 0x10000;  /* We can handle an infinite amount of data. :-) */
+}
+
+/*
+ * This function parses the response to the ATS300? command,
+ * extracting the radio version and serial number.
+ */
+static void get_radio_version(struct strip *strip_info, __u8 *ptr, __u8 *end)
+{
+    __u8 *p, *value_begin, *value_end;
+    int len;
+    
+    /* Determine the beginning of the second line of the payload */
+    p = ptr;
+    while (p < end && *p != 10) p++;
+    if (p >= end) return;
+    p++;
+    value_begin = p;
+    
+    /* Determine the end of line */
+    while (p < end && *p != 10) p++;
+    if (p >= end) return;
+    value_end = p;
+    p++;
+     
+    len = value_end - value_begin;
+    len = MIN(len, sizeof(FirmwareVersion) - 1);
+    if (strip_info->firmware_version.c[0] == 0)
+        printk(KERN_INFO "%s: Radio Firmware: %.*s\n",
+            strip_info->dev.name, len, value_begin);
+    sprintf(strip_info->firmware_version.c, "%.*s", len, value_begin);
+    
+    /* Look for the first colon */
+    while (p < end && *p != ':') p++;
+    if (p >= end) return;
+    /* Skip over the space */
+    p += 2;
+    len = sizeof(SerialNumber) - 1;
+    if (p + len <= end) {
+        sprintf(strip_info->serial_number.c, "%.*s", len, p);
+    }
+    else {
+     	printk(KERN_DEBUG "STRIP: radio serial number shorter (%d) than expected (%d)\n",
+     	       end - p, len);
+    }
+}
+
+/*
+ * This function parses the response to the ATS325? command,
+ * extracting the radio battery voltage.
+ */
+static void get_radio_voltage(struct strip *strip_info, __u8 *ptr, __u8 *end)
+{
+    int len;
+
+    len = sizeof(BatteryVoltage) - 1;
+    if (ptr + len <= end) {
+        sprintf(strip_info->battery_voltage.c, "%.*s", len, ptr);
+    }
+    else {
+ 	printk(KERN_DEBUG "STRIP: radio voltage string shorter (%d) than expected (%d)\n",
+ 	       end - ptr, len);
+    }
+}
+
+/*
+ * This function parses the responses to the AT~LA and ATS311 commands,
+ * which list the radio's neighbours.
+ */
+static void get_radio_neighbours(MetricomNodeTable *table, __u8 *ptr, __u8 *end)
+{
+    table->num_nodes = 0;
+    while (ptr < end && table->num_nodes < NODE_TABLE_SIZE)
+        {
+        MetricomNode *node = &table->node[table->num_nodes++];
+        char *dst = node->c, *limit = dst + sizeof(*node) - 1;
+        while (ptr < end && *ptr <= 32) ptr++;
+        while (ptr < end && dst < limit && *ptr != 10) *dst++ = *ptr++;
+        *dst++ = 0;
+        while (ptr < end && ptr[-1] != 10) ptr++;
+        }
+    do_gettimeofday(&table->timestamp);
+}
+
+static int get_radio_address(struct strip *strip_info, __u8 *p)
+{
+    MetricomAddress addr;
+
+    if (string_to_radio_address(&addr, p)) return(1);
+
+    /* See if our radio address has changed */
+    if (memcmp(strip_info->true_dev_addr.c, addr.c, sizeof(addr)))
+    {
+        MetricomAddressString addr_string;
+        radio_address_to_string(&addr, &addr_string);
+        printk(KERN_INFO "%s: Radio address = %s\n", strip_info->dev.name, addr_string.c);
+        strip_info->true_dev_addr = addr;
+        if (!strip_info->manual_dev_addr) *(MetricomAddress*)strip_info->dev.dev_addr = addr;
+        /* Give the radio a few seconds to get its head straight, then send an arp */
+        strip_info->gratuitous_arp = jiffies + 15 * HZ;
+        strip_info->arp_interval = 1 * HZ;
+    }
+    return(0);
+}
+
+static int verify_checksum(struct strip *strip_info)
+{
+    __u8 *p = strip_info->sx_buff;
+    __u8 *end = strip_info->sx_buff + strip_info->sx_count - 4;
+    u_short sum = (READHEX16(end[0]) << 12) | (READHEX16(end[1]) << 8) |
+                  (READHEX16(end[2]) <<  4) | (READHEX16(end[3]));
+    while (p < end) sum -= *p++;
+    if (sum == 0 && strip_info->firmware_level == StructuredMessages)
+    {
+        strip_info->firmware_level = ChecksummedMessages;
+        printk(KERN_INFO "%s: Radio provides message checksums\n", strip_info->dev.name);
+    }
+    return(sum == 0);
+}
+
+static void RecvErr(char *msg, struct strip *strip_info)
+{
+    __u8 *ptr = strip_info->sx_buff;
+    __u8 *end = strip_info->sx_buff + strip_info->sx_count;
+    DumpData(msg, strip_info, ptr, end);
+    strip_info->rx_errors++;
+}
+
+static void RecvErr_Message(struct strip *strip_info, __u8 *sendername, const __u8 *msg, u_long len)
+{
+    if (has_prefix(msg, len, "001")) /* Not in StarMode! */
+    {
+        RecvErr("Error Msg:", strip_info);
+        printk(KERN_INFO "%s: Radio %s is not in StarMode\n",
+            strip_info->dev.name, sendername);
+    }
+
+    else if (has_prefix(msg, len, "002")) /* Remap handle */
+    {
+	/* We ignore "Remap handle" messages for now */
+    }
+
+    else if (has_prefix(msg, len, "003")) /* Can't resolve name */
+    {
+        RecvErr("Error Msg:", strip_info);
+        printk(KERN_INFO "%s: Destination radio name is unknown\n",
+            strip_info->dev.name);
+    }
+
+    else if (has_prefix(msg, len, "004")) /* Name too small or missing */
+    {
+        strip_info->watchdog_doreset = jiffies + LongTime;
+#if TICKLE_TIMERS
+        {
+        struct timeval tv;
+        do_gettimeofday(&tv);
+        printk(KERN_INFO "**** Got ERR_004 response         at %02d.%06d\n",
+            tv.tv_sec % 100, tv.tv_usec);
+        }
+#endif
+        if (!strip_info->working)
+        {
+            strip_info->working = TRUE;
+            printk(KERN_INFO "%s: Radio now in starmode\n", strip_info->dev.name);
+            /*
+             * If the radio has just entered a working state, we should do our first
+             * probe ASAP, so that we find out our radio address etc. without delay.
+             */
+            strip_info->watchdog_doprobe = jiffies;
+        }
+        if (strip_info->firmware_level == NoStructure && sendername)
+        {
+            strip_info->firmware_level = StructuredMessages;
+            strip_info->next_command   = 0; /* Try to enable checksums ASAP */
+            printk(KERN_INFO "%s: Radio provides structured messages\n", strip_info->dev.name);
+        }
+        if (strip_info->firmware_level >= StructuredMessages)
+        {
+            /*
+             * If this message has a valid checksum on the end, then the call to verify_checksum
+             * will elevate the firmware_level to ChecksummedMessages for us. (The actual return
+             * code from verify_checksum is ignored here.)
+             */
+            verify_checksum(strip_info);
+            /*
+             * If the radio has structured messages but we don't yet have all our information about it,
+             * we should do probes without delay, until we have gathered all the information
+             */
+            if (!GOT_ALL_RADIO_INFO(strip_info)) strip_info->watchdog_doprobe = jiffies;
+        }
+    }
+
+    else if (has_prefix(msg, len, "005")) /* Bad count specification */
+        RecvErr("Error Msg:", strip_info);
+
+    else if (has_prefix(msg, len, "006")) /* Header too big */
+        RecvErr("Error Msg:", strip_info);
+
+    else if (has_prefix(msg, len, "007")) /* Body too big */
+    {
+        RecvErr("Error Msg:", strip_info);
+        printk(KERN_ERR "%s: Error! Packet size too big for radio.\n",
+            strip_info->dev.name);
+    }
+
+    else if (has_prefix(msg, len, "008")) /* Bad character in name */
+    {
+        RecvErr("Error Msg:", strip_info);
+        printk(KERN_ERR "%s: Radio name contains illegal character\n",
+            strip_info->dev.name);
+    }
+
+    else if (has_prefix(msg, len, "009")) /* No count or line terminator */
+        RecvErr("Error Msg:", strip_info);
+
+    else if (has_prefix(msg, len, "010")) /* Invalid checksum */
+        RecvErr("Error Msg:", strip_info);
+
+    else if (has_prefix(msg, len, "011")) /* Checksum didn't match */
+        RecvErr("Error Msg:", strip_info);
+
+    else if (has_prefix(msg, len, "012")) /* Failed to transmit packet */
+        RecvErr("Error Msg:", strip_info);
+
+    else
+        RecvErr("Error Msg:", strip_info);
+}
+
+static void process_AT_response(struct strip *strip_info, __u8 *ptr, __u8 *end)
+{
+    u_long len;
+    __u8 *p = ptr;
+    while (p < end && p[-1] != 10) p++; /* Skip past first newline character */
+    /* Now ptr points to the AT command, and p points to the text of the response. */
+    len = p-ptr;
+
+#if TICKLE_TIMERS
+    {
+    struct timeval tv;
+    do_gettimeofday(&tv);
+    printk(KERN_INFO "**** Got AT response %.7s      at %02d.%06d\n",
+        ptr, tv.tv_sec % 100, tv.tv_usec);
+    }
+#endif
+
+    if      (has_prefix(ptr, len, "ATS300?" )) get_radio_version(strip_info, p, end);
+    else if (has_prefix(ptr, len, "ATS305?" )) get_radio_address(strip_info, p);
+    else if (has_prefix(ptr, len, "ATS311?" )) get_radio_neighbours(&strip_info->poletops, p, end);
+    else if (has_prefix(ptr, len, "ATS319=7")) verify_checksum(strip_info);
+    else if (has_prefix(ptr, len, "ATS325?" )) get_radio_voltage(strip_info, p, end);
+    else if (has_prefix(ptr, len, "AT~LA"   )) get_radio_neighbours(&strip_info->portables, p, end);
+    else                                       RecvErr("Unknown AT Response:", strip_info);
+}
+
+static void process_ACK(struct strip *strip_info, __u8 *ptr, __u8 *end)
+{
+    /* Currently we don't do anything with ACKs from the radio */
+}
+
+static void process_Info(struct strip *strip_info, __u8 *ptr, __u8 *end)
+{
+    if (ptr+16 > end) RecvErr("Bad Info Msg:", strip_info);
+}
+
+static struct net_device *get_strip_dev(struct strip *strip_info)
+{
+    /* If our hardware address is *manually set* to zero, and we know our */
+    /* real radio hardware address, try to find another strip device that has been */
+    /* manually set to that address that we can 'transfer ownership' of this packet to  */
+    if (strip_info->manual_dev_addr &&
+        !memcmp(strip_info->dev.dev_addr, zero_address.c, sizeof(zero_address)) &&
+        memcmp(&strip_info->true_dev_addr, zero_address.c, sizeof(zero_address)))
+    {
+        struct net_device *dev;
+	read_lock_bh(&dev_base_lock);
+	dev = dev_base;
+        while (dev)
+        {
+            if (dev->type == strip_info->dev.type &&
+                !memcmp(dev->dev_addr, &strip_info->true_dev_addr, sizeof(MetricomAddress)))
+            {
+                printk(KERN_INFO "%s: Transferred packet ownership to %s.\n",
+                    strip_info->dev.name, dev->name);
+		read_unlock_bh(&dev_base_lock);
+                return(dev);
+            }
+            dev = dev->next;
+        }
+	read_unlock_bh(&dev_base_lock);
+    }
+    return(&strip_info->dev);
+}
+
+/*
+ * Send one completely decapsulated datagram to the next layer.
+ */
+
+static void deliver_packet(struct strip *strip_info, STRIP_Header *header, __u16 packetlen)
+{
+    struct sk_buff *skb = dev_alloc_skb(sizeof(STRIP_Header) + packetlen);
+    if (!skb)
+    {
+        printk(KERN_ERR "%s: memory squeeze, dropping packet.\n", strip_info->dev.name);
+        strip_info->rx_dropped++;
+    }
+    else
+    {
+        memcpy(skb_put(skb, sizeof(STRIP_Header)), header, sizeof(STRIP_Header));
+        memcpy(skb_put(skb, packetlen), strip_info->rx_buff, packetlen);
+        skb->dev      = get_strip_dev(strip_info);
+        skb->protocol = header->protocol;
+        skb->mac.raw  = skb->data;
+
+        /* Having put a fake header on the front of the sk_buff for the */
+        /* benefit of tools like tcpdump, skb_pull now 'consumes' that  */
+        /* fake header before we hand the packet up to the next layer.  */
+        skb_pull(skb, sizeof(STRIP_Header));
+
+        /* Finally, hand the packet up to the next layer (e.g. IP or ARP, etc.) */
+        strip_info->rx_packets++;
+        strip_info->rx_pps_count++;
+#ifdef EXT_COUNTERS
+        strip_info->rx_bytes += packetlen;
+#endif
+        skb->dev->last_rx = jiffies;
+        netif_rx(skb);
+    }
+}
+
+static void process_IP_packet(struct strip *strip_info, STRIP_Header *header, __u8 *ptr, __u8 *end)
+{
+    __u16 packetlen;
+
+    /* Decode start of the IP packet header */
+    ptr = UnStuffData(ptr, end, strip_info->rx_buff, 4);
+    if (!ptr)
+    {
+        RecvErr("IP Packet too short", strip_info);
+        return;
+    }
+
+    packetlen = ((__u16)strip_info->rx_buff[2] << 8) | strip_info->rx_buff[3];
+
+    if (packetlen > MAX_RECV_MTU)
+    {
+        printk(KERN_INFO "%s: Dropping oversized received IP packet: %d bytes\n",
+            strip_info->dev.name, packetlen);
+        strip_info->rx_dropped++;
+        return;
+    }
+
+    /*printk(KERN_INFO "%s: Got %d byte IP packet\n", strip_info->dev.name, packetlen);*/
+
+    /* Decode remainder of the IP packet */
+    ptr = UnStuffData(ptr, end, strip_info->rx_buff+4, packetlen-4);
+    if (!ptr)
+    {
+        RecvErr("IP Packet too short", strip_info);
+        return;
+    }
+
+    if (ptr < end)
+    {
+        RecvErr("IP Packet too long", strip_info);
+        return;
+    }
+
+    header->protocol = htons(ETH_P_IP);
+
+    deliver_packet(strip_info, header, packetlen);
+}
+
+static void process_ARP_packet(struct strip *strip_info, STRIP_Header *header, __u8 *ptr, __u8 *end)
+{
+    __u16 packetlen;
+    struct arphdr *arphdr = (struct arphdr *)strip_info->rx_buff;
+
+    /* Decode start of the ARP packet */
+    ptr = UnStuffData(ptr, end, strip_info->rx_buff, 8);
+    if (!ptr)
+    {
+        RecvErr("ARP Packet too short", strip_info);
+        return;
+    }
+
+    packetlen = 8 + (arphdr->ar_hln + arphdr->ar_pln) * 2;
+
+    if (packetlen > MAX_RECV_MTU)
+    {
+        printk(KERN_INFO "%s: Dropping oversized received ARP packet: %d bytes\n",
+            strip_info->dev.name, packetlen);
+        strip_info->rx_dropped++;
+        return;
+    }
+
+    /*printk(KERN_INFO "%s: Got %d byte ARP %s\n",
+        strip_info->dev.name, packetlen,
+        ntohs(arphdr->ar_op) == ARPOP_REQUEST ? "request" : "reply");*/
+
+    /* Decode remainder of the ARP packet */
+    ptr = UnStuffData(ptr, end, strip_info->rx_buff+8, packetlen-8);
+    if (!ptr)
+    {
+        RecvErr("ARP Packet too short", strip_info);
+        return;
+    }
+
+    if (ptr < end)
+    {
+        RecvErr("ARP Packet too long", strip_info);
+        return;
+    }
+
+    header->protocol = htons(ETH_P_ARP);
+
+    deliver_packet(strip_info, header, packetlen);
+}
+
+/*
+ * process_text_message processes a <CR>-terminated block of data received
+ * from the radio that doesn't begin with a '*' character. All normal
+ * Starmode communication messages with the radio begin with a '*',
+ * so any text that does not indicates a serial port error, a radio that
+ * is in Hayes command mode instead of Starmode, or a radio with really
+ * old firmware that doesn't frame its Starmode responses properly.
+ */
+static void process_text_message(struct strip *strip_info)
+{
+    __u8 *msg = strip_info->sx_buff;
+    int len   = strip_info->sx_count;
+
+    /* Check for anything that looks like it might be our radio name */
+    /* (This is here for backwards compatibility with old firmware)  */
+    if (len == 9 && get_radio_address(strip_info, msg) == 0) return;
+
+    if (text_equal(msg, len, "OK"      )) return; /* Ignore 'OK' responses from prior commands */
+    if (text_equal(msg, len, "ERROR"   )) return; /* Ignore 'ERROR' messages */
+    if (has_prefix(msg, len, "ate0q1"  )) return; /* Ignore character echo back from the radio */
+
+    /* Catch other error messages */
+    /* (This is here for backwards compatibility with old firmware) */
+    if (has_prefix(msg, len, "ERR_")) { RecvErr_Message(strip_info, NULL, &msg[4], len-4); return; }
+    
+    RecvErr("No initial *", strip_info);
+}
+
+/*
+ * process_message processes a <CR>-terminated block of data received
+ * from the radio. If the radio is not in Starmode or has old firmware,
+ * it may be a line of text in response to an AT command. Ideally, with
+ * a current radio that's properly in Starmode, all data received should
+ * be properly framed and checksummed radio message blocks, containing
+ * either a starmode packet, or a other communication from the radio
+ * firmware, like "INF_" Info messages and &COMMAND responses.
+ */
+static void process_message(struct strip *strip_info)
+{
+    STRIP_Header header = { zero_address, zero_address, 0 };
+    __u8 *ptr = strip_info->sx_buff;
+    __u8 *end = strip_info->sx_buff + strip_info->sx_count;
+    __u8 sendername[32], *sptr = sendername;
+    MetricomKey key;
+
+    /*HexDump("Receiving", strip_info, ptr, end);*/
+
+    /* Check for start of address marker, and then skip over it */
+    if (*ptr == '*') ptr++;
+    else { process_text_message(strip_info); return; }
+
+    /* Copy out the return address */
+    while (ptr < end && *ptr != '*' && sptr < ARRAY_END(sendername)-1) *sptr++ = *ptr++;
+    *sptr = 0;                /* Null terminate the sender name */
+
+    /* Check for end of address marker, and skip over it */
+    if (ptr >= end || *ptr != '*')
+    {
+        RecvErr("No second *", strip_info);
+        return;
+    }
+    ptr++; /* Skip the second '*' */
+
+    /* If the sender name is "&COMMAND", ignore this 'packet'       */
+    /* (This is here for backwards compatibility with old firmware) */
+    if (!strcmp(sendername, "&COMMAND"))
+    {
+        strip_info->firmware_level = NoStructure;
+        strip_info->next_command   = CompatibilityCommand;
+        return;
+    }
+
+    if (ptr+4 > end)
+    {
+        RecvErr("No proto key", strip_info);
+        return;
+    }
+
+    /* Get the protocol key out of the buffer */
+    key.c[0] = *ptr++;
+    key.c[1] = *ptr++;
+    key.c[2] = *ptr++;
+    key.c[3] = *ptr++;
+
+    /* If we're using checksums, verify the checksum at the end of the packet */
+    if (strip_info->firmware_level >= ChecksummedMessages)
+    {
+        end -= 4;	/* Chop the last four bytes off the packet (they're the checksum) */
+        if (ptr > end)
+        {
+            RecvErr("Missing Checksum", strip_info);
+            return;
+        }
+        if (!verify_checksum(strip_info))
+        {
+            RecvErr("Bad Checksum", strip_info);
+            return;
+        }
+    }
+
+    /*printk(KERN_INFO "%s: Got packet from \"%s\".\n", strip_info->dev.name, sendername);*/
+
+    /*
+     * Fill in (pseudo) source and destination addresses in the packet.
+     * We assume that the destination address was our address (the radio does not
+     * tell us this). If the radio supplies a source address, then we use it.
+     */
+    header.dst_addr = strip_info->true_dev_addr;
+    string_to_radio_address(&header.src_addr, sendername);
+
+#ifdef EXT_COUNTERS
+    if      (key.l == SIP0Key.l) {
+      strip_info->rx_rbytes += (end - ptr);
+      process_IP_packet(strip_info, &header, ptr, end);
+    } else if (key.l == ARP0Key.l) {
+      strip_info->rx_rbytes += (end - ptr);
+      process_ARP_packet(strip_info, &header, ptr, end);
+    } else if (key.l == ATR_Key.l) {
+      strip_info->rx_ebytes += (end - ptr);
+      process_AT_response(strip_info, ptr, end);
+    } else if (key.l == ACK_Key.l) {
+      strip_info->rx_ebytes += (end - ptr);
+      process_ACK(strip_info, ptr, end);
+    } else if (key.l == INF_Key.l) {
+      strip_info->rx_ebytes += (end - ptr);
+      process_Info(strip_info, ptr, end);
+    } else if (key.l == ERR_Key.l) {
+      strip_info->rx_ebytes += (end - ptr);
+      RecvErr_Message(strip_info, sendername, ptr, end-ptr);
+    } else RecvErr("Unrecognized protocol key", strip_info);
+#else
+    if      (key.l == SIP0Key.l) process_IP_packet  (strip_info, &header, ptr, end);
+    else if (key.l == ARP0Key.l) process_ARP_packet (strip_info, &header, ptr, end);
+    else if (key.l == ATR_Key.l) process_AT_response(strip_info, ptr, end);
+    else if (key.l == ACK_Key.l) process_ACK        (strip_info, ptr, end);
+    else if (key.l == INF_Key.l) process_Info       (strip_info, ptr, end);
+    else if (key.l == ERR_Key.l) RecvErr_Message    (strip_info, sendername, ptr, end-ptr);
+    else                         RecvErr("Unrecognized protocol key", strip_info);
+#endif
+}
+
+#define TTYERROR(X) ((X) == TTY_BREAK   ? "Break"            : \
+                     (X) == TTY_FRAME   ? "Framing Error"    : \
+                     (X) == TTY_PARITY  ? "Parity Error"     : \
+                     (X) == TTY_OVERRUN ? "Hardware Overrun" : "Unknown Error")
+
+/*
+ * Handle the 'receiver data ready' interrupt.
+ * This function is called by the 'tty_io' module in the kernel when
+ * a block of STRIP data has been received, which can now be decapsulated
+ * and sent on to some IP layer for further processing.
+ */
+
+static void
+strip_receive_buf(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
+{
+    struct strip *strip_info = (struct strip *) tty->disc_data;
+    const unsigned char *end = cp + count;
+
+    if (!strip_info || strip_info->magic != STRIP_MAGIC 
+    	|| !netif_running(&strip_info->dev))
+        return;
+
+    /* Argh! mtu change time! - costs us the packet part received at the change */
+    if (strip_info->mtu != strip_info->dev.mtu)
+        strip_changedmtu(strip_info);
+
+#if 0
+    {
+    struct timeval tv;
+    do_gettimeofday(&tv);
+    printk(KERN_INFO "**** strip_receive_buf: %3d bytes at %02d.%06d\n",
+        count, tv.tv_sec % 100, tv.tv_usec);
+    }
+#endif
+
+#ifdef EXT_COUNTERS
+    strip_info->rx_sbytes += count;
+#endif
+
+    /* Read the characters out of the buffer */
+    while (cp < end)
+    {
+        if (fp && *fp) printk(KERN_INFO "%s: %s on serial port\n", strip_info->dev.name, TTYERROR(*fp));
+        if (fp && *fp++ && !strip_info->discard) /* If there's a serial error, record it */
+        {
+            /* If we have some characters in the buffer, discard them */
+            strip_info->discard = strip_info->sx_count;
+            strip_info->rx_errors++;
+        }
+
+        /* Leading control characters (CR, NL, Tab, etc.) are ignored */
+        if (strip_info->sx_count > 0 || *cp >= ' ')
+        {
+            if (*cp == 0x0D)                /* If end of packet, decide what to do with it */
+            {
+                if (strip_info->sx_count > 3000)
+                    printk(KERN_INFO "%s: Cut a %d byte packet (%d bytes remaining)%s\n",
+                        strip_info->dev.name, strip_info->sx_count, end-cp-1,
+                        strip_info->discard ? " (discarded)" : "");
+                if (strip_info->sx_count > strip_info->sx_size)
+                {
+                    strip_info->rx_over_errors++;
+                    printk(KERN_INFO "%s: sx_buff overflow (%d bytes total)\n",
+                           strip_info->dev.name, strip_info->sx_count);
+                }
+                else if (strip_info->discard)
+                    printk(KERN_INFO "%s: Discarding bad packet (%d/%d)\n",
+                        strip_info->dev.name, strip_info->discard, strip_info->sx_count);
+                else process_message(strip_info);
+                strip_info->discard = 0;
+                strip_info->sx_count = 0;
+            }
+            else
+            {
+                /* Make sure we have space in the buffer */
+                if (strip_info->sx_count < strip_info->sx_size)
+                    strip_info->sx_buff[strip_info->sx_count] = *cp;
+                strip_info->sx_count++;
+            }
+        }
+        cp++;
+    }
+}
+
+
+/************************************************************************/
+/* General control routines						*/
+
+static int set_mac_address(struct strip *strip_info, MetricomAddress *addr)
+{
+    /*
+     * We're using a manually specified address if the address is set
+     * to anything other than all ones. Setting the address to all ones
+     * disables manual mode and goes back to automatic address determination
+     * (tracking the true address that the radio has).
+     */
+    strip_info->manual_dev_addr = memcmp(addr->c, broadcast_address.c, sizeof(broadcast_address));
+    if (strip_info->manual_dev_addr)
+         *(MetricomAddress*)strip_info->dev.dev_addr = *addr;
+    else *(MetricomAddress*)strip_info->dev.dev_addr = strip_info->true_dev_addr;
+    return 0;
+}
+
+static int dev_set_mac_address(struct net_device *dev, void *addr)
+{
+    struct strip *strip_info = (struct strip *)(dev->priv);
+    struct sockaddr *sa = addr;
+    printk(KERN_INFO "%s: strip_set_dev_mac_address called\n", dev->name);
+    set_mac_address(strip_info, (MetricomAddress *)sa->sa_data);
+    return 0;
+}
+
+static struct net_device_stats *strip_get_stats(struct net_device *dev)
+{
+    static struct net_device_stats stats;
+    struct strip *strip_info = (struct strip *)(dev->priv);
+
+    memset(&stats, 0, sizeof(struct net_device_stats));
+
+    stats.rx_packets     = strip_info->rx_packets;
+    stats.tx_packets     = strip_info->tx_packets;
+    stats.rx_dropped     = strip_info->rx_dropped;
+    stats.tx_dropped     = strip_info->tx_dropped;
+    stats.tx_errors      = strip_info->tx_errors;
+    stats.rx_errors      = strip_info->rx_errors;
+    stats.rx_over_errors = strip_info->rx_over_errors;
+    return(&stats);
+}
+
+
+/************************************************************************/
+/* Opening and closing							*/
+
+/*
+ * Here's the order things happen:
+ * When the user runs "slattach -p strip ..."
+ *  1. The TTY module calls strip_open
+ *  2. strip_open calls strip_alloc
+ *  3.                  strip_alloc calls register_netdev
+ *  4.                  register_netdev calls strip_dev_init
+ *  5. then strip_open finishes setting up the strip_info
+ *
+ * When the user runs "ifconfig st<x> up address netmask ..."
+ *  6. strip_open_low gets called
+ *
+ * When the user runs "ifconfig st<x> down"
+ *  7. strip_close_low gets called
+ *
+ * When the user kills the slattach process
+ *  8. strip_close gets called
+ *  9. strip_close calls dev_close
+ * 10. if the device is still up, then dev_close calls strip_close_low
+ * 11. strip_close calls strip_free
+ */
+
+/* Open the low-level part of the STRIP channel. Easy! */
+
+static int strip_open_low(struct net_device *dev)
+{
+    struct strip *strip_info = (struct strip *)(dev->priv);
+#if 0
+    struct in_device *in_dev = dev->ip_ptr;
+#endif
+
+    if (strip_info->tty == NULL)
+        return(-ENODEV);
+
+    if (!allocate_buffers(strip_info))
+        return(-ENOMEM);
+
+    strip_info->sx_count = 0;
+    strip_info->tx_left  = 0;
+
+    strip_info->discard  = 0;
+    strip_info->working  = FALSE;
+    strip_info->firmware_level = NoStructure;
+    strip_info->next_command   = CompatibilityCommand;
+    strip_info->user_baud      = get_baud(strip_info->tty);
+
+#if 0
+    /*
+     * Needed because address '0' is special
+     *
+     * --ANK Needed it or not needed, it does not matter at all.
+     *	     Make it at user level, guys.
+     */
+
+    if (in_dev->ifa_list->ifa_address == 0)
+        in_dev->ifa_list->ifa_address = ntohl(0xC0A80001);
+#endif
+    printk(KERN_INFO "%s: Initializing Radio.\n", strip_info->dev.name);
+    ResetRadio(strip_info);
+    strip_info->idle_timer.expires = jiffies + 1*HZ;
+    add_timer(&strip_info->idle_timer);
+    netif_wake_queue(dev);
+    return(0);
+}
+
+
+/*
+ * Close the low-level part of the STRIP channel. Easy!
+ */
+
+static int strip_close_low(struct net_device *dev)
+{
+    struct strip *strip_info = (struct strip *)(dev->priv);
+
+    if (strip_info->tty == NULL)
+        return -EBUSY;
+    strip_info->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
+
+    netif_stop_queue(dev);
+    
+    /*
+     * Free all STRIP frame buffers.
+     */
+    if (strip_info->rx_buff)
+    {
+        kfree(strip_info->rx_buff);
+        strip_info->rx_buff = NULL;
+    }
+    if (strip_info->sx_buff)
+    {
+        kfree(strip_info->sx_buff);
+        strip_info->sx_buff = NULL;
+    }
+    if (strip_info->tx_buff)
+    {
+        kfree(strip_info->tx_buff);
+        strip_info->tx_buff = NULL;
+    }
+    del_timer(&strip_info->idle_timer);
+    return 0;
+}
+
+/*
+ * This routine is called by DDI when the
+ * (dynamically assigned) device is registered
+ */
+
+static int strip_dev_init(struct net_device *dev)
+{
+    /*
+     * Finish setting up the DEVICE info.
+     */
+
+    dev->trans_start        = 0;
+    dev->last_rx            = 0;
+    dev->tx_queue_len       = 30;         /* Drop after 30 frames queued */
+
+    dev->flags              = 0;
+    dev->mtu                = DEFAULT_STRIP_MTU;
+    dev->type               = ARPHRD_METRICOM;        /* dtang */
+    dev->hard_header_len    = sizeof(STRIP_Header);
+    /*
+     *  dev->priv             Already holds a pointer to our struct strip
+     */
+
+    *(MetricomAddress*)&dev->broadcast = broadcast_address;
+    dev->dev_addr[0]        = 0;
+    dev->addr_len           = sizeof(MetricomAddress);
+
+    /*
+     * Pointers to interface service routines.
+     */
+
+    dev->open               = strip_open_low;
+    dev->stop               = strip_close_low;
+    dev->hard_start_xmit    = strip_xmit;
+    dev->hard_header        = strip_header;
+    dev->rebuild_header     = strip_rebuild_header;
+    dev->set_mac_address    = dev_set_mac_address;
+    dev->get_stats          = strip_get_stats;
+    return 0;
+}
+
+/*
+ * Free a STRIP channel.
+ */
+
+static void strip_free(struct strip *strip_info)
+{
+    *(strip_info->referrer) = strip_info->next;
+    if (strip_info->next)
+        strip_info->next->referrer = strip_info->referrer;
+    strip_info->magic = 0;
+    kfree(strip_info);
+}
+
+/*
+ * Allocate a new free STRIP channel
+ */
+
+static struct strip *strip_alloc(void)
+{
+    int channel_id = 0;
+    struct strip **s = &struct_strip_list;
+    struct strip *strip_info = (struct strip *)
+        kmalloc(sizeof(struct strip), GFP_KERNEL);
+
+    if (!strip_info)
+        return(NULL);        /* If no more memory, return */
+
+    /*
+     * Clear the allocated memory
+     */
+
+    memset(strip_info, 0, sizeof(struct strip));
+
+    /*
+     * Search the list to find where to put our new entry
+     * (and in the process decide what channel number it is
+     * going to be)
+     */
+
+    while (*s && (*s)->dev.base_addr == channel_id)
+    {
+        channel_id++;
+        s = &(*s)->next;
+    }
+
+    /*
+     * Fill in the link pointers
+     */
+
+    strip_info->next = *s;
+    if (*s)
+        (*s)->referrer = &strip_info->next;
+    strip_info->referrer = s;
+    *s = strip_info;
+
+    strip_info->magic = STRIP_MAGIC;
+    strip_info->tty   = NULL;
+
+    strip_info->gratuitous_arp   = jiffies + LongTime;
+    strip_info->arp_interval     = 0;
+    init_timer(&strip_info->idle_timer);
+    strip_info->idle_timer.data     = (long)&strip_info->dev;
+    strip_info->idle_timer.function = strip_IdleTask;
+
+    /* Note: strip_info->if_name is currently 8 characters long */
+    sprintf(strip_info->dev.name, "st%d", channel_id);
+    strip_info->dev.base_addr    = channel_id;
+    strip_info->dev.priv         = (void*)strip_info;
+    strip_info->dev.next         = NULL;
+    strip_info->dev.init         = strip_dev_init;
+
+    return(strip_info);
+}
+
+/*
+ * Open the high-level part of the STRIP channel.
+ * This function is called by the TTY module when the
+ * STRIP line discipline is called for.  Because we are
+ * sure the tty line exists, we only have to link it to
+ * a free STRIP channel...
+ */
+
+static int strip_open(struct tty_struct *tty)
+{
+    struct strip *strip_info = (struct strip *) tty->disc_data;
+
+    /*
+     * First make sure we're not already connected.
+     */
+
+    if (strip_info && strip_info->magic == STRIP_MAGIC)
+        return -EEXIST;
+
+    /*
+     * OK.  Find a free STRIP channel to use.
+     */
+    if ((strip_info = strip_alloc()) == NULL)
+        return -ENFILE;
+
+    /*
+     * Register our newly created device so it can be ifconfig'd
+     * strip_dev_init() will be called as a side-effect
+     */
+
+    if (register_netdev(&strip_info->dev) != 0)
+    {
+        printk(KERN_ERR "strip: register_netdev() failed.\n");
+        strip_free(strip_info);
+        return -ENFILE;
+    }
+
+    strip_info->tty = tty;
+    tty->disc_data = strip_info;
+    if (tty->driver.flush_buffer)
+        tty->driver.flush_buffer(tty);
+    if (tty->ldisc.flush_buffer)
+        tty->ldisc.flush_buffer(tty);
+
+    /*
+     * Restore default settings
+     */
+
+    strip_info->dev.type = ARPHRD_METRICOM;    /* dtang */
+
+    /*
+     * Set tty options
+     */
+
+    tty->termios->c_iflag |= IGNBRK |IGNPAR;/* Ignore breaks and parity errors. */
+    tty->termios->c_cflag |= CLOCAL;    /* Ignore modem control signals. */
+    tty->termios->c_cflag &= ~HUPCL;    /* Don't close on hup */
+
+    MOD_INC_USE_COUNT;
+
+    printk(KERN_INFO "STRIP: device \"%s\" activated\n", strip_info->dev.name);
+
+    /*
+     * Done.  We have linked the TTY line to a channel.
+     */
+    return(strip_info->dev.base_addr);
+}
+
+/*
+ * Close down a STRIP channel.
+ * This means flushing out any pending queues, and then restoring the
+ * TTY line discipline to what it was before it got hooked to STRIP
+ * (which usually is TTY again).
+ */
+
+static void strip_close(struct tty_struct *tty)
+{
+    struct strip *strip_info = (struct strip *) tty->disc_data;
+
+    /*
+     * First make sure we're connected.
+     */
+
+    if (!strip_info || strip_info->magic != STRIP_MAGIC)
+        return;
+
+    unregister_netdev(&strip_info->dev);
+
+    tty->disc_data = 0;
+    strip_info->tty = NULL;
+    printk(KERN_INFO "STRIP: device \"%s\" closed down\n", strip_info->dev.name);
+    strip_free(strip_info);
+    tty->disc_data = NULL;
+    MOD_DEC_USE_COUNT;
+}
+
+
+/************************************************************************/
+/* Perform I/O control calls on an active STRIP channel.		*/
+
+static int strip_ioctl(struct tty_struct *tty, struct file *file,
+    unsigned int cmd, unsigned long arg)
+{
+    struct strip *strip_info = (struct strip *) tty->disc_data;
+
+    /*
+     * First make sure we're connected.
+     */
+
+    if (!strip_info || strip_info->magic != STRIP_MAGIC)
+        return -EINVAL;
+
+    switch(cmd)
+    {
+        case SIOCGIFNAME:
+	    return copy_to_user((void*)arg, strip_info->dev.name,
+				strlen(strip_info->dev.name) + 1) ? 
+		-EFAULT : 0;
+	    break;
+        case SIOCSIFHWADDR:
+            {
+            MetricomAddress addr;
+            printk(KERN_INFO "%s: SIOCSIFHWADDR\n", strip_info->dev.name);
+	    return copy_from_user(&addr, (void*)arg, sizeof(MetricomAddress)) ?
+		-EFAULT : set_mac_address(strip_info, &addr);
+	    break;
+	    }
+        /*
+         * Allow stty to read, but not set, the serial port
+         */
+
+        case TCGETS:
+        case TCGETA:
+            return n_tty_ioctl(tty, (struct file *) file, cmd,
+                (unsigned long) arg);
+	    break;
+        default:
+            return -ENOIOCTLCMD;
+	    break;
+    }
+}
+
+
+/************************************************************************/
+/* Initialization							*/
+
+static struct tty_ldisc strip_ldisc = {
+	.magic		= TTY_LDISC_MAGIC,
+	.name		= "strip",
+	.open		= strip_open,
+	.close		= strip_close,
+	.ioctl		= strip_ioctl,
+	.receive_buf	= strip_receive_buf,
+	.receive_room	= strip_receive_room,
+	.write_wakeup	= strip_write_some_more,
+};
+
+/*
+ * Initialize the STRIP driver.
+ * This routine is called at boot time, to bootstrap the multi-channel
+ * STRIP driver
+ */
+
+static char signon[] __initdata = KERN_INFO "STRIP: Version %s (unlimited channels)\n";
+
+static int __init strip_init_driver(void)
+{
+    int status;
+
+    printk(signon, StripVersion);
+
+    /*
+     * Fill in our line protocol discipline, and register it
+     */
+    if ((status = tty_register_ldisc(N_STRIP, &strip_ldisc)))
+        printk(KERN_ERR "STRIP: can't register line discipline (err = %d)\n", status);
+
+    /*
+     * Register the status file with /proc
+     */
+    proc_net_create("strip", S_IFREG | S_IRUGO, get_status_info);
+
+    return status;
+}
+module_init(strip_init_driver);
+
+static const char signoff[] __exitdata = KERN_INFO "STRIP: Module Unloaded\n";
+
+static void __exit strip_exit_driver(void)
+{
+    int i;
+    while (struct_strip_list)
+        strip_free(struct_strip_list);
+
+    /* Unregister with the /proc/net file here. */
+    proc_net_remove("strip");
+
+    if ((i = tty_register_ldisc(N_STRIP, NULL)))
+        printk(KERN_ERR "STRIP: can't unregister line discipline (err = %d)\n", i);
+
+    printk(signoff);
+}
+module_exit(strip_exit_driver);
+
+MODULE_AUTHOR("Stuart Cheshire <cheshire@cs.stanford.edu>");
+MODULE_DESCRIPTION("Starmode Radio IP (STRIP) Device Driver");
+MODULE_LICENSE("Dual BSD/GPL");
+
+MODULE_SUPPORTED_DEVICE("Starmode Radio IP (STRIP) modem");
+
diff -Nru a/drivers/net/znet.c b/drivers/net/znet.c
--- a/drivers/net/znet.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/net/znet.c	Sun Feb 23 22:25:21 2003
@@ -357,7 +357,7 @@
 	znet->tx_cur += sizeof(struct i82593_conf_block)/2;
 	outb(OP0_CONFIGURE | CR0_CHNL, ioaddr);
 
-	/* XXX FIXME maz : Add multicast adresses here, so having a
+	/* XXX FIXME maz : Add multicast addresses here, so having a
 	 * multicast address configured isn't equal to IFF_ALLMULTI */
 }
 
diff -Nru a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
--- a/drivers/oprofile/buffer_sync.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/oprofile/buffer_sync.c	Sun Feb 23 22:25:22 2003
@@ -147,7 +147,7 @@
 	for (vma = mm->mmap; vma; vma = vma->vm_next) {
 		if (!vma->vm_file)
 			continue;
-		if (!vma->vm_flags & VM_EXECUTABLE)		
+		if (!(vma->vm_flags & VM_EXECUTABLE))
 			continue;
 		cookie = fast_get_dcookie(vma->vm_file->f_dentry,
 			vma->vm_file->f_vfsmnt);
diff -Nru a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c
--- a/drivers/oprofile/oprofile_stats.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/oprofile/oprofile_stats.c	Sun Feb 23 22:25:25 2003
@@ -9,6 +9,7 @@
 
 #include <linux/oprofile.h>
 #include <linux/smp.h>
+#include <linux/threads.h>
  
 #include "oprofile_stats.h"
 #include "cpu_buffer.h"
diff -Nru a/drivers/parisc/dino.c b/drivers/parisc/dino.c
--- a/drivers/parisc/dino.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/parisc/dino.c	Sun Feb 23 22:25:21 2003
@@ -403,7 +403,7 @@
 
 		/*
 		 * Perform a binary search on set bits.
-		 * `Less than Fatal' and PS2 interupts aren't supported.
+		 * `Less than Fatal' and PS2 interrupts aren't supported.
 		 */
 		if (mask & 0xf) {
 			if (mask & 0x3) {
diff -Nru a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
--- a/drivers/parisc/lba_pci.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/parisc/lba_pci.c	Sun Feb 23 22:25:25 2003
@@ -765,7 +765,7 @@
 			pci_read_bridge_bases(bus);
 		} else {
 			/* Not configured.
-			** For now, propogate HBA limits to the bus;
+			** For now, propagate HBA limits to the bus;
 			**	PCI will adjust them later.
 			*/
 			bus->resource[0]->end = ldev->hba.io_space.end;
diff -Nru a/drivers/parisc/power.c b/drivers/parisc/power.c
--- a/drivers/parisc/power.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/parisc/power.c	Sun Feb 23 22:25:21 2003
@@ -277,7 +277,3 @@
 MODULE_AUTHOR("Helge Deller");
 MODULE_DESCRIPTION("Soft power switch driver");
 MODULE_LICENSE("Dual BSD/GPL");
-
-
-EXPORT_NO_SYMBOLS;
-
diff -Nru a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
--- a/drivers/parport/parport_pc.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/parport/parport_pc.c	Sun Feb 23 22:25:26 2003
@@ -1634,7 +1634,7 @@
 /*
  * Checks for port existence, all ports support SPP MODE
  * Returns: 
- *         0           :  No parallel port at this adress
+ *         0           :  No parallel port at this address
  *  PARPORT_MODE_PCSPP :  SPP port detected 
  *                        (if the user specified an ioport himself,
  *                         this shall always be the case!)
diff -Nru a/drivers/pci/Makefile b/drivers/pci/Makefile
--- a/drivers/pci/Makefile	Sun Feb 23 22:25:26 2003
+++ b/drivers/pci/Makefile	Sun Feb 23 22:25:26 2003
@@ -22,6 +22,7 @@
 obj-$(CONFIG_PPC32) += setup-irq.o
 obj-$(CONFIG_DDB5476) += setup-bus.o
 obj-$(CONFIG_SGI_IP27) += setup-irq.o
+obj-$(CONFIG_X86_VISWS) += setup-irq.o
 
 # CompactPCI hotplug requires the pbus_* functions
 ifdef CONFIG_HOTPLUG_PCI_CPCI
diff -Nru a/drivers/pci/hotplug.c b/drivers/pci/hotplug.c
--- a/drivers/pci/hotplug.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/pci/hotplug.c	Sun Feb 23 22:25:26 2003
@@ -173,44 +173,6 @@
 EXPORT_SYMBOL(pci_visit_dev);
 
 /**
- * pci_is_dev_in_use - query devices' usage
- * @dev: PCI device to query
- *
- * Queries whether a given PCI device is in use by a driver or not.
- * Returns 1 if the device is in use, 0 if it is not.
- */
-int pci_is_dev_in_use(struct pci_dev *dev)
-{
-	/* 
-	 * dev->driver will be set if the device is in use by a new-style 
-	 * driver -- otherwise, check the device's regions to see if any
-	 * driver has claimed them.
-	 */
-
-	int i;
-	int inuse = 0;
-
-	if (dev->driver) {
-		/* Assume driver feels responsible */
-		return 1;
-	}
-
-	for (i = 0; !dev->driver && !inuse && (i < 6); i++) {
-		if (!pci_resource_start(dev, i))
-			continue;
-		if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
-			inuse = check_region(pci_resource_start(dev, i),
-					     pci_resource_len(dev, i));
-		} else if (pci_resource_flags(dev, i) & IORESOURCE_MEM) {
-			inuse = check_mem_region(pci_resource_start(dev, i),
-						 pci_resource_len(dev, i));
-		}
-	}
-	return inuse;
-}
-EXPORT_SYMBOL(pci_is_dev_in_use);
-
-/**
  * pci_remove_device_safe - remove an unused hotplug device
  * @dev: the device to remove
  *
@@ -221,9 +183,8 @@
  */
 int pci_remove_device_safe(struct pci_dev *dev)
 {
-	if (pci_is_dev_in_use(dev)) {
+	if (pci_dev_driver(dev))
 		return -EBUSY;
-	}
 	pci_remove_device(dev);
 	return 0;
 }
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/pci/probe.c	Sun Feb 23 22:25:25 2003
@@ -36,11 +36,22 @@
 /*
  * Find the extent of a PCI decode..
  */
-static u32 pci_size(u32 base, unsigned long mask)
+static u32 pci_size(u32 base, u32 maxbase, unsigned long mask)
 {
-	u32 size = mask & base;		/* Find the significant bits */
-	size = size & ~(size-1);	/* Get the lowest of them to find the decode size */
-	return size-1;			/* extent = size - 1 */
+	u32 size = mask & maxbase;	/* Find the significant bits */
+	if (!size)
+		return 0;
+
+	/* Get the lowest of them to find the decode size, and
+	   from that the extent.  */
+	size = (size & ~(size-1)) - 1;
+
+	/* base == maxbase can be valid only if the BAR has
+	   already been programmed with all 1s.  */
+	if (base == maxbase && ((base | size) & mask) != mask)
+		return 0;
+
+	return size;
 }
 
 static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
@@ -63,13 +74,17 @@
 		if (l == 0xffffffff)
 			l = 0;
 		if ((l & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY) {
+			sz = pci_size(l, sz, PCI_BASE_ADDRESS_MEM_MASK);
+			if (!sz)
+				continue;
 			res->start = l & PCI_BASE_ADDRESS_MEM_MASK;
 			res->flags |= l & ~PCI_BASE_ADDRESS_MEM_MASK;
-			sz = pci_size(sz, PCI_BASE_ADDRESS_MEM_MASK);
 		} else {
+			sz = pci_size(l, sz, PCI_BASE_ADDRESS_IO_MASK & 0xffff);
+			if (!sz)
+				continue;
 			res->start = l & PCI_BASE_ADDRESS_IO_MASK;
 			res->flags |= l & ~PCI_BASE_ADDRESS_IO_MASK;
-			sz = pci_size(sz, PCI_BASE_ADDRESS_IO_MASK & 0xffff);
 		}
 		res->end = res->start + (unsigned long) sz;
 		res->flags |= pci_calc_resource_flags(l);
@@ -99,6 +114,7 @@
 	if (rom) {
 		dev->rom_base_reg = rom;
 		res = &dev->resource[PCI_ROM_RESOURCE];
+		res->name = dev->dev.name;
 		pci_read_config_dword(dev, rom, &l);
 		pci_write_config_dword(dev, rom, ~PCI_ROM_ADDRESS_ENABLE);
 		pci_read_config_dword(dev, rom, &sz);
@@ -106,13 +122,15 @@
 		if (l == 0xffffffff)
 			l = 0;
 		if (sz && sz != 0xffffffff) {
-			res->flags = (l & PCI_ROM_ADDRESS_ENABLE) |
-			  IORESOURCE_MEM | IORESOURCE_PREFETCH | IORESOURCE_READONLY | IORESOURCE_CACHEABLE;
-			res->start = l & PCI_ROM_ADDRESS_MASK;
-			sz = pci_size(sz, PCI_ROM_ADDRESS_MASK);
-			res->end = res->start + (unsigned long) sz;
+			sz = pci_size(l, sz, PCI_ROM_ADDRESS_MASK);
+			if (sz) {
+				res->flags = (l & PCI_ROM_ADDRESS_ENABLE) |
+				  IORESOURCE_MEM | IORESOURCE_PREFETCH |
+				  IORESOURCE_READONLY | IORESOURCE_CACHEABLE;
+				res->start = l & PCI_ROM_ADDRESS_MASK;
+				res->end = res->start + (unsigned long) sz;
+			}
 		}
-		res->name = dev->dev.name;
 	}
 }
 
@@ -487,23 +505,30 @@
 {
 	unsigned int devfn, max, pass;
 	struct list_head *ln;
-	struct pci_dev *dev, dev0;
+	struct pci_dev *dev;
+
+	dev = kmalloc(sizeof(*dev), GFP_KERNEL);
+	if (!dev) {
+		printk(KERN_ERR "Out of memory in %s\n", __FUNCTION__);
+		return 0;
+	}
 
 	DBG("Scanning bus %02x\n", bus->number);
 	max = bus->secondary;
 
 	/* Create a device template */
-	memset(&dev0, 0, sizeof(dev0));
-	dev0.bus = bus;
-	dev0.sysdata = bus->sysdata;
-	dev0.dev.parent = bus->dev;
-	dev0.dev.bus = &pci_bus_type;
+	memset(dev, 0, sizeof(*dev));
+	dev->bus = bus;
+	dev->sysdata = bus->sysdata;
+	dev->dev.parent = bus->dev;
+	dev->dev.bus = &pci_bus_type;
 
 	/* Go find them, Rover! */
 	for (devfn = 0; devfn < 0x100; devfn += 8) {
-		dev0.devfn = devfn;
-		pci_scan_slot(&dev0);
+		dev->devfn = devfn;
+		pci_scan_slot(dev);
 	}
+	kfree(dev);
 
 	/*
 	 * After performing arch-dependent fixup of the bus, look behind
@@ -531,10 +556,9 @@
 
 int __devinit pci_bus_exists(const struct list_head *list, int nr)
 {
-	const struct list_head *l;
+	const struct pci_bus *b;
 
-	for(l=list->next; l != list; l = l->next) {
-		const struct pci_bus *b = pci_bus_b(l);
+	list_for_each_entry(b, list, node) {
 		if (b->number == nr || pci_bus_exists(&b->children, nr))
 			return 1;
 	}
diff -Nru a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
--- a/drivers/pci/setup-bus.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/pci/setup-bus.c	Sun Feb 23 22:25:26 2003
@@ -39,14 +39,13 @@
 static int __devinit
 pbus_assign_resources_sorted(struct pci_bus *bus)
 {
-	struct list_head *ln;
+	struct pci_dev *dev;
 	struct resource *res;
 	struct resource_list head, *list, *tmp;
 	int idx, found_vga = 0;
 
 	head.next = NULL;
-	for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
-		struct pci_dev *dev = pci_dev_b(ln);
+	list_for_each_entry(dev, &bus->devices, bus_list) {
 		u16 class = dev->class >> 8;
 
 		if (class == PCI_CLASS_DISPLAY_VGA
@@ -201,15 +200,14 @@
 static void __devinit
 pbus_size_io(struct pci_bus *bus)
 {
-	struct list_head *ln;
+	struct pci_dev *dev;
 	struct resource *b_res = bus->resource[0];
 	unsigned long size = 0, size1 = 0;
 
 	if (!(b_res->flags & IORESOURCE_IO))
 		return;
 
-	for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
-		struct pci_dev *dev = pci_dev_b(ln);
+	list_for_each_entry(dev, &bus->devices, bus_list) {
 		int i;
 		
 		for (i = 0; i < PCI_NUM_RESOURCES; i++) {
@@ -250,7 +248,7 @@
 static void __devinit
 pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long type)
 {
-	struct list_head *ln;
+	struct pci_dev *dev;
 	unsigned long min_align, align, size;
 	unsigned long aligns[12];	/* Alignments from 1Mb to 2Gb */
 	int order, max_order;
@@ -261,8 +259,7 @@
 	max_order = 0;
 	size = 0;
 
-	for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
-		struct pci_dev *dev = pci_dev_b(ln);
+	list_for_each_entry(dev, &bus->devices, bus_list) {
 		int i;
 		
 		for (i = 0; i < PCI_NUM_RESOURCES; i++) {
@@ -322,11 +319,12 @@
 void __devinit
 pci_bus_size_bridges(struct pci_bus *bus)
 {
-	struct list_head *ln;
+	struct pci_bus *b;
 	unsigned long mask, type;
 
-	for (ln=bus->children.next; ln != &bus->children; ln=ln->next)
-		pci_bus_size_bridges(pci_bus_b(ln));
+	list_for_each_entry(b, &bus->children, node) {
+		pci_bus_size_bridges(b);
+	}
 
 	/* The root bus? */
 	if (!bus->self)
@@ -350,20 +348,16 @@
 void __devinit
 pci_bus_assign_resources(struct pci_bus *bus)
 {
-	struct list_head *ln;
+	struct pci_bus *b;
 	int found_vga = pbus_assign_resources_sorted(bus);
 
 	if (found_vga) {
-		struct pci_bus *b;
-
 		/* Propagate presence of the VGA to upstream bridges */
 		for (b = bus; b->parent; b = b->parent) {
 			b->resource[0]->flags |= IORESOURCE_BUS_HAS_VGA;
 		}
 	}
-	for (ln=bus->children.next; ln != &bus->children; ln=ln->next) {
-		struct pci_bus *b = pci_bus_b(ln);
-
+	list_for_each_entry(b, &bus->children, node) {
 		pci_bus_assign_resources(b);
 		pci_setup_bridge(b);
 	}
diff -Nru a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c
--- a/drivers/pcmcia/cardbus.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/pcmcia/cardbus.c	Sun Feb 23 22:25:22 2003
@@ -75,13 +75,6 @@
 
 #define FIND_FIRST_BIT(n)	((n) - ((n) & ((n)-1)))
 
-#define pci_readb		pci_read_config_byte
-#define pci_writeb		pci_write_config_byte
-#define pci_readw		pci_read_config_word
-#define pci_writew		pci_write_config_word
-#define pci_readl		pci_read_config_dword
-#define pci_writel		pci_write_config_dword
-
 /* Offsets in the Expansion ROM Image Header */
 #define ROM_SIGNATURE		0x0000	/* 2 bytes */
 #define ROM_DATA_PTR		0x0018	/* 2 bytes */
@@ -146,7 +139,7 @@
 	}
 }
 
-static int cb_setup_cis_mem(socket_info_t * s, struct pci_dev *dev, struct resource *res)
+static int cb_setup_cis_mem(socket_info_t * s, struct resource *res)
 {
 	unsigned int start, size;
 
@@ -175,8 +168,7 @@
     
 =====================================================================*/
 
-int read_cb_mem(socket_info_t * s, u_char fn, int space,
-		u_int addr, u_int len, void *ptr)
+int read_cb_mem(socket_info_t * s, int space, u_int addr, u_int len, void *ptr)
 {
 	struct pci_dev *dev;
 	struct resource *res;
@@ -186,14 +178,14 @@
 	if (!s->cb_config)
 		goto fail;
 
-	dev = &s->cb_config[fn].dev;
+	dev = &s->cb_config[0].dev;
 
 	/* Config space? */
 	if (space == 0) {
 		if (addr + len > 0x100)
 			goto fail;
 		for (; len; addr++, ptr++, len--)
-			pci_readb(dev, addr, (u_char *) ptr);
+			pci_read_config_byte(dev, addr, ptr);
 		return 0;
 	}
 
@@ -201,7 +193,7 @@
 	if (!res->flags)
 		goto fail;
 
-	if (cb_setup_cis_mem(s, dev, res) != 0)
+	if (cb_setup_cis_mem(s, res) != 0)
 		goto fail;
 
 	if (space == 7) {
@@ -232,29 +224,24 @@
 int cb_alloc(socket_info_t * s)
 {
 	struct pci_bus *bus;
-	struct pci_dev tmp;
 	u_short vend, v, dev;
 	u_char i, hdr, fn;
 	cb_config_t *c;
 	int irq;
 
 	bus = s->cap.cb_dev->subordinate;
-	memset(&tmp, 0, sizeof(tmp));
-	tmp.bus = bus;
-	tmp.sysdata = bus->sysdata;
-	tmp.devfn = 0;
 
-	pci_readw(&tmp, PCI_VENDOR_ID, &vend);
-	pci_readw(&tmp, PCI_DEVICE_ID, &dev);
+	pci_bus_read_config_word(bus, 0, PCI_VENDOR_ID, &vend);
+	pci_bus_read_config_word(bus, 0, PCI_DEVICE_ID, &dev);
 	printk(KERN_INFO "cs: cb_alloc(bus %d): vendor 0x%04x, "
 	       "device 0x%04x\n", bus->number, vend, dev);
 
-	pci_readb(&tmp, PCI_HEADER_TYPE, &hdr);
+	pci_bus_read_config_byte(bus, 0, PCI_HEADER_TYPE, &hdr);
 	fn = 1;
 	if (hdr & 0x80) {
 		do {
-			tmp.devfn = fn;
-			if (pci_readw(&tmp, PCI_VENDOR_ID, &v) || !v || v == 0xffff)
+			if (pci_bus_read_config_word(bus, fn, PCI_VENDOR_ID, &v) ||
+			    !v || v == 0xffff)
 				break;
 			fn++;
 		} while (fn < 8);
@@ -276,10 +263,10 @@
 		dev->sysdata = bus->sysdata;
 		dev->dev.parent = bus->dev;
 		dev->dev.bus = &pci_bus_type;
-
 		dev->devfn = i;
-		dev->vendor = vend;
-		pci_readw(dev, PCI_DEVICE_ID, &dev->device);
+
+		pci_read_config_word(dev, PCI_VENDOR_ID, &dev->vendor);
+		pci_read_config_word(dev, PCI_DEVICE_ID, &dev->device);
 		dev->hdr_type = hdr & 0x7f;
 		dev->dma_mask = 0xffffffff;
 		dev->dev.dma_mask = &dev->dma_mask;
@@ -296,7 +283,7 @@
 		}
 
 		/* Does this function have an interrupt at all? */
-		pci_readb(dev, PCI_INTERRUPT_PIN, &irq_pin);
+		pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &irq_pin);
 		if (irq_pin)
 			dev->irq = irq;
 		
@@ -306,7 +293,7 @@
 			continue;
 
 		if (irq_pin)
-			pci_writeb(dev, PCI_INTERRUPT_LINE, irq);
+			pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
 		
 		device_register(&dev->dev);
 		pci_insert_device(dev, bus);
@@ -335,38 +322,6 @@
 
 /*=====================================================================
 
-    cb_config() has the job of allocating all system resources that
-    a Cardbus card requires.  Rather than using the CIS (which seems
-    to not always be present), it treats the card as an ordinary PCI
-    device, and probes the base address registers to determine each
-    function's IO and memory space needs.
-
-    It is called from the RequestIO card service.
-    
-======================================================================*/
-
-int cb_config(socket_info_t * s)
-{
-	return CS_SUCCESS;
-}
-
-/*======================================================================
-
-    cb_release() releases all the system resources (IO and memory
-    space, and interrupt) committed for a Cardbus card by a prior call
-    to cb_config().
-
-    It is called from the ReleaseIO() service.
-    
-======================================================================*/
-
-void cb_release(socket_info_t * s)
-{
-	DEBUG(0, "cs: cb_release(bus %d)\n", s->cap.cb_dev->subordinate->number);
-}
-
-/*=====================================================================
-
     cb_enable() has the job of configuring a socket for a Cardbus
     card, and initializing the card's PCI configuration registers.
 
@@ -393,15 +348,17 @@
 	/* Set up PCI interrupt and command registers */
 	for (i = 0; i < s->functions; i++) {
 		dev = &s->cb_config[i].dev;
-		pci_writeb(dev, PCI_COMMAND, PCI_COMMAND_MASTER |
-			   PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
-		pci_writeb(dev, PCI_CACHE_LINE_SIZE, L1_CACHE_BYTES / 4);
+		pci_write_config_byte(dev, PCI_COMMAND, PCI_COMMAND_MASTER |
+				      PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
+		pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
+				      L1_CACHE_BYTES / 4);
 	}
 
 	if (s->irq.AssignedIRQ) {
 		for (i = 0; i < s->functions; i++) {
 			dev = &s->cb_config[i].dev;
-			pci_writeb(dev, PCI_INTERRUPT_LINE, s->irq.AssignedIRQ);
+			pci_write_config_byte(dev, PCI_INTERRUPT_LINE,
+					      s->irq.AssignedIRQ);
 		}
 		s->socket.io_irq = s->irq.AssignedIRQ;
 		s->ss_entry->set_socket(s->sock, &s->socket);
diff -Nru a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
--- a/drivers/pcmcia/cistpl.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/pcmcia/cistpl.c	Sun Feb 23 22:25:23 2003
@@ -327,7 +327,7 @@
     }
 #ifdef CONFIG_CARDBUS
     if (s->state & SOCKET_CARDBUS)
-	ret = read_cb_mem(s, 0, attr, addr, len, ptr);
+	ret = read_cb_mem(s, attr, addr, len, ptr);
     else
 #endif
 	ret = read_cis_mem(s, attr, addr, len, ptr);
@@ -358,7 +358,7 @@
     for (i = 0; i < s->cis_used; i++) {
 #ifdef CONFIG_CARDBUS
 	if (s->state & SOCKET_CARDBUS)
-	    read_cb_mem(s, 0, s->cis_table[i].attr, s->cis_table[i].addr,
+	    read_cb_mem(s, s->cis_table[i].attr, s->cis_table[i].addr,
 			s->cis_table[i].len, buf);
 	else
 #endif
diff -Nru a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
--- a/drivers/pcmcia/cs.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/pcmcia/cs.c	Sun Feb 23 22:25:22 2003
@@ -244,7 +244,14 @@
 
 static int register_callback(socket_info_t *s, void (*handler)(void *, unsigned int), void * info)
 {
-	return s->ss_entry->register_callback(s->sock, handler, info);
+	int error;
+
+	if (handler && !try_module_get(s->ss_entry->owner))
+		return -ENODEV;
+	error = s->ss_entry->register_callback(s->sock, handler, info);
+	if (!handler)
+		module_put(s->ss_entry->owner);
+	return error;
 }
 
 static int get_socket_status(socket_info_t *s, int *val)
@@ -330,13 +337,14 @@
 		return -ENOMEM;
 	memset(s_info, 0, cls_d->nsock * sizeof(socket_info_t));
 
+	cls_d->s_info = s_info;
+
 	/* socket initialization */
 	for (i = 0; i < cls_d->nsock; i++) {
 		socket_info_t *s = &s_info[i];
 
-		cls_d->s_info[i] = s;
 		s->ss_entry = cls_d->ops;
-		s->sock = i;
+		s->sock = i + cls_d->sock_offset;
 
 		/* base address = 0, map = 0 */
 		s->cis_mem.flags = 0;
@@ -352,7 +360,7 @@
 		if (j == sockets) sockets++;
 
 		init_socket(s);
-		s->ss_entry->inquire_socket(i, &s->cap);
+		s->ss_entry->inquire_socket(s->sock, &s->cap);
 #ifdef CONFIG_PROC_FS
 		if (proc_pccard) {
 			char name[3];
@@ -1562,7 +1570,6 @@
     
 #ifdef CONFIG_CARDBUS
     if (handle->state & CLIENT_CARDBUS) {
-	cb_release(s);
 	return CS_SUCCESS;
     }
 #endif
@@ -1804,10 +1811,8 @@
 
     if (handle->state & CLIENT_CARDBUS) {
 #ifdef CONFIG_CARDBUS
-	int ret = cb_config(s);
-	if (ret == CS_SUCCESS)
-	    handle->state |= CLIENT_IO_REQ;
-	return ret;
+	handle->state |= CLIENT_IO_REQ;
+	return CS_SUCCESS;
 #else
 	return CS_UNSUPPORTED_FUNCTION;
 #endif
diff -Nru a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
--- a/drivers/pcmcia/cs_internal.h	Sun Feb 23 22:25:21 2003
+++ b/drivers/pcmcia/cs_internal.h	Sun Feb 23 22:25:21 2003
@@ -198,12 +198,9 @@
 /* In cardbus.c */
 int cb_alloc(socket_info_t *s);
 void cb_free(socket_info_t *s);
-int cb_config(socket_info_t *s);
-void cb_release(socket_info_t *s);
 void cb_enable(socket_info_t *s);
 void cb_disable(socket_info_t *s);
-int read_cb_mem(socket_info_t *s, u_char fn, int space,
-		u_int addr, u_int len, void *ptr);
+int read_cb_mem(socket_info_t *s, int space, u_int addr, u_int len, void *ptr);
 void cb_release_cis_mem(socket_info_t *s);
 
 /* In cistpl.c */
diff -Nru a/drivers/pcmcia/hd64465_ss.c b/drivers/pcmcia/hd64465_ss.c
--- a/drivers/pcmcia/hd64465_ss.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/pcmcia/hd64465_ss.c	Sun Feb 23 22:25:24 2003
@@ -394,11 +394,6 @@
     	DPRINTK("hs_register_callback(%d)\n", sock);
 	sp->handler = handler;
 	sp->handler_info = info;
-	if (handler == 0) {
-	    MOD_DEC_USE_COUNT;
-	} else {
-	    MOD_INC_USE_COUNT;
-	}
 	return 0;
 }
 
@@ -891,18 +886,19 @@
 /*============================================================*/
 
 static struct pccard_operations hs_operations = {
-	hs_init,
-	hs_suspend,
-	hs_register_callback,
-	hs_inquire_socket,
-	hs_get_status,
-	hs_get_socket,
-	hs_set_socket,
-	hs_get_io_map,
-	hs_set_io_map,
-	hs_get_mem_map,
-	hs_set_mem_map,
-	hs_proc_setup
+	.owner			= THIS_MODULE,
+	.init			= hs_init,
+	.suspend		= hs_suspend,
+	.register_callback	= hs_register_callback,
+	.inquire_socket		= hs_inquire_socket,
+	.get_status		= hs_get_status,
+	.get_socket		= hs_get_socket,
+	.set_socket		= hs_set_socket,
+	.get_io_map		= hs_get_io_map,
+	.set_io_map		= hs_set_io_map,
+	.get_mem_map		= hs_get_mem_map,
+	.set_mem_map		= hs_set_mem_map,
+	.proc_setup		= hs_proc_setup,
 };
 
 static int hs_init_socket(hs_socket_t *sp, int irq, unsigned long mem_base,
diff -Nru a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
--- a/drivers/pcmcia/i82092.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/pcmcia/i82092.c	Sun Feb 23 22:25:27 2003
@@ -55,6 +55,7 @@
 
 /* the pccard structure and its functions */
 static struct pccard_operations i82092aa_operations = {
+	.owner			= THIS_MODULE,
 	.init 		 	= i82092aa_init,
 	.suspend	   	= i82092aa_suspend,
 	.register_callback 	= i82092aa_register_callback,
@@ -465,11 +466,6 @@
 	enter("i82092aa_register_callback");
 	sockets[sock].handler = handler;
         sockets[sock].info = info;
-        if (handler == NULL) {   
-        	MOD_DEC_USE_COUNT;   
- 	} else {
-		MOD_INC_USE_COUNT;
-	}
 	leave("i82092aa_register_callback");
 	return 0;
 } /* i82092aa_register_callback */
diff -Nru a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
--- a/drivers/pcmcia/i82365.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/pcmcia/i82365.c	Sun Feb 23 22:25:26 2003
@@ -1018,11 +1018,6 @@
 {
     socket[sock].handler = handler;
     socket[sock].info = info;
-    if (handler == NULL) {
-	MOD_DEC_USE_COUNT;
-    } else {
-	MOD_INC_USE_COUNT;
-    }
     return 0;
 } /* pcic_register_callback */
 
@@ -1568,18 +1563,19 @@
 }
 
 static struct pccard_operations pcic_operations = {
-	pcic_init,
-	pcic_suspend,
-	pcic_register_callback,
-	pcic_inquire_socket,
-	pcic_get_status,
-	pcic_get_socket,
-	pcic_set_socket,
-	pcic_get_io_map,
-	pcic_set_io_map,
-	pcic_get_mem_map,
-	pcic_set_mem_map,
-	pcic_proc_setup
+	.owner			= THIS_MODULE,
+	.init			= pcic_init,
+	.suspend		= pcic_suspend,
+	.register_callback	= pcic_register_callback,
+	.inquire_socket		= pcic_inquire_socket,
+	.get_status		= pcic_get_status,
+	.get_socket		= pcic_get_socket,
+	.set_socket		= pcic_set_socket,
+	.get_io_map		= pcic_get_io_map,
+	.set_io_map		= pcic_set_io_map,
+	.get_mem_map		= pcic_get_mem_map,
+	.set_mem_map		= pcic_set_mem_map,
+	.proc_setup		= pcic_proc_setup,
 };
 
 /*====================================================================*/
diff -Nru a/drivers/pcmcia/pci_socket.c b/drivers/pcmcia/pci_socket.c
--- a/drivers/pcmcia/pci_socket.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/pcmcia/pci_socket.c	Sun Feb 23 22:25:27 2003
@@ -66,10 +66,6 @@
 
 	socket->handler = handler;
 	socket->info = info;
-	if (handler)
-		MOD_INC_USE_COUNT;
-	else
-		MOD_DEC_USE_COUNT;
 	return 0;
 }
 
@@ -154,18 +150,19 @@
 }
 
 static struct pccard_operations pci_socket_operations = {
-	pci_init_socket,
-	pci_suspend_socket,
-	pci_register_callback,
-	pci_inquire_socket,
-	pci_get_status,
-	pci_get_socket,
-	pci_set_socket,
-	pci_get_io_map,
-	pci_set_io_map,
-	pci_get_mem_map,
-	pci_set_mem_map,
-	pci_proc_setup
+	.owner			= THIS_MODULE,
+	.init			= pci_init_socket,
+	.suspend		= pci_suspend_socket,
+	.register_callback	= pci_register_callback,
+	.inquire_socket		= pci_inquire_socket,
+	.get_status		= pci_get_status,
+	.get_socket		= pci_get_socket,
+	.set_socket		= pci_set_socket,
+	.get_io_map		= pci_get_io_map,
+	.set_io_map		= pci_set_io_map,
+	.get_mem_map		= pci_get_mem_map,
+	.set_mem_map		= pci_set_mem_map,
+	.proc_setup		= pci_proc_setup,
 };
 
 static int __devinit add_pci_socket(int nr, struct pci_dev *dev, struct pci_socket_ops *ops)
@@ -174,6 +171,16 @@
 	int err;
 	
 	memset(socket, 0, sizeof(*socket));
+
+	/* prepare class_data */
+	socket->cls_d.sock_offset = nr;
+	socket->cls_d.nsock = 1; /* yenta is 1, no other low-level driver uses
+			     this yet */
+	socket->cls_d.ops = &pci_socket_operations;
+	socket->cls_d.use_bus_pm = 1;
+	dev->dev.class_data = &socket->cls_d;
+
+	/* prepare pci_socket_t */
 	socket->dev = dev;
 	socket->op = ops;
 	pci_set_drvdata(dev, socket);
@@ -189,18 +196,6 @@
 
 int cardbus_register(struct pci_dev *p_dev)
 {
-	pci_socket_t *socket = pci_get_drvdata(p_dev);
-	struct pcmcia_socket_class_data *cls_d;
-
-	if (!socket)
-		return -EINVAL;
-
-	cls_d = &socket->cls_d;
-	cls_d->nsock = 1; /* yenta is 1, no other low-level driver uses
-			     this yet */
-	cls_d->ops = &pci_socket_operations;
-	cls_d->use_bus_pm = 1;
-	p_dev->dev.class_data = cls_d;
 	return 0;
 }
 
@@ -230,14 +225,16 @@
 static int cardbus_suspend (struct pci_dev *dev, u32 state)
 {
 	pci_socket_t *socket = pci_get_drvdata(dev);
-	pcmcia_suspend_socket (socket->pcmcia_socket);
+	if (socket && socket->cls_d.s_info)
+		pcmcia_suspend_socket (socket->cls_d.s_info);
 	return 0;
 }
 
 static int cardbus_resume (struct pci_dev *dev)
 {
 	pci_socket_t *socket = pci_get_drvdata(dev);
-	pcmcia_resume_socket (socket->pcmcia_socket);
+	if (socket && socket->cls_d.s_info)
+		pcmcia_resume_socket (socket->cls_d.s_info);
 	return 0;
 }
 
diff -Nru a/drivers/pcmcia/pci_socket.h b/drivers/pcmcia/pci_socket.h
--- a/drivers/pcmcia/pci_socket.h	Sun Feb 23 22:25:22 2003
+++ b/drivers/pcmcia/pci_socket.h	Sun Feb 23 22:25:22 2003
@@ -20,7 +20,6 @@
 	socket_cap_t cap;
 	spinlock_t event_lock;
 	unsigned int events;
-	struct socket_info_t *pcmcia_socket;
 	struct work_struct tq_task;
 	struct timer_list poll_timer;
 
diff -Nru a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c
--- a/drivers/pcmcia/sa1100_generic.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/pcmcia/sa1100_generic.c	Sun Feb 23 22:25:25 2003
@@ -380,9 +380,7 @@
 
   if (handler == NULL) {
     skt->handler = NULL;
-    MOD_DEC_USE_COUNT;
   } else {
-    MOD_INC_USE_COUNT;
     skt->handler_info = info;
     skt->handler = handler;
   }
@@ -854,6 +852,7 @@
 #endif  /* defined(CONFIG_PROC_FS) */
 
 static struct pccard_operations sa1100_pcmcia_operations = {
+  .owner		= THIS_MODULE,
   .init			= sa1100_pcmcia_sock_init,
   .suspend		= sa1100_pcmcia_suspend,
   .register_callback	= sa1100_pcmcia_register_callback,
diff -Nru a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c
--- a/drivers/pcmcia/tcic.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/pcmcia/tcic.c	Sun Feb 23 22:25:24 2003
@@ -638,11 +638,6 @@
 {
     socket_table[lsock].handler = handler;
     socket_table[lsock].info = info;
-    if (handler == NULL) {
-	MOD_DEC_USE_COUNT;
-    } else {
-	MOD_INC_USE_COUNT;
-    }
     return 0;
 } /* tcic_register_callback */
 
@@ -1003,6 +998,7 @@
 }
 
 static struct pccard_operations tcic_operations = {
+	.owner		   = THIS_MODULE,
 	.init		   = tcic_init,
 	.suspend	   = tcic_suspend,
 	.register_callback = tcic_register_callback,
diff -Nru a/drivers/pnp/Makefile b/drivers/pnp/Makefile
--- a/drivers/pnp/Makefile	Sun Feb 23 22:25:21 2003
+++ b/drivers/pnp/Makefile	Sun Feb 23 22:25:21 2003
@@ -4,8 +4,7 @@
 
 pnp-card-$(CONFIG_PNP_CARD) = card.o
 
-obj-y		:= core.o driver.o resource.o interface.o quirks.o names.o system.o $(pnp-card-y)
+obj-y		:= core.o driver.o resource.o manager.o support.o interface.o quirks.o names.o system.o $(pnp-card-y)
 
 obj-$(CONFIG_PNPBIOS)		+= pnpbios/
 obj-$(CONFIG_ISAPNP)		+= isapnp/
-
diff -Nru a/drivers/pnp/base.h b/drivers/pnp/base.h
--- a/drivers/pnp/base.h	Sun Feb 23 22:25:22 2003
+++ b/drivers/pnp/base.h	Sun Feb 23 22:25:22 2003
@@ -1,9 +1,32 @@
 extern struct bus_type pnp_bus_type;
 extern spinlock_t pnp_lock;
-extern void *pnp_alloc(long size);
-extern int pnp_interface_attach_device(struct pnp_dev *dev);
-extern void pnp_name_device(struct pnp_dev *dev);
-extern void pnp_fixup_device(struct pnp_dev *dev);
-extern void pnp_free_resources(struct pnp_resources *resources);
-extern int __pnp_add_device(struct pnp_dev *dev);
-extern void __pnp_remove_device(struct pnp_dev *dev);
+void *pnp_alloc(long size);
+int pnp_interface_attach_device(struct pnp_dev *dev);
+void pnp_name_device(struct pnp_dev *dev);
+void pnp_fixup_device(struct pnp_dev *dev);
+void pnp_free_resources(struct pnp_resources *resources);
+int __pnp_add_device(struct pnp_dev *dev);
+void __pnp_remove_device(struct pnp_dev *dev);
+
+/* resource conflict types */
+#define CONFLICT_TYPE_NONE	0x0000	/* there are no conflicts, other than those in the link */
+#define CONFLICT_TYPE_RESERVED	0x0001	/* the resource requested was reserved */
+#define CONFLICT_TYPE_IN_USE	0x0002	/* there is a conflict because the resource is in use */
+#define CONFLICT_TYPE_PCI	0x0004	/* there is a conflict with a pci device */
+#define CONFLICT_TYPE_INVALID	0x0008	/* the resource requested is invalid */
+#define CONFLICT_TYPE_INTERNAL	0x0010	/* resources within the device conflict with each ohter */
+#define CONFLICT_TYPE_PNP_WARM	0x0020	/* there is a conflict with a pnp device that is active */
+#define CONFLICT_TYPE_PNP_COLD	0x0040	/* there is a conflict with a pnp device that is disabled */
+
+/* conflict search modes */
+#define SEARCH_WARM 1	/* check for conflicts with active devices */
+#define SEARCH_COLD 0	/* check for conflicts with disabled devices */
+
+struct pnp_dev * pnp_check_port_conflicts(struct pnp_dev * dev, int idx, int mode);
+int pnp_check_port(struct pnp_dev * dev, int idx);
+struct pnp_dev * pnp_check_mem_conflicts(struct pnp_dev * dev, int idx, int mode);
+int pnp_check_mem(struct pnp_dev * dev, int idx);
+struct pnp_dev * pnp_check_irq_conflicts(struct pnp_dev * dev, int idx, int mode);
+int pnp_check_irq(struct pnp_dev * dev, int idx);
+struct pnp_dev * pnp_check_dma_conflicts(struct pnp_dev * dev, int idx, int mode);
+int pnp_check_dma(struct pnp_dev * dev, int idx);
diff -Nru a/drivers/pnp/card.c b/drivers/pnp/card.c
--- a/drivers/pnp/card.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/pnp/card.c	Sun Feb 23 22:25:26 2003
@@ -22,9 +22,9 @@
 
 LIST_HEAD(pnp_cards);
 
-static const struct pnp_card_device_id * match_card(struct pnpc_driver *drv, struct pnp_card *card)
+static const struct pnp_card_id * match_card(struct pnpc_driver *drv, struct pnp_card *card)
 {
-	const struct pnp_card_device_id *drv_id = drv->id_table;
+	const struct pnp_card_id *drv_id = drv->id_table;
 	while (*drv_id->id){
 		if (compare_pnp_id(card->id,drv_id->id))
 			return drv_id;
@@ -43,8 +43,8 @@
 }
 
 struct bus_type pnpc_bus_type = {
-	name:	"pnp_card",
-	match:	card_bus_match,
+	.name	= "pnp_card",
+	.match	= card_bus_match,
 };
 
 
@@ -106,7 +106,6 @@
 		return -EINVAL;
 	sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, card->number);
 	INIT_LIST_HEAD(&card->rdevs);
-	strcpy(card->dev.name,card->name);
 	card->dev.parent = &card->protocol->dev;
 	card->dev.bus = &pnpc_bus_type;
 	card->dev.release = &pnp_release_card;
@@ -144,7 +143,6 @@
 	list_for_each_safe(pos,temp,&card->devices){
 		struct pnp_dev *dev = card_to_pnp_dev(pos);
 		pnpc_remove_device(dev);
-		__pnp_remove_device(dev);
 	}
 }
 
@@ -221,7 +219,7 @@
 	cdrv = to_pnpc_driver(card->dev.driver);
 	if (dev->active == 0) {
 		if (!(cdrv->flags & PNPC_DRIVER_DO_NOT_ACTIVATE)) {
-			if(pnp_activate_dev(dev,NULL)<0) {
+			if(pnp_activate_dev(dev)<0) {
 				pnp_device_detach(dev);
 				return NULL;
 			}
@@ -286,7 +284,7 @@
 	int error = 0;
 	struct pnpc_driver *drv = to_pnpc_driver(dev->driver);
 	struct pnp_card *card = to_pnp_card(dev);
-	const struct pnp_card_device_id *card_id = NULL;
+	const struct pnp_card_id *card_id = NULL;
 
 	pnp_dbg("pnp: match found with the PnP card '%s' and the driver '%s'", dev->bus_id,drv->name);
 
diff -Nru a/drivers/pnp/core.c b/drivers/pnp/core.c
--- a/drivers/pnp/core.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/pnp/core.c	Sun Feb 23 22:25:22 2003
@@ -104,31 +104,29 @@
 static void pnp_release_device(struct device *dmdev)
 {
 	struct pnp_dev * dev = to_pnp_dev(dmdev);
-	if (dev->res)
-		pnp_free_resources(dev->res);
+	if (dev->possible)
+		pnp_free_resources(dev->possible);
 	pnp_free_ids(dev);
 	kfree(dev);
 }
 
 int __pnp_add_device(struct pnp_dev *dev)
 {
-	int error = 0;
+	int ret;
 	pnp_name_device(dev);
 	pnp_fixup_device(dev);
-	strncpy(dev->dev.name,dev->name,DEVICE_NAME_SIZE-1);
-	dev->dev.name[DEVICE_NAME_SIZE-1] = '\0';
 	dev->dev.bus = &pnp_bus_type;
 	dev->dev.release = &pnp_release_device;
 	dev->status = PNP_READY;
-	error = device_register(&dev->dev);
-	if (error == 0){
-		spin_lock(&pnp_lock);
-		list_add_tail(&dev->global_list, &pnp_global);
-		list_add_tail(&dev->protocol_list, &dev->protocol->devices);
-		spin_unlock(&pnp_lock);
+	spin_lock(&pnp_lock);
+	list_add_tail(&dev->global_list, &pnp_global);
+	list_add_tail(&dev->protocol_list, &dev->protocol->devices);
+	spin_unlock(&pnp_lock);
+	pnp_auto_config_dev(dev);
+	ret = device_register(&dev->dev);
+	if (ret == 0)
 		pnp_interface_attach_device(dev);
-	}
-	return error;
+	return ret;
 }
 
 /*
@@ -172,7 +170,7 @@
 
 static int __init pnp_init(void)
 {
-	printk(KERN_INFO "Linux Plug and Play Support v0.94 (c) Adam Belay\n");
+	printk(KERN_INFO "Linux Plug and Play Support v0.95 (c) Adam Belay\n");
 	return bus_register(&pnp_bus_type);
 }
 
diff -Nru a/drivers/pnp/driver.c b/drivers/pnp/driver.c
--- a/drivers/pnp/driver.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/pnp/driver.c	Sun Feb 23 22:25:25 2003
@@ -95,7 +95,7 @@
 	pnp_dev = to_pnp_dev(dev);
 	pnp_drv = to_pnp_driver(dev->driver);
 
-	pnp_dbg("pnp: match found with the PnP device '%s' and the driver '%s'", dev->bus_id,pnp_drv->name);
+	pnp_dbg("match found with the PnP device '%s' and the driver '%s'", dev->bus_id,pnp_drv->name);
 
 	error = pnp_device_attach(pnp_dev);
 	if (error < 0)
@@ -103,13 +103,10 @@
 
 	if (pnp_dev->active == 0) {
 		if (!(pnp_drv->flags & PNP_DRIVER_DO_NOT_ACTIVATE)) {
-			error = pnp_activate_dev(pnp_dev, NULL);
+			error = pnp_activate_dev(pnp_dev);
 			if (error < 0)
 				return error;
 		}
-	} else {
-		if ((pnp_drv->flags & PNP_DRIVER_DO_NOT_ACTIVATE))
-			pnp_disable_dev(pnp_dev);
 	}
 	error = 0;
 	if (pnp_drv->probe && pnp_dev->active) {
diff -Nru a/drivers/pnp/interface.c b/drivers/pnp/interface.c
--- a/drivers/pnp/interface.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/pnp/interface.c	Sun Feb 23 22:25:22 2003
@@ -1,7 +1,7 @@
 /*
  * interface.c - contains everything related to the user interface
  *
- * Some code is based on isapnp_proc.c (c) Jaroslav Kysela <perex@suse.cz>
+ * Some code, especially possible resource dumping is based on isapnp_proc.c (c) Jaroslav Kysela <perex@suse.cz>
  * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
  *
  */
@@ -12,6 +12,8 @@
 #include <linux/list.h>
 #include <linux/types.h>
 #include <linux/stat.h>
+#include <linux/ctype.h>
+#include <asm/uaccess.h>
 
 #include "base.h"
 
@@ -30,18 +32,16 @@
 {
 	va_list args;
 	int res;
-	char sbuffer[512];
 
 	if (buffer->stop || buffer->error)
 		return 0;
 	va_start(args, fmt);
-	res = vsprintf(sbuffer, fmt, args);
+	res = vsnprintf(buffer->curr, buffer->len - buffer->size, fmt, args);
 	va_end(args);
 	if (buffer->size + res >= buffer->len) {
 		buffer->stop = 1;
 		return 0;
 	}
-	strcpy(buffer->curr, sbuffer);
 	buffer->curr += res;
 	buffer->size += res;
 	return res;
@@ -158,27 +158,15 @@
 	case IORESOURCE_MEM_8AND16BIT:
 		s = "8-bit&16-bit";
 		break;
+	case IORESOURCE_MEM_32BIT:
+		s = "32-bit";
+		break;
 	default:
 		s = "16-bit";
 	}
 	pnp_printf(buffer, ", %s\n", s);
 }
 
-static void pnp_print_mem32(pnp_info_buffer_t *buffer, char *space, struct pnp_mem32 *mem32)
-{
-	int first = 1, i;
-
-	pnp_printf(buffer, "%s32-bit memory ", space);
-	for (i = 0; i < 17; i++) {
-		if (first) {
-			first = 0;
-		} else {
-			pnp_printf(buffer, ":");
-		}
-		pnp_printf(buffer, "%02x", mem32->data[i]);
-	}
-}
-
 static void pnp_print_resources(pnp_info_buffer_t *buffer, char *space, struct pnp_resources *res, int dep)
 {
 	char *s;
@@ -186,7 +174,6 @@
 	struct pnp_irq *irq;
 	struct pnp_dma *dma;
 	struct pnp_mem *mem;
-	struct pnp_mem32 *mem32;
 
 	switch (res->priority) {
 	case PNP_RES_PRIORITY_PREFERRED:
@@ -211,18 +198,15 @@
 		pnp_print_dma(buffer, space, dma);
 	for (mem = res->mem; mem; mem = mem->next)
 		pnp_print_mem(buffer, space, mem);
-	for (mem32 = res->mem32; mem32; mem32 = mem32->next)
-		pnp_print_mem32(buffer, space, mem32);
 }
 
 static ssize_t pnp_show_possible_resources(struct device *dmdev, char *buf)
 {
 	struct pnp_dev *dev = to_pnp_dev(dmdev);
-	struct pnp_resources * res = dev->res;
-	int dep = 0;
-	pnp_info_buffer_t *buffer;
-
-	buffer = (pnp_info_buffer_t *) pnp_alloc(sizeof(pnp_info_buffer_t));
+	struct pnp_resources * res = dev->possible;
+	int ret, dep = 0;
+	pnp_info_buffer_t *buffer = (pnp_info_buffer_t *)
+				 pnp_alloc(sizeof(pnp_info_buffer_t));
 	if (!buffer)
 		return -ENOMEM;
 	buffer->len = PAGE_SIZE;
@@ -236,97 +220,299 @@
 		res = res->dep;
 		dep++;
 	}
-	return (buffer->curr - buf);
+	ret = (buffer->curr - buf);
+	kfree(buffer);
+	return ret;
 }
 
 static DEVICE_ATTR(possible,S_IRUGO,pnp_show_possible_resources,NULL);
 
+static void pnp_print_conflict_node(pnp_info_buffer_t *buffer, struct pnp_dev * dev)
+{
+	if (!dev)
+		return;
+	pnp_printf(buffer, "'%s'.\n", dev->dev.bus_id);
+}
+
+static void pnp_print_conflict_desc(pnp_info_buffer_t *buffer, int conflict)
+{
+	if (!conflict)
+		return;
+	pnp_printf(buffer, "  Conflict Detected: %2x - ", conflict);
+	switch (conflict) {
+	case CONFLICT_TYPE_RESERVED:
+		pnp_printf(buffer, "manually reserved.\n");
+		break;
+
+	case CONFLICT_TYPE_IN_USE:
+		pnp_printf(buffer, "currently in use.\n");
+		break;
+
+	case CONFLICT_TYPE_PCI:
+		pnp_printf(buffer, "PCI device.\n");
+		break;
+
+	case CONFLICT_TYPE_INVALID:
+		pnp_printf(buffer, "invalid.\n");
+		break;
+
+	case CONFLICT_TYPE_INTERNAL:
+		pnp_printf(buffer, "another resource on this device.\n");
+		break;
+
+	case CONFLICT_TYPE_PNP_WARM:
+		pnp_printf(buffer, "active PnP device ");
+		break;
+
+	case CONFLICT_TYPE_PNP_COLD:
+		pnp_printf(buffer, "disabled PnP device ");
+		break;
+	default:
+		pnp_printf(buffer, "Unknown conflict.\n");
+		break;
+	}
+}
+
+static void pnp_print_conflict(pnp_info_buffer_t *buffer, struct pnp_dev * dev, int idx, int type)
+{
+	struct pnp_dev * cdev, * wdev = NULL;
+	int conflict;
+	switch (type) {
+	case IORESOURCE_IO:
+		conflict = pnp_check_port(dev, idx);
+		if (conflict == CONFLICT_TYPE_PNP_WARM)
+			wdev = pnp_check_port_conflicts(dev, idx, SEARCH_WARM);
+		cdev = pnp_check_port_conflicts(dev, idx, SEARCH_COLD);
+		break;
+	case IORESOURCE_MEM:
+		conflict = pnp_check_mem(dev, idx);
+		if (conflict == CONFLICT_TYPE_PNP_WARM)
+			wdev = pnp_check_mem_conflicts(dev, idx, SEARCH_WARM);
+		cdev = pnp_check_mem_conflicts(dev, idx, SEARCH_COLD);
+		break;
+	case IORESOURCE_IRQ:
+		conflict = pnp_check_irq(dev, idx);
+		if (conflict == CONFLICT_TYPE_PNP_WARM)
+			wdev = pnp_check_irq_conflicts(dev, idx, SEARCH_WARM);
+		cdev = pnp_check_irq_conflicts(dev, idx, SEARCH_COLD);
+		break;
+	case IORESOURCE_DMA:
+		conflict = pnp_check_dma(dev, idx);
+		if (conflict == CONFLICT_TYPE_PNP_WARM)
+			wdev = pnp_check_dma_conflicts(dev, idx, SEARCH_WARM);
+		cdev = pnp_check_dma_conflicts(dev, idx, SEARCH_COLD);
+		break;
+	default:
+		return;
+	}
+
+	pnp_print_conflict_desc(buffer, conflict);
+
+	if (wdev)
+		pnp_print_conflict_node(buffer, wdev);
+
+	if (cdev) {
+		pnp_print_conflict_desc(buffer, CONFLICT_TYPE_PNP_COLD);
+		pnp_print_conflict_node(buffer, cdev);
+	}
+}
+
 static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
 {
 	struct pnp_dev *dev = to_pnp_dev(dmdev);
-	char *str = buf;
-	int i;
+	int i, ret;
+	pnp_info_buffer_t *buffer = (pnp_info_buffer_t *)
+				pnp_alloc(sizeof(pnp_info_buffer_t));
+	if (!buffer)
+		return -ENOMEM;
+	if (!dev)
+		return -EINVAL;
+	buffer->len = PAGE_SIZE;
+	buffer->buffer = buf;
+	buffer->curr = buffer->buffer;
 
-	if (!dev->active){
-		str += sprintf(str,"DISABLED\n");
-		goto done;
-	}
-	for (i = 0; i < DEVICE_COUNT_IO; i++) {
+	pnp_printf(buffer,"state = ");
+	if (dev->active)
+		pnp_printf(buffer,"active\n");
+	else
+		pnp_printf(buffer,"disabled\n");
+	for (i = 0; i < PNP_MAX_PORT; i++) {
 		if (pnp_port_valid(dev, i)) {
-			str += sprintf(str,"io");
-			str += sprintf(str," 0x%lx-0x%lx \n",
+			pnp_printf(buffer,"io");
+			pnp_printf(buffer," 0x%lx-0x%lx \n",
 						pnp_port_start(dev, i),
 						pnp_port_end(dev, i));
+			pnp_print_conflict(buffer, dev, i, IORESOURCE_IO);
 		}
 	}
-	for (i = 0; i < DEVICE_COUNT_MEM; i++) {
+	for (i = 0; i < PNP_MAX_MEM; i++) {
 		if (pnp_mem_valid(dev, i)) {
-			str += sprintf(str,"mem");
-			str += sprintf(str," 0x%lx-0x%lx \n",
+			pnp_printf(buffer,"mem");
+			pnp_printf(buffer," 0x%lx-0x%lx \n",
 						pnp_mem_start(dev, i),
 						pnp_mem_end(dev, i));
+			pnp_print_conflict(buffer, dev, i, IORESOURCE_MEM);
 		}
 	}
-	for (i = 0; i < DEVICE_COUNT_IRQ; i++) {
+	for (i = 0; i < PNP_MAX_IRQ; i++) {
 		if (pnp_irq_valid(dev, i)) {
-			str += sprintf(str,"irq");
-			str += sprintf(str," %ld \n", pnp_irq(dev, i));
+			pnp_printf(buffer,"irq");
+			pnp_printf(buffer," %ld \n", pnp_irq(dev, i));
+			pnp_print_conflict(buffer, dev, i, IORESOURCE_IRQ);
 		}
 	}
-	for (i = 0; i < DEVICE_COUNT_DMA; i++) {
+	for (i = 0; i < PNP_MAX_DMA; i++) {
 		if (pnp_dma_valid(dev, i)) {
-			str += sprintf(str,"dma");
-			str += sprintf(str," %ld \n", pnp_dma(dev, i));
+			pnp_printf(buffer,"dma");
+			pnp_printf(buffer," %ld \n", pnp_dma(dev, i));
+			pnp_print_conflict(buffer, dev, i, IORESOURCE_DMA);
 		}
 	}
-	done:
-	return (str - buf);
+	ret = (buffer->curr - buf);
+	kfree(buffer);
+	return ret;
 }
 
+extern int pnp_resolve_conflicts(struct pnp_dev *dev);
+
 static ssize_t
-pnp_set_current_resources(struct device * dmdev, const char * buf, size_t count)
+pnp_set_current_resources(struct device * dmdev, const char * ubuf, size_t count)
 {
 	struct pnp_dev *dev = to_pnp_dev(dmdev);
-	char	command[20];
-	int	num_args;
-	int	error = 0;
-	int	depnum;
+	char	*buf = (void *)ubuf;
+	int	retval = 0;
 
-	num_args = sscanf(buf,"%10s %i",command,&depnum);
-	if (!num_args)
+	while (isspace(*buf))
+		++buf;
+	if (!strnicmp(buf,"disable",7)) {
+		retval = pnp_disable_dev(dev);
 		goto done;
-	if (!strnicmp(command,"lock",4)) {
-		if (dev->active) {
-			dev->lock_resources = 1;
-		} else {
-			error = -EINVAL;
-		}
+	}
+	if (!strnicmp(buf,"activate",8)) {
+		retval = pnp_activate_dev(dev);
 		goto done;
 	}
-	if (!strnicmp(command,"unlock",6)) {
-		if (dev->lock_resources) {
-			dev->lock_resources = 0;
-		} else {
-			error = -EINVAL;
-		}
+	if (!strnicmp(buf,"reset",5)) {
+		if (!dev->active)
+			goto done;
+		retval = pnp_disable_dev(dev);
+		if (retval)
+			goto done;
+		retval = pnp_activate_dev(dev);
+		goto done;
+	}
+	if (!strnicmp(buf,"auto-config",11)) {
+		if (dev->active)
+			goto done;
+		retval = pnp_auto_config_dev(dev);
 		goto done;
 	}
-	if (!strnicmp(command,"disable",7)) {
-		error = pnp_disable_dev(dev);
+	if (!strnicmp(buf,"clear-config",12)) {
+		if (dev->active)
+			goto done;
+		spin_lock(&pnp_lock);
+		dev->config_mode = PNP_CONFIG_MANUAL;
+		pnp_init_resource_table(&dev->res);
+		if (dev->rule)
+			dev->rule->depnum = 0;
+		spin_unlock(&pnp_lock);
+		goto done;
+	}
+	if (!strnicmp(buf,"resolve",7)) {
+		retval = pnp_resolve_conflicts(dev);
 		goto done;
 	}
-	if (!strnicmp(command,"auto",4)) {
-		error = pnp_activate_dev(dev,NULL);
+	if (!strnicmp(buf,"get",3)) {
+		spin_lock(&pnp_lock);
+		if (pnp_can_read(dev))
+			dev->protocol->get(dev, &dev->res);
+		spin_unlock(&pnp_lock);
 		goto done;
 	}
-	if (!strnicmp(command,"manual",6)) {
-		if (num_args != 2)
+	if (!strnicmp(buf,"set",3)) {
+		int nport = 0, nmem = 0, nirq = 0, ndma = 0;
+		if (dev->active)
 			goto done;
-		error = pnp_raw_set_dev(dev,depnum,NULL);
+		buf += 3;
+		spin_lock(&pnp_lock);
+		dev->config_mode = PNP_CONFIG_MANUAL;
+		pnp_init_resource_table(&dev->res);
+		while (1) {
+			while (isspace(*buf))
+				++buf;
+			if (!strnicmp(buf,"io",2)) {
+				buf += 2;
+				while (isspace(*buf))
+					++buf;
+				dev->res.port_resource[nport].start = simple_strtoul(buf,&buf,0);
+				while (isspace(*buf))
+					++buf;
+				if(*buf == '-') {
+					buf += 1;
+					while (isspace(*buf))
+						++buf;
+					dev->res.port_resource[nport].end = simple_strtoul(buf,&buf,0);
+				} else
+					dev->res.port_resource[nport].end = dev->res.port_resource[nport].start;
+				dev->res.port_resource[nport].flags = IORESOURCE_IO;
+				nport++;
+				if (nport >= PNP_MAX_PORT)
+					break;
+				continue;
+			}
+			if (!strnicmp(buf,"mem",3)) {
+				buf += 3;
+				while (isspace(*buf))
+					++buf;
+				dev->res.mem_resource[nmem].start = simple_strtoul(buf,&buf,0);
+				while (isspace(*buf))
+					++buf;
+				if(*buf == '-') {
+					buf += 1;
+					while (isspace(*buf))
+						++buf;
+					dev->res.mem_resource[nmem].end = simple_strtoul(buf,&buf,0);
+				} else
+					dev->res.mem_resource[nmem].end = dev->res.mem_resource[nmem].start;
+				dev->res.mem_resource[nmem].flags = IORESOURCE_MEM;
+				nmem++;
+				if (nmem >= PNP_MAX_MEM)
+					break;
+				continue;
+			}
+			if (!strnicmp(buf,"irq",3)) {
+				buf += 3;
+				while (isspace(*buf))
+					++buf;
+				dev->res.irq_resource[nirq].start =
+				dev->res.irq_resource[nirq].end = simple_strtoul(buf,&buf,0);
+				dev->res.irq_resource[nirq].flags = IORESOURCE_IRQ;
+				nirq++;
+				if (nirq >= PNP_MAX_IRQ)
+					break;
+				continue;
+			}
+			if (!strnicmp(buf,"dma",3)) {
+				buf += 3;
+				while (isspace(*buf))
+					++buf;
+				dev->res.dma_resource[ndma].start =
+				dev->res.dma_resource[ndma].end = simple_strtoul(buf,&buf,0);
+				dev->res.dma_resource[ndma].flags = IORESOURCE_DMA;
+				ndma++;
+				if (ndma >= PNP_MAX_DMA)
+					break;
+				continue;
+			}
+			break;
+		}
+		spin_unlock(&pnp_lock);
 		goto done;
 	}
  done:
-	return error < 0 ? error : count;
+	if (retval)
+		return retval;
+	return count;
 }
 
 static DEVICE_ATTR(resources,S_IRUGO | S_IWUSR,
diff -Nru a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
--- a/drivers/pnp/isapnp/core.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/pnp/isapnp/core.c	Sun Feb 23 22:25:24 2003
@@ -101,7 +101,6 @@
 
 /* some prototypes */
 
-static int isapnp_config_prepare(struct pnp_dev *dev);
 extern struct pnp_protocol isapnp_protocol;
 
 static inline void write_data(unsigned char x)
@@ -260,7 +259,7 @@
 		 *	We cannot use NE2000 probe spaces for ISAPnP or we
 		 *	will lock up machines.
 		 */
-		if ((rdp < 0x280 || rdp >  0x380) && !check_region(rdp, 1)) 
+		if ((rdp < 0x280 || rdp >  0x380) && !check_region(rdp, 1))
 		{
 			isapnp_rdp = rdp;
 			return 0;
@@ -580,14 +579,18 @@
 						 int depnum, int size)
 {
 	unsigned char tmp[17];
-	struct pnp_mem32 *mem32;
+	struct pnp_mem *mem;
 
 	isapnp_peek(tmp, size);
-	mem32 = isapnp_alloc(sizeof(struct pnp_mem32));
-	if (!mem32)
+	mem = isapnp_alloc(sizeof(struct pnp_mem));
+	if (!mem)
 		return;
-	memcpy(mem32->data, tmp, 17);
-	pnp_add_mem32_resource(dev,depnum,mem32);
+	mem->min = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1];
+	mem->max = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5];
+	mem->align = (tmp[12] << 24) | (tmp[11] << 16) | (tmp[10] << 8) | tmp[9];
+	mem->size = (tmp[16] << 24) | (tmp[15] << 16) | (tmp[14] << 8) | tmp[13];
+	mem->flags = tmp[0];
+	pnp_add_mem_resource(dev,depnum,mem);
 }
 
 /*
@@ -597,15 +600,18 @@
 static void __init isapnp_add_fixed_mem32_resource(struct pnp_dev *dev,
 						       int depnum, int size)
 {
-	unsigned char tmp[17];
-	struct pnp_mem32 *mem32;
+	unsigned char tmp[9];
+	struct pnp_mem *mem;
 
 	isapnp_peek(tmp, size);
-	mem32 = isapnp_alloc(sizeof(struct pnp_mem32));
-	if (!mem32)
+	mem = isapnp_alloc(sizeof(struct pnp_mem));
+	if (!mem)
 		return;
-	memcpy(mem32->data, tmp, 17);
-	pnp_add_mem32_resource(dev,depnum,mem32);
+	mem->min = mem->max = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1];
+	mem->size = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5];
+	mem->align = 0;
+	mem->flags = tmp[0];
+	pnp_add_mem_resource(dev,depnum,mem);
 }
 
 /*
@@ -650,7 +656,6 @@
 		switch (type) {
 		case _STAG_LOGDEVID:
 			if (size >= 5 && size <= 6) {
-				isapnp_config_prepare(dev);
 				if ((dev = isapnp_parse_device(card, size, number++)) == NULL)
 					return 1;
 				pnp_build_resource(dev,0);
@@ -723,7 +728,7 @@
 			size = 0;
 			break;
 		case _LTAG_ANSISTR:
-			isapnp_parse_name(dev->name, sizeof(dev->name), &size);
+			isapnp_parse_name(dev->dev.name, sizeof(dev->dev.name), &size);
 			break;
 		case _LTAG_UNICODESTR:
 			/* silently ignore */
@@ -738,7 +743,7 @@
 			size = 0;
 			break;
 		case _LTAG_FIXEDMEM32RANGE:
-			if (size != 17)
+			if (size != 9)
 				goto __skip;
 			isapnp_add_fixed_mem32_resource(dev, depnum, size);
 			size = 0;
@@ -746,7 +751,6 @@
 		case _STAG_END:
 			if (size > 0)
 				isapnp_skip_bytes(size);
-			isapnp_config_prepare(dev);
 			return 1;
 		default:
 			printk(KERN_ERR "isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n", type, dev->number, card->number);
@@ -755,14 +759,13 @@
 	      	if (size > 0)
 		      	isapnp_skip_bytes(size);
 	}
-	isapnp_config_prepare(dev);
 	return 0;
 }
 
 /*
  *  Parse resource map for ISA PnP card.
  */
- 
+
 static void __init isapnp_parse_resource_map(struct pnp_card *card)
 {
 	unsigned char type, tmp[17];
@@ -790,7 +793,7 @@
 		case _STAG_VENDOR:
 			break;
 		case _LTAG_ANSISTR:
-			isapnp_parse_name(card->name, sizeof(card->name), &size);
+			isapnp_parse_name(card->dev.name, sizeof(card->dev.name), &size);
 			break;
 		case _LTAG_UNICODESTR:
 			/* silently ignore */
@@ -819,7 +822,7 @@
 {
 	int i, j;
 	unsigned char checksum = 0x6a, bit, b;
-	
+
 	for (i = 0; i < 8; i++) {
 		b = data[i];
 		for (j = 0; j < 8; j++) {
@@ -852,6 +855,63 @@
 	pnpc_add_id(id,card);
 }
 
+
+static int isapnp_parse_current_resources(struct pnp_dev *dev, struct pnp_resource_table * res)
+{
+	int tmp, ret;
+	struct pnp_rule_table rule;
+	if (dev->rule)
+		rule = *dev->rule;
+	else {
+		if (!pnp_generate_rule(dev,1,&rule))
+			return -EINVAL;
+	}
+
+	dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE);
+	if (dev->active) {
+		for (tmp = 0; tmp < PNP_MAX_PORT; tmp++) {
+			ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1));
+			if (!ret)
+				continue;
+			res->port_resource[tmp].start = ret;
+			if (rule.port[tmp])
+				res->port_resource[tmp].end = ret + rule.port[tmp]->size - 1;
+			else
+				res->port_resource[tmp].end = ret + 1; /* all we can do is assume 1 :-( */
+			res->port_resource[tmp].flags = IORESOURCE_IO;
+		}
+		for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) {
+			ret = isapnp_read_dword(ISAPNP_CFG_MEM + (tmp << 3));
+			if (!ret)
+				continue;
+			res->mem_resource[tmp].start = ret;
+			if (rule.mem[tmp])
+				res->mem_resource[tmp].end = ret + rule.mem[tmp]->size - 1;
+			else
+				res->mem_resource[tmp].end = ret + 1; /* all we can do is assume 1 :-( */
+			res->mem_resource[tmp].flags = IORESOURCE_MEM;
+		}
+		for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) {
+			ret = (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >> 8);
+			if (!ret)
+				continue;
+			res->irq_resource[tmp].start = res->irq_resource[tmp].end = ret;
+			res->irq_resource[tmp].flags = IORESOURCE_IRQ;
+		}
+		for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) {
+			ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp);
+			if (ret == 4)
+				continue;
+			if (rule.dma[tmp]) { /* some isapnp systems forget to set this to 4 so we have to check */
+				res->dma_resource[tmp].start = res->dma_resource[tmp].end = ret;
+				res->dma_resource[tmp].flags = IORESOURCE_DMA;
+			}
+		}
+	}
+	return 0;
+}
+
+
 /*
  *  Build device list for all present ISA PnP devices.
  */
@@ -861,6 +921,7 @@
 	int csn;
 	unsigned char header[9], checksum;
 	struct pnp_card *card;
+	struct pnp_dev *dev;
 
 	isapnp_wait();
 	isapnp_key();
@@ -893,8 +954,17 @@
 			printk(KERN_ERR "isapnp: checksum for device %i is not valid (0x%x)\n", csn, isapnp_checksum_value);
 		card->checksum = isapnp_checksum_value;
 		card->protocol = &isapnp_protocol;
+
+		/* read the current resource data */
+		card_for_each_dev(card,dev) {
+			isapnp_device(dev->number);
+		pnp_init_resource_table(&dev->res);
+			isapnp_parse_current_resources(dev, &dev->res);
+		}
+
 		pnpc_add_card(card);
 	}
+	isapnp_wait();
 	return 0;
 }
 
@@ -948,39 +1018,6 @@
 	return 0;
 }
 
-static int isapnp_config_prepare(struct pnp_dev *dev)
-{
-	int idx;
-	if (dev == NULL)
-		return -EINVAL;
-	if (dev->active || dev->lock_resources)
-		return -EBUSY;
-	for (idx = 0; idx < DEVICE_COUNT_IRQ; idx++) {
-		dev->irq_resource[idx].name = NULL;
-		dev->irq_resource[idx].start = -1;
-		dev->irq_resource[idx].end = -1;
-		dev->irq_resource[idx].flags = IORESOURCE_IRQ|IORESOURCE_UNSET;
-	}
-	for (idx = 0; idx < DEVICE_COUNT_DMA; idx++) {
-		dev->dma_resource[idx].name = NULL;
-		dev->dma_resource[idx].start = -1;
-		dev->dma_resource[idx].end = -1;
-		dev->dma_resource[idx].flags = IORESOURCE_DMA|IORESOURCE_UNSET;
-	}
-	for (idx = 0; idx < DEVICE_COUNT_IO; idx++) {
-		dev->io_resource[idx].name = NULL;
-		dev->io_resource[idx].start = 0;
-		dev->io_resource[idx].end = 0;
-		dev->io_resource[idx].flags = IORESOURCE_IO|IORESOURCE_UNSET;
-	}
-	for (idx = 0; idx < DEVICE_COUNT_MEM; idx++) {
-		dev->mem_resource[idx].name = NULL;
-		dev->mem_resource[idx].start = 0;
-		dev->mem_resource[idx].end = 0;
-		dev->mem_resource[idx].flags = IORESOURCE_MEM|IORESOURCE_UNSET;
-	}
-	return 0;
-}
 
 /*
  *  Inititialization.
@@ -999,44 +1036,35 @@
 EXPORT_SYMBOL(isapnp_wake);
 EXPORT_SYMBOL(isapnp_device);
 
-static int isapnp_get_resources(struct pnp_dev *dev)
+static int isapnp_get_resources(struct pnp_dev *dev, struct pnp_resource_table * res)
 {
-	/* We don't need to do anything but this, the rest is taken care of */
-	if (pnp_port_valid(dev, 0) == 0 &&
-	    pnp_mem_valid(dev, 0) == 0 &&
-	    pnp_irq_valid(dev, 0) == 0 &&
-	    pnp_dma_valid(dev, 0) == 0)
-		dev->active = 0;
-	else
-		dev->active = 1;
-	return 0;
+	int ret;
+	pnp_init_resource_table(res);
+	isapnp_cfg_begin(dev->card->number, dev->number);
+	ret = isapnp_parse_current_resources(dev, res);
+	isapnp_cfg_end();
+	return ret;
 }
 
-static int isapnp_set_resources(struct pnp_dev *dev, struct pnp_cfg *cfg)
+static int isapnp_set_resources(struct pnp_dev *dev, struct pnp_resource_table * res)
 {
 	int tmp;
-      	isapnp_cfg_begin(dev->card->number, dev->number);
+
+	isapnp_cfg_begin(dev->card->number, dev->number);
 	dev->active = 1;
-	dev->irq_resource[0] = cfg->request.irq_resource[0];
-	dev->irq_resource[1] = cfg->request.irq_resource[1];
-	dev->dma_resource[0] = cfg->request.dma_resource[0];
-	dev->dma_resource[1] = cfg->request.dma_resource[1];
-	for (tmp = 0; tmp < DEVICE_COUNT_IO; tmp++)
-		dev->io_resource[tmp] = cfg->request.io_resource[tmp];
-	for (tmp = 0; tmp < DEVICE_COUNT_MEM; tmp++)
-		dev->mem_resource[tmp] = cfg->request.mem_resource[tmp];
-	for (tmp = 0; tmp < 8 && pnp_port_valid(dev, tmp); tmp++)
-		isapnp_write_word(ISAPNP_CFG_PORT+(tmp<<1), pnp_port_start(dev, tmp));
-	for (tmp = 0; tmp < 2 && pnp_irq_valid(dev, tmp); tmp++) {
-		int irq = pnp_irq(dev, tmp);
+	for (tmp = 0; tmp < PNP_MAX_PORT && res->port_resource[tmp].flags & IORESOURCE_IO; tmp++)
+		isapnp_write_word(ISAPNP_CFG_PORT+(tmp<<1), res->port_resource[tmp].start);
+	for (tmp = 0; tmp < PNP_MAX_IRQ && res->irq_resource[tmp].flags & IORESOURCE_IRQ; tmp++) {
+		int irq = res->irq_resource[tmp].start;
 		if (irq == 2)
 			irq = 9;
 		isapnp_write_byte(ISAPNP_CFG_IRQ+(tmp<<1), irq);
 	}
-	for (tmp = 0; tmp < 2 && pnp_dma_valid(dev, tmp); tmp++)
-		isapnp_write_byte(ISAPNP_CFG_DMA+tmp, pnp_dma(dev, tmp));
-	for (tmp = 0; tmp < 4 && pnp_mem_valid(dev, tmp); tmp++)
-		isapnp_write_word(ISAPNP_CFG_MEM+(tmp<<2), (pnp_mem_start(dev, tmp) >> 8) & 0xffff);
+	for (tmp = 0; tmp < PNP_MAX_DMA && res->dma_resource[tmp].flags & IORESOURCE_DMA; tmp++)
+		isapnp_write_byte(ISAPNP_CFG_DMA+tmp, res->dma_resource[tmp].start);
+	for (tmp = 0; tmp < PNP_MAX_MEM && res->mem_resource[tmp].flags & IORESOURCE_MEM; tmp++)
+		isapnp_write_word(ISAPNP_CFG_MEM+(tmp<<2), (res->mem_resource[tmp].start >> 8) & 0xffff);
+	/* FIXME: We aren't handling 32bit mems properly here */
 	isapnp_activate(dev->number);
 	isapnp_cfg_end();
 	return 0;
@@ -1046,7 +1074,7 @@
 {
 	if (!dev || !dev->active)
 		return -EINVAL;
-      	isapnp_cfg_begin(dev->card->number, dev->number);
+	isapnp_cfg_begin(dev->card->number, dev->number);
 	isapnp_deactivate(dev->number);
 	dev->active = 0;
 	isapnp_cfg_end();
@@ -1127,11 +1155,11 @@
 	protocol_for_each_card(&isapnp_protocol,card) {
 		cards++;
 		if (isapnp_verbose) {
-			printk(KERN_INFO "isapnp: Card '%s'\n", card->name[0]?card->name:"Unknown");
+			printk(KERN_INFO "isapnp: Card '%s'\n", card->dev.name[0]?card->dev.name:"Unknown");
 			if (isapnp_verbose < 2)
 				continue;
-			pnp_card_for_each_dev(card,dev) {
-				printk(KERN_INFO "isapnp:   Device '%s'\n", dev->name[0]?dev->name:"Unknown");
+			card_for_each_dev(card,dev) {
+				printk(KERN_INFO "isapnp:   Device '%s'\n", dev->dev.name[0]?dev->dev.name:"Unknown");
 			}
 		}
 	}
@@ -1145,7 +1173,7 @@
 	return 0;
 }
 
-subsys_initcall(isapnp_init);
+device_initcall(isapnp_init);
 
 /* format is: noisapnp */
 
diff -Nru a/drivers/pnp/manager.c b/drivers/pnp/manager.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/pnp/manager.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,721 @@
+/*
+ * manager.c - Resource Management, Conflict Resolution, Activation and Disabling of Devices
+ *
+ * Copyright 2003 Adam Belay <ambx1@neo.rr.com>
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/errno.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+
+#ifdef CONFIG_PNP_DEBUG
+	#define DEBUG
+#else
+	#undef DEBUG
+#endif
+
+#include <linux/pnp.h>
+#include "base.h"
+
+
+int pnp_max_moves = 4;
+
+
+static int pnp_next_port(struct pnp_dev * dev, int idx)
+{
+	struct pnp_port *port;
+	unsigned long *start, *end, *flags;
+	if (!dev || idx < 0 || idx >= PNP_MAX_PORT)
+		return 0;
+	port = dev->rule->port[idx];
+	if (!port)
+		return 1;
+
+	start = &dev->res.port_resource[idx].start;
+	end = &dev->res.port_resource[idx].end;
+	flags = &dev->res.port_resource[idx].flags;
+
+	/* set the initial values if this is the first time */
+	if (*start == 0) {
+		*start = port->min;
+		*end = *start + port->size - 1;
+		*flags = port->flags | IORESOURCE_IO;
+		if (!pnp_check_port(dev, idx))
+			return 1;
+	}
+
+	/* run through until pnp_check_port is happy */
+	do {
+		*start += port->align;
+		*end = *start + port->size - 1;
+		if (*start > port->max || !port->align)
+			return 0;
+	} while (pnp_check_port(dev, idx));
+	return 1;
+}
+
+static int pnp_next_mem(struct pnp_dev * dev, int idx)
+{
+	struct pnp_mem *mem;
+	unsigned long *start, *end, *flags;
+	if (!dev || idx < 0 || idx >= PNP_MAX_MEM)
+		return 0;
+	mem = dev->rule->mem[idx];
+	if (!mem)
+		return 1;
+
+	start = &dev->res.mem_resource[idx].start;
+	end = &dev->res.mem_resource[idx].end;
+	flags = &dev->res.mem_resource[idx].flags;
+
+	/* set the initial values if this is the first time */
+	if (*start == 0) {
+		*start = mem->min;
+		*end = *start + mem->size -1;
+		*flags = mem->flags | IORESOURCE_MEM;
+		if (!(mem->flags & IORESOURCE_MEM_WRITEABLE))
+			*flags |= IORESOURCE_READONLY;
+		if (mem->flags & IORESOURCE_MEM_CACHEABLE)
+			*flags |= IORESOURCE_CACHEABLE;
+		if (mem->flags & IORESOURCE_MEM_RANGELENGTH)
+			*flags |= IORESOURCE_RANGELENGTH;
+		if (mem->flags & IORESOURCE_MEM_SHADOWABLE)
+			*flags |= IORESOURCE_SHADOWABLE;
+		if (!pnp_check_mem(dev, idx))
+			return 1;
+	}
+
+	/* run through until pnp_check_mem is happy */
+	do {
+		*start += mem->align;
+		*end = *start + mem->size - 1;
+		if (*start > mem->max || !mem->align)
+			return 0;
+	} while (pnp_check_mem(dev, idx));
+	return 1;
+}
+
+static int pnp_next_irq(struct pnp_dev * dev, int idx)
+{
+	struct pnp_irq *irq;
+	unsigned long *start, *end, *flags;
+	int i, mask;
+	if (!dev || idx < 0 || idx >= PNP_MAX_IRQ)
+		return 0;
+	irq = dev->rule->irq[idx];
+	if (!irq)
+		return 1;
+
+	start = &dev->res.irq_resource[idx].start;
+	end = &dev->res.irq_resource[idx].end;
+	flags = &dev->res.irq_resource[idx].flags;
+
+	/* set the initial values if this is the first time */
+	if (*start == -1) {
+		*start = *end = 0;
+		*flags = irq->flags | IORESOURCE_IRQ;
+		if (!pnp_check_irq(dev, idx))
+			return 1;
+	}
+
+	mask = irq->map;
+	for (i = *start + 1; i < 16; i++)
+	{
+		if(mask>>i & 0x01) {
+			*start = *end = i;
+			if(!pnp_check_irq(dev, idx))
+				return 1;
+		}
+	}
+	return 0;
+}
+
+static int pnp_next_dma(struct pnp_dev * dev, int idx)
+{
+	struct pnp_dma *dma;
+	unsigned long *start, *end, *flags;
+	int i, mask;
+	if (!dev || idx < 0 || idx >= PNP_MAX_DMA)
+		return -EINVAL;
+	dma = dev->rule->dma[idx];
+	if (!dma)
+		return 1;
+
+	start = &dev->res.dma_resource[idx].start;
+	end = &dev->res.dma_resource[idx].end;
+	flags = &dev->res.dma_resource[idx].flags;
+
+	/* set the initial values if this is the first time */
+	if (*start == -1) {
+		*start = *end = 0;
+		*flags = dma->flags | IORESOURCE_DMA;
+		if (!pnp_check_dma(dev, idx))
+			return 1;
+	}
+
+	mask = dma->map;
+	for (i = *start + 1; i < 8; i++)
+	{
+		if(mask>>i & 0x01) {
+			*start = *end = i;
+			if(!pnp_check_dma(dev, idx))
+				return 1;
+		}
+	}
+	return 0;
+}
+
+static int pnp_next_rule(struct pnp_dev *dev)
+{
+	int depnum = dev->rule->depnum;
+        int max = pnp_get_max_depnum(dev);
+	int priority = PNP_RES_PRIORITY_PREFERRED;
+
+	if (depnum < 0)
+		return 0;
+
+	if (max == 0) {
+		if (pnp_generate_rule(dev, 0, dev->rule)) {
+			dev->rule->depnum = -1;
+			return 1;
+		}
+	}
+
+	if(depnum > 0) {
+		struct pnp_resources * res = pnp_find_resources(dev, depnum);
+		priority = res->priority;
+	}
+
+	for (; priority <= PNP_RES_PRIORITY_FUNCTIONAL; priority++, depnum = 0) {
+		depnum += 1;
+		for (; depnum <= max; depnum++) {
+			struct pnp_resources * res = pnp_find_resources(dev, depnum);
+			if (res->priority == priority) {
+				if(pnp_generate_rule(dev, depnum, dev->rule)) {
+					dev->rule->depnum = depnum;
+					return 1;
+				}
+			}
+		}
+	}
+	return 0;
+}
+
+struct pnp_change {
+	struct list_head change_list;
+	struct list_head changes;
+	struct pnp_resource_table res_bak;
+	struct pnp_rule_table rule_bak;
+	struct pnp_dev * dev;
+};
+
+static void pnp_free_changes(struct pnp_change * parent)
+{
+	struct list_head * pos, * temp;
+	list_for_each_safe(pos, temp, &parent->changes) {
+		struct pnp_change * change = list_entry(pos, struct pnp_change, change_list);
+		list_del(&change->change_list);
+		kfree(change);
+	}
+}
+
+static void pnp_undo_changes(struct pnp_change * parent)
+{
+	struct list_head * pos, * temp;
+	list_for_each_safe(pos, temp, &parent->changes) {
+		struct pnp_change * change = list_entry(pos, struct pnp_change, change_list);
+		*change->dev->rule = change->rule_bak;
+		change->dev->res = change->res_bak;
+		list_del(&change->change_list);
+		kfree(change);
+	}
+}
+
+static struct pnp_change * pnp_add_change(struct pnp_change * parent, struct pnp_dev * dev)
+{
+	struct pnp_change * change = pnp_alloc(sizeof(struct pnp_change));
+	if (!change)
+		return NULL;
+	change->res_bak = dev->res;
+	change->rule_bak = *dev->rule;
+	change->dev = dev;
+	INIT_LIST_HEAD(&change->changes);
+	if (parent)
+		list_add(&change->change_list, &parent->changes);
+	return change;
+}
+
+static void pnp_commit_changes(struct pnp_change * parent, struct pnp_change * change)
+{
+	/* check if it's the root change */
+	if (!parent)
+		return;
+	if (!list_empty(&change->changes))
+		list_splice_init(&change->changes, &parent->changes);
+}
+
+static int pnp_next_config(struct pnp_dev * dev, int move, struct pnp_change * parent);
+
+static int pnp_next_request(struct pnp_dev * dev, int move, struct pnp_change * parent, struct pnp_change * change)
+{
+	int i;
+	struct pnp_dev * cdev;
+
+	for (i = 0; i < PNP_MAX_PORT; i++) {
+		if (dev->res.port_resource[i].start == 0
+		 || pnp_check_port_conflicts(dev,i,SEARCH_WARM)) {
+			if (!pnp_next_port(dev,i))
+				return 0;
+		}
+		do {
+			cdev = pnp_check_port_conflicts(dev,i,SEARCH_COLD);
+			if (cdev && (!move || !pnp_next_config(cdev,move,change))) {
+				pnp_undo_changes(change);
+				if (!pnp_next_port(dev,i))
+					return 0;
+			}
+		} while (cdev);
+		pnp_commit_changes(parent, change);
+	}
+	for (i = 0; i < PNP_MAX_MEM; i++) {
+		if (dev->res.mem_resource[i].start == 0
+		 || pnp_check_mem_conflicts(dev,i,SEARCH_WARM)) {
+			if (!pnp_next_mem(dev,i))
+				return 0;
+		}
+		do {
+			cdev = pnp_check_mem_conflicts(dev,i,SEARCH_COLD);
+			if (cdev && (!move || !pnp_next_config(cdev,move,change))) {
+				pnp_undo_changes(change);
+				if (!pnp_next_mem(dev,i))
+					return 0;
+			}
+		} while (cdev);
+		pnp_commit_changes(parent, change);
+	}
+	for (i = 0; i < PNP_MAX_IRQ; i++) {
+		if (dev->res.irq_resource[i].start == -1
+		 || pnp_check_irq_conflicts(dev,i,SEARCH_WARM)) {
+			if (!pnp_next_irq(dev,i))
+				return 0;
+		}
+		do {
+			cdev = pnp_check_irq_conflicts(dev,i,SEARCH_COLD);
+			if (cdev && (!move || !pnp_next_config(cdev,move,change))) {
+				pnp_undo_changes(change);
+				if (!pnp_next_irq(dev,i))
+					return 0;
+			}
+		} while (cdev);
+		pnp_commit_changes(parent, change);
+	}
+	for (i = 0; i < PNP_MAX_DMA; i++) {
+		if (dev->res.dma_resource[i].start == -1
+		 || pnp_check_dma_conflicts(dev,i,SEARCH_WARM)) {
+			if (!pnp_next_dma(dev,i))
+				return 0;
+		}
+		do {
+			cdev = pnp_check_dma_conflicts(dev,i,SEARCH_COLD);
+			if (cdev && (!move || !pnp_next_config(cdev,move,change))) {
+				pnp_undo_changes(change);
+				if (!pnp_next_dma(dev,i))
+					return 0;
+			}
+		} while (cdev);
+		pnp_commit_changes(parent, change);
+	}
+	return 1;
+}
+
+static int pnp_next_config(struct pnp_dev * dev, int move, struct pnp_change * parent)
+{
+	struct pnp_change * change;
+	move--;
+	if (!dev->rule)
+		return 0;
+	change = pnp_add_change(parent,dev);
+	if (!change)
+		return 0;
+	if (!pnp_can_configure(dev))
+		goto fail;
+	if (!dev->rule->depnum) {
+		if (!pnp_next_rule(dev))
+			goto fail;
+	}
+	while (!pnp_next_request(dev, move, parent, change)) {
+		if(!pnp_next_rule(dev))
+			goto fail;
+		pnp_init_resource_table(&dev->res);
+	}
+	if (!parent) {
+		pnp_free_changes(change);
+		kfree(change);
+	}
+	return 1;
+
+fail:
+	if (!parent)
+		kfree(change);
+	return 0;
+}
+
+/* this advanced algorithm will shuffle other configs to make room and ensure that the most possible devices have configs */
+static int pnp_advanced_config(struct pnp_dev * dev)
+{
+	int move;
+	/* if the device cannot be configured skip it */
+	if (!pnp_can_configure(dev))
+		return 1;
+	if (!dev->rule) {
+		dev->rule = pnp_alloc(sizeof(struct pnp_rule_table));
+		if (!dev->rule)
+			return -ENOMEM;
+	}
+
+	spin_lock(&pnp_lock);
+	for (move = 1; move <= pnp_max_moves; move++) {
+		dev->rule->depnum = 0;
+		pnp_init_resource_table(&dev->res);
+		if (pnp_next_config(dev,move,NULL)) {
+			spin_unlock(&pnp_lock);
+			return 1;
+		}
+	}
+
+	pnp_init_resource_table(&dev->res);
+	dev->rule->depnum = 0;
+	spin_unlock(&pnp_lock);
+	pnp_err("res: Unable to resolve resource conflicts for the device '%s', some devices may not be usable.", dev->dev.bus_id);
+	return 0;
+}
+
+int pnp_resolve_conflicts(struct pnp_dev *dev)
+{
+	int i;
+	struct pnp_dev * cdev;
+
+	for (i = 0; i < PNP_MAX_PORT; i++)
+	{
+		do {
+			cdev = pnp_check_port_conflicts(dev,i,SEARCH_COLD);
+			if (cdev)
+				pnp_advanced_config(cdev);
+		} while (cdev);
+	}
+	for (i = 0; i < PNP_MAX_MEM; i++)
+	{
+		do {
+			cdev = pnp_check_mem_conflicts(dev,i,SEARCH_COLD);
+			if (cdev)
+				pnp_advanced_config(cdev);
+		} while (cdev);
+	}
+	for (i = 0; i < PNP_MAX_IRQ; i++)
+	{
+		do {
+			cdev = pnp_check_irq_conflicts(dev,i,SEARCH_COLD);
+			if (cdev)
+				pnp_advanced_config(cdev);
+		} while (cdev);
+	}
+	for (i = 0; i < PNP_MAX_DMA; i++)
+	{
+		do {
+			cdev = pnp_check_dma_conflicts(dev,i,SEARCH_COLD);
+			if (cdev)
+				pnp_advanced_config(cdev);
+		} while (cdev);
+	}
+	return 1;
+}
+
+/* this is a much faster algorithm but it may not leave resources for other devices to use */
+static int pnp_simple_config(struct pnp_dev * dev)
+{
+	int i;
+	spin_lock(&pnp_lock);
+	if (dev->active) {
+		spin_unlock(&pnp_lock);
+		return 1;
+	}
+	if (!dev->rule) {
+		dev->rule = pnp_alloc(sizeof(struct pnp_rule_table));
+		if (!dev->rule) {
+			spin_unlock(&pnp_lock);
+			return -ENOMEM;
+		}
+	}
+	dev->rule->depnum = 0;
+	pnp_init_resource_table(&dev->res);
+	while (pnp_next_rule(dev)) {
+		for (i = 0; i < PNP_MAX_PORT; i++) {
+			if (!pnp_next_port(dev,i))
+				continue;
+		}
+		for (i = 0; i < PNP_MAX_MEM; i++) {
+			if (!pnp_next_mem(dev,i))
+				continue;
+		}
+		for (i = 0; i < PNP_MAX_IRQ; i++) {
+			if (!pnp_next_irq(dev,i))
+				continue;
+		}
+		for (i = 0; i < PNP_MAX_DMA; i++) {
+			if (!pnp_next_dma(dev,i))
+				continue;
+		}
+		goto done;
+	}
+	pnp_init_resource_table(&dev->res);
+	dev->rule->depnum = 0;
+	spin_unlock(&pnp_lock);
+	return 0;
+
+done:
+	pnp_resolve_conflicts(dev);	/* this is required or we will break the advanced configs */
+	return 1;
+}
+
+static int pnp_compare_resources(struct pnp_resource_table * resa, struct pnp_resource_table * resb)
+{
+	int idx;
+	for (idx = 0; idx < PNP_MAX_IRQ; idx++) {
+		if (resa->irq_resource[idx].start != resb->irq_resource[idx].start)
+			return 1;
+	}
+	for (idx = 0; idx < PNP_MAX_DMA; idx++) {
+		if (resa->dma_resource[idx].start != resb->dma_resource[idx].start)
+			return 1;
+	}
+	for (idx = 0; idx < PNP_MAX_PORT; idx++) {
+		if (resa->port_resource[idx].start != resb->port_resource[idx].start)
+			return 1;
+		if (resa->port_resource[idx].end != resb->port_resource[idx].end)
+			return 1;
+	}
+	for (idx = 0; idx < PNP_MAX_MEM; idx++) {
+		if (resa->mem_resource[idx].start != resb->mem_resource[idx].start)
+			return 1;
+		if (resa->mem_resource[idx].end != resb->mem_resource[idx].end)
+			return 1;
+	}
+	return 0;
+}
+
+
+/*
+ * PnP Device Resource Management
+ */
+
+/**
+ * pnp_auto_config_dev - determines the best possible resource configuration based on available information
+ * @dev: pointer to the desired device
+ *
+ */
+
+int pnp_auto_config_dev(struct pnp_dev *dev)
+{
+	int error;
+	if(!dev)
+		return -EINVAL;
+
+	dev->config_mode = PNP_CONFIG_AUTO;
+
+	if(dev->active)
+		error = pnp_resolve_conflicts(dev);
+	else
+		error = pnp_advanced_config(dev);
+	return error;
+}
+
+/**
+ * pnp_manual_config_dev - Disables Auto Config and Manually sets the resource table
+ * @dev: pointer to the desired device
+ * @res: pointer to the new resource config
+ *
+ * This function can be used by drivers that want to manually set thier resources.
+ */
+
+int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table * res, int mode)
+{
+	int i;
+	struct pnp_resource_table * bak;
+	if (!dev || !res)
+		return -EINVAL;
+	if (dev->active)
+		return -EBUSY;
+	bak = pnp_alloc(sizeof(struct pnp_resource_table));
+	if (!bak)
+		return -ENOMEM;
+	*bak = dev->res;
+
+	spin_lock(&pnp_lock);
+	dev->res = *res;
+	if (!(mode & PNP_CONFIG_FORCE)) {
+		for (i = 0; i < PNP_MAX_PORT; i++) {
+			if(pnp_check_port(dev,i))
+				goto fail;
+		}
+		for (i = 0; i < PNP_MAX_MEM; i++) {
+			if(pnp_check_mem(dev,i))
+				goto fail;
+		}
+		for (i = 0; i < PNP_MAX_IRQ; i++) {
+			if(pnp_check_irq(dev,i))
+				goto fail;
+		}
+		for (i = 0; i < PNP_MAX_DMA; i++) {
+			if(pnp_check_dma(dev,i))
+				goto fail;
+		}
+	}
+	dev->config_mode = PNP_CONFIG_MANUAL;
+	spin_unlock(&pnp_lock);
+
+	pnp_resolve_conflicts(dev);
+	kfree(bak);
+	return 0;
+
+fail:
+	dev->res = *bak;
+	spin_unlock(&pnp_lock);
+	kfree(bak);
+	return -EINVAL;
+}
+
+/**
+ * pnp_activate_dev - activates a PnP device for use
+ * @dev: pointer to the desired device
+ *
+ * finds the best resource configuration and then informs the correct pnp protocol
+ */
+
+int pnp_activate_dev(struct pnp_dev *dev)
+{
+	if (!dev)
+		return -EINVAL;
+	if (dev->active) {
+		pnp_info("res: The PnP device '%s' is already active.", dev->dev.bus_id);
+		return -EBUSY;
+	}
+	/* If this condition is true, advanced configuration failed, we need to get this device up and running
+	 * so we use the simple config engine which ignores cold conflicts, this of course may lead to new failures */
+	if (!pnp_is_active(dev)) {
+		if (!pnp_simple_config(dev)) {
+			pnp_err("res: Unable to resolve resource conflicts for the device '%s'.", dev->dev.bus_id);
+			goto fail;
+		}
+	}
+
+	spin_lock(&pnp_lock);	/* we lock just in case the device is being configured during this call */
+	dev->active = 1;
+	spin_unlock(&pnp_lock); /* once the device is claimed active we know it won't be configured so we can unlock */
+
+	if (dev->config_mode & PNP_CONFIG_INVALID) {
+		pnp_info("res: Unable to activate the PnP device '%s' because its resource configuration is invalid.", dev->dev.bus_id);
+		goto fail;
+	}
+	if (dev->status != PNP_READY && dev->status != PNP_ATTACHED){
+		pnp_err("res: Activation failed because the PnP device '%s' is busy.", dev->dev.bus_id);
+		goto fail;
+	}
+	if (!pnp_can_write(dev)) {
+		pnp_info("res: Unable to activate the PnP device '%s' because this feature is not supported.", dev->dev.bus_id);
+		goto fail;
+	}
+	if (dev->protocol->set(dev, &dev->res)<0) {
+		pnp_err("res: The protocol '%s' reports that activating the PnP device '%s' has failed.", dev->protocol->name, dev->dev.bus_id);
+		goto fail;
+	}
+	if (pnp_can_read(dev)) {
+		struct pnp_resource_table * res = pnp_alloc(sizeof(struct pnp_resource_table));
+		if (!res)
+			goto fail;
+		dev->protocol->get(dev, res);
+		if (pnp_compare_resources(&dev->res, res)) /* if this happens we may be in big trouble but it's best just to continue */
+			pnp_err("res: The resources requested do not match those set for the PnP device '%s'.", dev->dev.bus_id);
+		kfree(res);
+	} else
+		dev->active = pnp_is_active(dev);
+	pnp_dbg("res: the device '%s' has been activated.", dev->dev.bus_id);
+	if (dev->rule) {
+		kfree(dev->rule);
+		dev->rule = NULL;
+	}
+	return 0;
+
+fail:
+	dev->active = 0; /* fixes incorrect active state */
+	return -EINVAL;
+}
+
+/**
+ * pnp_disable_dev - disables device
+ * @dev: pointer to the desired device
+ *
+ * inform the correct pnp protocol so that resources can be used by other devices
+ */
+
+int pnp_disable_dev(struct pnp_dev *dev)
+{
+        if (!dev)
+                return -EINVAL;
+	if (!dev->active) {
+		pnp_info("res: The PnP device '%s' is already disabled.", dev->dev.bus_id);
+		return -EINVAL;
+	}
+	if (dev->status != PNP_READY){
+		pnp_info("res: Disable failed becuase the PnP device '%s' is busy.", dev->dev.bus_id);
+		return -EINVAL;
+	}
+	if (!pnp_can_disable(dev)) {
+		pnp_info("res: Unable to disable the PnP device '%s' because this feature is not supported.", dev->dev.bus_id);
+		return -EINVAL;
+	}
+	if (dev->protocol->disable(dev)<0) {
+		pnp_err("res: The protocol '%s' reports that disabling the PnP device '%s' has failed.", dev->protocol->name, dev->dev.bus_id);
+		return -1;
+	}
+	dev->active = 0; /* just in case the protocol doesn't do this */
+	pnp_dbg("the device '%s' has been disabled.", dev->dev.bus_id);
+	return 0;
+}
+
+/**
+ * pnp_resource_change - change one resource
+ * @resource: pointer to resource to be changed
+ * @start: start of region
+ * @size: size of region
+ *
+ */
+
+void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size)
+{
+	if (resource == NULL)
+		return;
+	resource->flags &= ~IORESOURCE_AUTO;
+	resource->start = start;
+	resource->end = start + size - 1;
+}
+
+
+EXPORT_SYMBOL(pnp_auto_config_dev);
+EXPORT_SYMBOL(pnp_manual_config_dev);
+EXPORT_SYMBOL(pnp_activate_dev);
+EXPORT_SYMBOL(pnp_disable_dev);
+EXPORT_SYMBOL(pnp_resource_change);
+
+
+/* format is: pnp_max_moves=num */
+
+static int __init pnp_setup_max_moves(char *str)
+{
+	get_option(&str,&pnp_max_moves);
+	return 1;
+}
+
+__setup("pnp_max_moves=", pnp_setup_max_moves);
diff -Nru a/drivers/pnp/names.c b/drivers/pnp/names.c
--- a/drivers/pnp/names.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/pnp/names.c	Sun Feb 23 22:25:21 2003
@@ -30,10 +30,10 @@
 pnp_name_device(struct pnp_dev *dev)
 {
 	int i;
-	char *name = dev->name;
+	char *name = dev->dev.name;
 	for(i=0; i<sizeof(pnp_id_eisaid)/sizeof(pnp_id_eisaid[0]); i++){
 		if (compare_pnp_id(dev->id,pnp_id_eisaid[i])){
-			sprintf(name, "%s", pnp_id_names[i]);
+			snprintf(name, DEVICE_NAME_SIZE, "%s", pnp_id_names[i]);
 			return;
 		}
 	}
diff -Nru a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
--- a/drivers/pnp/pnpbios/core.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/pnp/pnpbios/core.c	Sun Feb 23 22:25:21 2003
@@ -142,11 +142,13 @@
 set_limit(cpu_gdt_table[cpu][(selname) >> 3], size); \
 } while(0)
 
+static struct desc_struct bad_bios_desc = { 0, 0x00409200 };
+
 /*
  * At some point we want to use this stack frame pointer to unwind
- * after PnP BIOS oopses. 
+ * after PnP BIOS oopses.
  */
- 
+
 u32 pnp_bios_fault_esp;
 u32 pnp_bios_fault_eip;
 u32 pnp_bios_is_utter_crap = 0;
@@ -160,6 +162,8 @@
 {
 	unsigned long flags;
 	u16 status;
+	struct desc_struct save_desc_40;
+	int cpu;
 
 	/*
 	 * PnP BIOSes are generally not terribly re-entrant.
@@ -168,6 +172,10 @@
 	if(pnp_bios_is_utter_crap)
 		return PNP_FUNCTION_NOT_SUPPORTED;
 
+	cpu = get_cpu();
+	save_desc_40 = cpu_gdt_table[cpu][0x40 / 8];
+	cpu_gdt_table[cpu][0x40 / 8] = bad_bios_desc;
+
 	/* On some boxes IRQ's during PnP BIOS calls are deadly.  */
 	spin_lock_irqsave(&pnp_bios_lock, flags);
 
@@ -207,6 +215,9 @@
 		: "memory"
 	);
 	spin_unlock_irqrestore(&pnp_bios_lock, flags);
+
+	cpu_gdt_table[cpu][0x40 / 8] = save_desc_40;
+	put_cpu();
 	
 	/* If we get here and this is set then the PnP BIOS faulted on us. */
 	if(pnp_bios_is_utter_crap)
@@ -236,6 +247,8 @@
 	void *p = kmalloc( size, f );
 	if ( p == NULL )
 		printk(KERN_ERR "PnPBIOS: kmalloc() failed\n");
+	else
+		memset(p, 0, size);
 	return p;
 }
 
@@ -664,381 +677,6 @@
 
 #endif   /* CONFIG_HOTPLUG */
 
-
-/* pnp current resource reading functions */
-
-
-static void add_irqresource(struct pnp_dev *dev, int irq)
-{
-	int i = 0;
-	while (pnp_irq_valid(dev, i) && i < DEVICE_COUNT_IRQ) i++;
-	if (i < DEVICE_COUNT_IRQ) {
-		dev->irq_resource[i].start = 
-		dev->irq_resource[i].end = (unsigned long) irq;
-		dev->irq_resource[i].flags = IORESOURCE_IRQ;  // Also clears _UNSET flag
-	}
-}
-
-static void add_dmaresource(struct pnp_dev *dev, int dma)
-{
-	int i = 0;
-	while (pnp_dma_valid(dev, i) && i < DEVICE_COUNT_DMA) i++;
-	if (i < DEVICE_COUNT_DMA) {
-		dev->dma_resource[i].start =
-		dev->dma_resource[i].end = (unsigned long) dma;
-		dev->dma_resource[i].flags = IORESOURCE_DMA;  // Also clears _UNSET flag
-	}
-}
-
-static void add_ioresource(struct pnp_dev *dev, int io, int len)
-{
-	int i = 0;
-	while (pnp_port_valid(dev, i) && i < DEVICE_COUNT_IO) i++;
-	if (i < DEVICE_COUNT_RESOURCE) {
-		dev->io_resource[i].start = (unsigned long) io;
-		dev->io_resource[i].end = (unsigned long)(io + len - 1);
-		dev->io_resource[i].flags = IORESOURCE_IO;  // Also clears _UNSET flag
-	}
-}
-
-static void add_memresource(struct pnp_dev *dev, int mem, int len)
-{
-	int i = 0;
-	while (pnp_mem_valid(dev, i) && i < DEVICE_COUNT_MEM) i++;
-	if (i < DEVICE_COUNT_RESOURCE) {
-		dev->mem_resource[i].start = (unsigned long) mem;
-		dev->mem_resource[i].end = (unsigned long)(mem + len - 1);
-		dev->mem_resource[i].flags = IORESOURCE_MEM;  // Also clears _UNSET flag
-	}
-}
-
-static unsigned char *node_current_resource_data_to_dev(struct pnp_bios_node *node, struct pnp_dev *dev)
-{
-	unsigned char *p = node->data, *lastp=NULL;
-	int i;
-
-	/*
-	 * First, set resource info to default values
-	 */
-	for (i=0;i<DEVICE_COUNT_IO;i++) {
-		dev->io_resource[i].start = 0;
-		dev->io_resource[i].end = 0;
-		dev->io_resource[i].flags = IORESOURCE_IO|IORESOURCE_UNSET;
-	}
-	for (i=0;i<DEVICE_COUNT_MEM;i++) {
-		dev->mem_resource[i].start = 0;
-		dev->mem_resource[i].end = 0;
-		dev->mem_resource[i].flags = IORESOURCE_MEM|IORESOURCE_UNSET;
-	}
-	for (i=0;i<DEVICE_COUNT_IRQ;i++) {
-		dev->irq_resource[i].start = (unsigned long)-1;
-		dev->irq_resource[i].end = (unsigned long)-1;
-		dev->irq_resource[i].flags = IORESOURCE_IRQ|IORESOURCE_UNSET;
-	}
-	for (i=0;i<DEVICE_COUNT_DMA;i++) {
-		dev->dma_resource[i].start = (unsigned long)-1;
-		dev->dma_resource[i].end = (unsigned long)-1;
-		dev->dma_resource[i].flags = IORESOURCE_DMA|IORESOURCE_UNSET;
-	}
-
-	/*
-	 * Fill in dev resource info
-	 */
-        while ( (char *)p < ((char *)node->data + node->size )) {
-        	if(p==lastp) break;
-
-                if( p[0] & 0x80 ) {// large item
-			switch (p[0] & 0x7f) {
-			case 0x01: // memory
-			{
-				int io = *(short *) &p[4];
-				int len = *(short *) &p[10];
-				add_memresource(dev, io, len);
-				break;
-			}
-			case 0x02: // device name
-			{
-				int len = *(short *) &p[1];
-				memcpy(dev->name, p + 3, len >= 80 ? 79 : len);
-				break;
-			}
-			case 0x05: // 32-bit memory
-			{
-				int io = *(int *) &p[4];
-				int len = *(int *) &p[16];
-				add_memresource(dev, io, len);
-				break;
-			}
-			case 0x06: // fixed location 32-bit memory
-			{
-				int io = *(int *) &p[4];
-				int len = *(int *) &p[8];
-				add_memresource(dev, io, len);
-				break;
-			}
-			} /* switch */
-                        lastp = p+3;
-                        p = p + p[1] + p[2]*256 + 3;
-                        continue;
-                }
-                if ((p[0]>>3) == 0x0f){ // end tag
-			p = p + 2;
-			goto end;
-                        break;
-			}
-                switch (p[0]>>3) {
-                case 0x04: // irq
-                {
-                        int i, mask, irq = -1;
-                        mask= p[1] + p[2]*256;
-                        for (i=0;i<16;i++, mask=mask>>1)
-                                if(mask & 0x01) irq=i;
-			add_irqresource(dev, irq);
-                        break;
-                }
-                case 0x05: // dma
-                {
-                        int i, mask, dma = -1;
-                        mask = p[1];
-                        for (i=0;i<8;i++, mask = mask>>1)
-                                if(mask & 0x01) dma=i;
-			add_dmaresource(dev, dma);
-                        break;
-                }
-                case 0x08: // io
-                {
-			int io= p[2] + p[3] *256;
-			int len = p[7];
-			add_ioresource(dev, io, len);
-                        break;
-                }
-		case 0x09: // fixed location io
-		{
-			int io = p[1] + p[2] * 256;
-			int len = p[3];
-			add_ioresource(dev, io, len);
-			break;
-		}
-                } /* switch */
-                lastp=p+1;
-                p = p + (p[0] & 0x07) + 1;
-
-        } /* while */
-	end:
-	if (pnp_port_valid(dev, 0) == 0 &&
-	    pnp_mem_valid(dev, 0) == 0 &&
-	    pnp_irq_valid(dev, 0) == 0 &&
-	    pnp_dma_valid(dev, 0) == 0)
-		dev->active = 0;
-	else
-		dev->active = 1;
-        return (unsigned char *)p;
-}
-
-
-/* pnp possible resource reading functions */
-
-static void read_lgtag_mem(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
-{
-	struct pnp_mem * mem;
-	mem = pnpbios_kmalloc(sizeof(struct pnp_mem),GFP_KERNEL);
-	if (!mem)
-		return;
-	memset(mem,0,sizeof(struct pnp_mem));
-	mem->min = ((p[3] << 8) | p[2]) << 8;
-	mem->max = ((p[5] << 8) | p[4]) << 8;
-	mem->align = (p[7] << 8) | p[6];
-	mem->size = ((p[9] << 8) | p[8]) << 8;
-	mem->flags = p[1];
-	pnp_add_mem_resource(dev,depnum,mem);
-	return;
-}
-
-static void read_lgtag_mem32(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
-{
-	struct pnp_mem32 * mem;
-	mem = pnpbios_kmalloc(sizeof(struct pnp_mem32),GFP_KERNEL);
-	if (!mem)
-		return;
-	memset(mem,0,sizeof(struct pnp_mem32));
-	memcpy(mem->data, p, 17);
-	pnp_add_mem32_resource(dev,depnum,mem);
-	return;
-}
-
-static void read_lgtag_fmem32(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
-{
-	struct pnp_mem32 * mem;
-	mem = pnpbios_kmalloc(sizeof(struct pnp_mem32),GFP_KERNEL);
-	if (!mem)
-		return;
-	memset(mem,0,sizeof(struct pnp_mem32));
-	memcpy(mem->data, p, 17);
-	pnp_add_mem32_resource(dev,depnum,mem);
-	return;
-}
-
-static void read_smtag_irq(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
-{
-	struct pnp_irq * irq;
-	irq = pnpbios_kmalloc(sizeof(struct pnp_irq),GFP_KERNEL);
-	if (!irq)
-		return;
-	memset(irq,0,sizeof(struct pnp_irq));
-	irq->map = (p[2] << 8) | p[1];
-	if (size > 2)
-		irq->flags = p[3];
-	pnp_add_irq_resource(dev,depnum,irq);
-	return;
-}
-
-static void read_smtag_dma(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
-{
-	struct pnp_dma * dma;
-	dma = pnpbios_kmalloc(sizeof(struct pnp_dma),GFP_KERNEL);
-	if (!dma)
-		return;
-	memset(dma,0,sizeof(struct pnp_dma));
-	dma->map = p[1];
-	dma->flags = p[2];
-	pnp_add_dma_resource(dev,depnum,dma);
-	return;
-}
-
-static void read_smtag_port(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
-{
-	struct pnp_port * port;
-	port = pnpbios_kmalloc(sizeof(struct pnp_port),GFP_KERNEL);
-	if (!port)
-		return;
-	memset(port,0,sizeof(struct pnp_port));
-	port->min = (p[3] << 8) | p[2];
-	port->max = (p[5] << 8) | p[4];
-	port->align = p[6];
-	port->size = p[7];
-	port->flags = p[1] ? PNP_PORT_FLAG_16BITADDR : 0;
-	pnp_add_port_resource(dev,depnum,port);
-	return;
-}
-
-static void read_smtag_fport(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
-{
-	struct pnp_port * port;
-	port = pnpbios_kmalloc(sizeof(struct pnp_port),GFP_KERNEL);
-	if (!port)
-		return;
-	memset(port,0,sizeof(struct pnp_port));
-	port->min = port->max = (p[2] << 8) | p[1];
-	port->size = p[3];
-	port->align = 0;
-	port->flags = PNP_PORT_FLAG_FIXED;
-	pnp_add_port_resource(dev,depnum,port);
-	return;
-}
-
-static unsigned char *node_possible_resource_data_to_dev(unsigned char *p, struct pnp_bios_node *node, struct pnp_dev *dev)
-{
-	int len, depnum, dependent;
-
-	if ((char *)p == NULL)
-		return NULL;
-	if (pnp_build_resource(dev, 0) == NULL)
-		return NULL;
-	depnum = 0; /*this is the first so it should be 0 */
-	dependent = 0;
-        while ( (char *)p < ((char *)node->data + node->size )) {
-
-                if( p[0] & 0x80 ) {// large item
-			len = (p[2] << 8) | p[1];
-			switch (p[0] & 0x7f) {
-			case 0x01: // memory
-			{
-				if (len != 9)
-					goto __skip;
-				read_lgtag_mem(p,len,depnum,dev);
-				break;
-			}
-			case 0x05: // 32-bit memory
-			{
-				if (len != 17)
-					goto __skip;
-				read_lgtag_mem32(p,len,depnum,dev);
-				break;
-			}
-			case 0x06: // fixed location 32-bit memory
-			{
-				if (len != 17)
-					goto __skip;
-				read_lgtag_fmem32(p,len,depnum,dev);
-				break;
-			}
-			} /* switch */
-                        p += len + 3;
-                        continue;
-                }
-		len = p[0] & 0x07;
-                switch ((p[0]>>3) & 0x0f) {
-		case 0x0f:
-		{
-			p = p + 2;
-        		return (unsigned char *)p;
-			break;
-		}
-                case 0x04: // irq
-                {
-			if (len < 2 || len > 3)
-				goto __skip;
-			read_smtag_irq(p,len,depnum,dev);
-			break;
-                }
-                case 0x05: // dma
-                {
-			if (len != 2)
-				goto __skip;
-			read_smtag_dma(p,len,depnum,dev);
-                        break;
-                }
-                case 0x06: // start dep
-                {
-			if (len > 1)
-				goto __skip;
-			dependent = 0x100 | PNP_RES_PRIORITY_ACCEPTABLE;
-			if (len > 0)
-				dependent = 0x100 | p[1];
-			pnp_build_resource(dev,dependent);
-			depnum = pnp_get_max_depnum(dev);
-                        break;
-                }
-                case 0x07: // end dep
-                {
-			if (len != 0)
-				goto __skip;
-			depnum = 0;
-                        break;
-                }
-                case 0x08: // io
-                {
-			if (len != 7)
-				goto __skip;
-			read_smtag_port(p,len,depnum,dev);
-                        break;
-                }
-		case 0x09: // fixed location io
-		{
-			if (len != 3)
-				goto __skip;
-			read_smtag_fport(p,len,depnum,dev);
-			break;
-		}
-                } /* switch */
-		__skip:
-                p += len + 1;
-
-        } /* while */
-
-        return NULL;
-}
-
 /* pnp EISA ids */
 
 #define HEX(id,a) hex[((id)>>a) & 15]
@@ -1075,20 +713,26 @@
 		return;
         while ( (char *)p < ((char *)node->data + node->size )) {
 
-                if( p[0] & 0x80 ) {// large item
+                if( p[0] & 0x80 ) {
 			len = (p[2] << 8) | p[1];
-                        p += len + 3;
-                        continue;
-                }
+			if ((p[0] & 0x7f) == 0x02) /* human readable name */
+			{
+				int size = *(short *) &p[1];
+				memcpy(dev->dev.name, p + 3, len >= 80 ? 79 : size);
+				break;
+			}
+			p += len + 3;
+			continue;
+		}
 		len = p[0] & 0x07;
-                switch ((p[0]>>3) & 0x0f) {
-		case 0x0f:
+		switch ((p[0]>>3) & 0x0f) {
+		case 0x0f: /* end tag */
 		{
         		return;
 			break;
 		}
-                case 0x03: // compatible ID
-                {
+		case 0x03: /* compatible ID */
+		{
 			if (len != 4)
 				goto __skip;
 			dev_id =  pnpbios_kmalloc(sizeof (struct pnp_id), GFP_KERNEL);
@@ -1099,177 +743,20 @@
 			memcpy(&dev_id->id, id, 7);
 			pnp_add_id(dev_id, dev);
 			break;
-                }
-                } /* switch */
-		__skip:
-                p += len + 1;
-
-        } /* while */
-}
-
-/* pnp resource writing functions */
-
-static void write_lgtag_mem(unsigned char *p, int size, struct pnp_mem *mem)
-{
-	if (!mem)
-		return;
-	p[2] = (mem->min >> 8) & 0xff;
-	p[3] = ((mem->min >> 8) >> 8) & 0xff;
-	p[4] = (mem->max >> 8) & 0xff;
-	p[5] = ((mem->max >> 8) >> 8) & 0xff;
-	p[6] = mem->align & 0xff;
-	p[7] = (mem->align >> 8) & 0xff;
-	p[8] = (mem->size >> 8) & 0xff;
-	p[9] = ((mem->size >> 8) >> 8) & 0xff;
-	p[1] = mem->flags & 0xff;
-	return;
-}
-
-static void write_smtag_irq(unsigned char *p, int size, struct pnp_irq *irq)
-{
-	if (!irq)
-		return;
-	p[1] = irq->map & 0xff;
-	p[2] = (irq->map >> 8) & 0xff;
-	if (size > 2)
-		p[3] = irq->flags & 0xff;
-	return;
-}
-
-static void write_smtag_dma(unsigned char *p, int size, struct pnp_dma *dma)
-{
-	if (!dma)
-		return;
-	p[1] = dma->map & 0xff;
-	p[2] = dma->flags & 0xff;
-	return;
-}
-
-static void write_smtag_port(unsigned char *p, int size, struct pnp_port *port)
-{
-	if (!port)
-		return;
-	p[2] = port->min & 0xff;
-	p[3] = (port->min >> 8) & 0xff;
-	p[4] = port->max & 0xff;
-	p[5] = (port->max >> 8) & 0xff;
-	p[6] = port->align & 0xff;
-	p[7] = port->size & 0xff;
-	p[1] = port->flags & 0xff;
-	return;
-}
-
-static void write_smtag_fport(unsigned char *p, int size, struct pnp_port *port)
-{
-	if (!port)
-		return;
-	p[1] = port->min & 0xff;
-	p[2] = (port->min >> 8) & 0xff;
-	p[3] = port->size & 0xff;
-	return;
-}
-
-static int node_set_resources(struct pnp_bios_node *node, struct pnp_cfg *config)
-{
-	int error = 0;
-	unsigned char *p = (char *)node->data, *lastp = NULL;
-	int len, port = 0, irq = 0, dma = 0, mem = 0;
-
-	if (!node)
-		return -EINVAL;
-	if ((char *)p == NULL)
-		return -EINVAL;
-        while ( (char *)p < ((char *)node->data + node->size )) {
-
-                if( p[0] & 0x80 ) {// large item
-			len = (p[2] << 8) | p[1];
-			switch (p[0] & 0x7f) {
-			case 0x01: // memory
-			{
-				if (len != 9)
-					goto __skip;
-				write_lgtag_mem(p,len,config->mem[mem]);
-				mem++;
-				break;
-			}
-			case 0x05: // 32-bit memory
-			{
-				if (len != 17)
-					goto __skip;
-				/* FIXME */
-				break;
-			}
-			case 0x06: // fixed location 32-bit memory
-			{
-				if (len != 17)
-					goto __skip;
-				/* FIXME */
-				break;
-			}
-			} /* switch */
-                        lastp = p+3;
-                        p = p + p[1] + p[2]*256 + 3;
-                        continue;
-                }
-		len = p[0] & 0x07;
-                switch ((p[0]>>3) & 0x0f) {
-		case 0x0f:
-		{
-        		goto done;
-			break;
 		}
-                case 0x04: // irq
-                {
-			if (len < 2 || len > 3)
-				goto __skip;
-			write_smtag_irq(p,len,config->irq[irq]);
-			irq++;
-			break;
-                }
-                case 0x05: // dma
-                {
-			if (len != 2)
-				goto __skip;
-			write_smtag_dma(p,len,config->dma[dma]);
-			dma++;
-                        break;
-                }
-                case 0x08: // io
-                {
-			if (len != 7)
-				goto __skip;
-			write_smtag_port(p,len,config->port[port]);
-			port++;
-                        break;
-                }
-		case 0x09: // fixed location io
-		{
-			if (len != 3)
-				goto __skip;
-			write_smtag_fport(p,len,config->port[port]);
-			port++;
-			break;
 		}
-                } /* switch */
 		__skip:
-                p += len + 1;
-
-        } /* while */
-
-	/* we never got an end tag so this data is corrupt or invalid */
-	return -EINVAL;
+		p += len + 1;
 
-	done:
-	error = pnp_bios_set_dev_node(node->handle, (char)0, node);
-        return error;
+	}
 }
 
-static int pnpbios_get_resources(struct pnp_dev *dev)
+static int pnpbios_get_resources(struct pnp_dev * dev, struct pnp_resource_table * res)
 {
 	struct pnp_dev_node_info node_info;
 	u8 nodenum = dev->number;
 	struct pnp_bios_node * node;
-		
+
 	/* just in case */
 	if(!pnpbios_is_dynamic(dev))
 		return -EPERM;
@@ -1278,18 +765,22 @@
 	node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL);
 	if (!node)
 		return -1;
-	if (pnp_bios_get_dev_node(&nodenum, (char )0, node))
+	if (pnp_bios_get_dev_node(&nodenum, (char )0, node)) {
+		kfree(node);
 		return -ENODEV;
-	node_current_resource_data_to_dev(node,dev);
+	}
+	pnp_parse_current_resources((char *)node->data,(char *)node->data + node->size,res);
+	dev->active = pnp_is_active(dev);
 	kfree(node);
 	return 0;
 }
 
-static int pnpbios_set_resources(struct pnp_dev *dev, struct pnp_cfg *config)
+static int pnpbios_set_resources(struct pnp_dev * dev, struct pnp_resource_table * res)
 {
 	struct pnp_dev_node_info node_info;
 	u8 nodenum = dev->number;
 	struct pnp_bios_node * node;
+	int ret;
 
 	/* just in case */
 	if (!pnpbios_is_dynamic(dev))
@@ -1301,83 +792,42 @@
 		return -1;
 	if (pnp_bios_get_dev_node(&nodenum, (char )1, node))
 		return -ENODEV;
-	if(node_set_resources(node, config)<0){
+	if(!pnp_write_resources((char *)node->data,(char *)node->data + node->size,res)){
+		kfree(node);
 		return -1;
 	}
+	ret = pnp_bios_set_dev_node(node->handle, (char)0, node);
 	kfree(node);
-	return 0;
+	if (ret > 0)
+		ret = -1;
+	return ret;
 }
 
 static int pnpbios_disable_resources(struct pnp_dev *dev)
 {
-	struct pnp_cfg * config = kmalloc(sizeof(struct pnp_cfg), GFP_KERNEL);
-	/* first we need to set everything to a disabled value */
-	struct pnp_port	port = {
-	.max	= 0,
-	.min	= 0,
-	.align	= 0,
-	.size	= 0,
-	.flags	= 0,
-	.pad	= 0,
-	};
-	struct pnp_mem	mem = {
-	.max	= 0,
-	.min	= 0,
-	.align	= 0,
-	.size	= 0,
-	.flags	= 0,
-	.pad	= 0,
-	};
-	struct pnp_dma	dma = {
-	.map	= 0,
-	.flags	= 0,
-	};
-	struct pnp_irq	irq = {
-	.map	= 0,
-	.flags	= 0,
-	.pad	= 0,
-	};
-	int i;
 	struct pnp_dev_node_info node_info;
-	u8 nodenum = dev->number;
 	struct pnp_bios_node * node;
-	if (!config)
-		return -1;
+	int ret;
+	
 	/* just in case */
 	if(dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev))
 		return -EPERM;
-	memset(config, 0, sizeof(struct pnp_cfg));
 	if (!dev || !dev->active)
 		return -EINVAL;
-	for (i=0; i < 8; i++)
-		config->port[i] = &port;
-	for (i=0; i < 4; i++)
-		config->mem[i] = &mem;
-	for (i=0; i < 2; i++)
-		config->irq[i] = &irq;
-	for (i=0; i < 2; i++)
-		config->dma[i] = &dma;
-	dev->active = 0;
-
 	if (pnp_bios_dev_node_info(&node_info) != 0)
 		return -ENODEV;
+	/* the value of this will be zero */
 	node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL);
 	if (!node)
-		return -1;
-	if (pnp_bios_get_dev_node(&nodenum, (char )1, node))
-		goto failed;
-	if(node_set_resources(node, config)<0)
-		goto failed;
-	kfree(config);
-	kfree(node);
-	return 0;
- failed:
+		return -ENOMEM;
+	ret = pnp_bios_set_dev_node(dev->number, (char)0, node);
+	dev->active = 0;
 	kfree(node);
-	kfree(config);
-	return -1;
+	if (ret > 0)
+		ret = -1;
+	return ret;
 }
 
-
 /* PnP Layer support */
 
 static struct pnp_protocol pnpbios_protocol = {
@@ -1387,15 +837,47 @@
 	.disable = pnpbios_disable_resources,
 };
 
-static inline int insert_device(struct pnp_dev *dev)
+static int insert_device(struct pnp_dev *dev, struct pnp_bios_node * node)
 {
 	struct list_head * pos;
+	unsigned char * p;
 	struct pnp_dev * pnp_dev;
+	struct pnp_id *dev_id;
+	char id[8];
+
+	/* check if the device is already added */
+	dev->number = node->handle;
 	list_for_each (pos, &pnpbios_protocol.devices){
 		pnp_dev = list_entry(pos, struct pnp_dev, protocol_list);
 		if (dev->number == pnp_dev->number)
 			return -1;
 	}
+
+	/* set the initial values for the PnP device */
+	dev_id = pnpbios_kmalloc(sizeof(struct pnp_id), GFP_KERNEL);
+	if (!dev_id)
+		return -1;
+	pnpid32_to_pnpid(node->eisa_id,id);
+	memcpy(dev_id->id,id,7);
+	pnp_add_id(dev_id, dev);
+	p = pnp_parse_current_resources((char *)node->data,
+		(char *)node->data + node->size,&dev->res);
+	p = pnp_parse_possible_resources((char *)p,
+		(char *)node->data + node->size,dev);
+	node_id_data_to_dev(p,node,dev);
+	dev->active = pnp_is_active(dev);
+	dev->flags = node->flags;
+	if (!(dev->flags & PNPBIOS_NO_CONFIG))
+		dev->capabilities |= PNP_CONFIGURABLE;
+	if (!(dev->flags & PNPBIOS_NO_DISABLE))
+		dev->capabilities |= PNP_DISABLE;
+	dev->capabilities |= PNP_READ;
+	if (pnpbios_is_dynamic(dev))
+		dev->capabilities |= PNP_WRITE;
+	if (dev->flags & PNPBIOS_REMOVABLE)
+		dev->capabilities |= PNP_REMOVABLE;
+	dev->protocol = &pnpbios_protocol;
+
 	pnp_add_device(dev);
 	return 0;
 }
@@ -1403,14 +885,11 @@
 static void __init build_devlist(void)
 {
 	u8 nodenum;
-	char id[8];
-	unsigned char *pos;
 	unsigned int nodes_got = 0;
 	unsigned int devs = 0;
 	struct pnp_bios_node *node;
 	struct pnp_dev_node_info node_info;
 	struct pnp_dev *dev;
-	struct pnp_id *dev_id;
 
 	if (!pnp_bios_present())
 		return;
@@ -1424,51 +903,15 @@
 
 	for(nodenum=0; nodenum<0xff; ) {
 		u8 thisnodenum = nodenum;
-		/* We build the list from the "boot" config because
-		 * we know that the resources couldn't have changed
-		 * at this stage.  Furthermore some buggy PnP BIOSes
-		 * will crash if we request the "current" config
-		 * from devices that are can only be static such as
-		 * those controlled by the "system" driver.
-		 */
-		if (pnp_bios_get_dev_node(&nodenum, (char )1, node))
+		if (pnp_bios_get_dev_node(&nodenum, (char )0, node))
 			break;
 		nodes_got++;
 		dev =  pnpbios_kmalloc(sizeof (struct pnp_dev), GFP_KERNEL);
 		if (!dev)
 			break;
-		memset(dev,0,sizeof(struct pnp_dev));
-		dev_id =  pnpbios_kmalloc(sizeof (struct pnp_id), GFP_KERNEL);
-		if (!dev_id) {
-			kfree(dev);
-			break;
-		}
-		memset(dev_id,0,sizeof(struct pnp_id));
-		dev->number = thisnodenum;
-		strcpy(dev->name,"Unknown Device");
-		pnpid32_to_pnpid(node->eisa_id,id);
-		memcpy(dev_id->id,id,7);
-		pnp_add_id(dev_id, dev);
-		pos = node_current_resource_data_to_dev(node,dev);
-		pos = node_possible_resource_data_to_dev(pos,node,dev);
-		node_id_data_to_dev(pos,node,dev);
-		dev->flags = node->flags;
-		if (!(dev->flags & PNPBIOS_NO_CONFIG))
-			dev->capabilities |= PNP_CONFIGURABLE;
-		if (!(dev->flags & PNPBIOS_NO_DISABLE))
-			dev->capabilities |= PNP_DISABLE;
-		dev->capabilities |= PNP_READ;
-		if (pnpbios_is_dynamic(dev))
-			dev->capabilities |= PNP_WRITE;
-		if (dev->flags & PNPBIOS_REMOVABLE)
-			dev->capabilities |= PNP_REMOVABLE;
-
-		dev->protocol = &pnpbios_protocol;
-
-		if(insert_device(dev)<0) {
-			kfree(dev_id);
+		if(insert_device(dev,node)<0)
 			kfree(dev);
-		} else
+		else
 			devs++;
 		if (nodenum <= thisnodenum) {
 			printk(KERN_ERR "PnPBIOS: build_devlist: Node number 0x%x is out of sequence following node 0x%x. Aborting.\n", (unsigned int)nodenum, (unsigned int)thisnodenum);
@@ -1563,6 +1006,8 @@
 		pnp_bios_callpoint.segment = PNP_CS16;
 		pnp_bios_hdr = check;
 
+		set_base(bad_bios_desc, __va((unsigned long)0x40 << 4));
+		_set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4));
 		for(i=0; i < NR_CPUS; i++)
 		{
 			Q2_SET_SEL(i, PNP_CS32, &pnp_bios_callfunc, 64 * 1024);
diff -Nru a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
--- a/drivers/pnp/quirks.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/pnp/quirks.c	Sun Feb 23 22:25:26 2003
@@ -29,7 +29,7 @@
 static void quirk_awe32_resources(struct pnp_dev *dev)
 {
 	struct pnp_port *port, *port2, *port3;
-	struct pnp_resources *res = dev->res->dep;
+	struct pnp_resources *res = dev->possible->dep;
 
 	/*
 	 * Unfortunately the isapnp_add_port_resource is too tightly bound
@@ -57,7 +57,7 @@
 
 static void quirk_cmi8330_resources(struct pnp_dev *dev)
 {
-	struct pnp_resources *res = dev->res->dep;
+	struct pnp_resources *res = dev->possible->dep;
 
 	for ( ; res ; res = res->dep ) {
 
@@ -77,7 +77,7 @@
 static void quirk_sb16audio_resources(struct pnp_dev *dev)
 {
 	struct pnp_port *port;
-	struct pnp_resources *res = dev->res->dep;
+	struct pnp_resources *res = dev->possible->dep;
 	int    changed = 0;
 
 	/*
@@ -115,7 +115,7 @@
 	 */
 	struct pnp_resources *res;
 	int max;
-	res = dev->res;
+	res = dev->possible;
 	max = 0;
 	for (res = res->dep; res; res = res->dep) {
 		if (res->dma->map > max)
diff -Nru a/drivers/pnp/resource.c b/drivers/pnp/resource.c
--- a/drivers/pnp/resource.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/pnp/resource.c	Sun Feb 23 22:25:24 2003
@@ -1,8 +1,8 @@
 /*
- * resource.c - contains resource management algorithms
+ * resource.c - Contains functions for registering and analyzing resource information
  *
  * based on isapnp.c resource management (c) Jaroslav Kysela <perex@suse.cz>
- * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
+ * Copyright 2003 Adam Belay <ambx1@neo.rr.com>
  *
  */
 
@@ -16,15 +16,8 @@
 #include <asm/dma.h>
 #include <asm/irq.h>
 #include <linux/ioport.h>
-#include <linux/config.h>
 #include <linux/init.h>
 
-#ifdef CONFIG_PNP_DEBUG
-	#define DEBUG
-#else
-	#undef DEBUG
-#endif
-
 #include <linux/pnp.h>
 #include "base.h"
 
@@ -36,7 +29,9 @@
 int pnp_reserve_mem[16] = { [0 ... 15] = -1 };	/* reserve (don't use) some memory region */
 
 
-/* resource information adding functions */
+/*
+ * possible resource registration
+ */
 
 struct pnp_resources * pnp_build_resource(struct pnp_dev *dev, int dependent)
 {
@@ -45,8 +40,8 @@
 	res = pnp_alloc(sizeof(struct pnp_resources));
 	if (!res)
 		return NULL;
-	ptr = dev->res;
-	if (ptr && ptr->dependent && dependent) { /* add to another list */
+	ptr = dev->possible;
+	if (ptr) { /* add to another list */
 		ptra = ptr->dep;
 		while (ptra && ptra->dep)
 			ptra = ptra->dep;
@@ -54,24 +49,14 @@
 			ptr->dep = res;
 		else
 			ptra->dep = res;
-	} else {
-		if (!ptr){
-			dev->res = res;
-		}
-		else{
-			kfree(res);
-			return NULL;
-		}
-	}
+	} else
+		dev->possible = res;
 	if (dependent) {
 		res->priority = dependent & 0xff;
 		if (res->priority > PNP_RES_PRIORITY_FUNCTIONAL)
 			res->priority = PNP_RES_PRIORITY_INVALID;
-		res->dependent = 1;
-	} else {
+	} else
 		res->priority = PNP_RES_PRIORITY_PREFERRED;
-		res->dependent = 1;
-	}
 	return res;
 }
 
@@ -81,7 +66,7 @@
 	struct pnp_resources *res;
 	if (!dev)
 		return NULL;
-	res = dev->res;
+	res = dev->possible;
 	if (!res)
 		return NULL;
 	for (i = 0; i < depnum; i++)
@@ -100,7 +85,7 @@
 	struct pnp_resources *res;
 	if (!dev)
 		return -EINVAL;
-	res = dev->res;
+	res = dev->possible;
 	if (!res)
 		return -EINVAL;
 	while (res->dep){
@@ -110,10 +95,6 @@
 	return num;
 }
 
-/*
- *  Add IRQ resource to resources list.
- */
-
 int pnp_add_irq_resource(struct pnp_dev *dev, int depnum, struct pnp_irq *data)
 {
 	int i;
@@ -139,10 +120,6 @@
 	return 0;
 }
 
-/*
- *  Add DMA resource to resources list.
- */
-
 int pnp_add_dma_resource(struct pnp_dev *dev, int depnum, struct pnp_dma *data)
 {
 	struct pnp_resources *res;
@@ -162,20 +139,15 @@
 	return 0;
 }
 
-/*
- *  Add port resource to resources list.
- */
-
 int pnp_add_port_resource(struct pnp_dev *dev, int depnum, struct pnp_port *data)
 {
 	struct pnp_resources *res;
 	struct pnp_port *ptr;
 	res = pnp_find_resources(dev,depnum);
-	if (res==NULL)
+	if (!res)
 		return -EINVAL;
 	if (!data)
 		return -EINVAL;
-	data->res = res;
 	ptr = res->port;
 	while (ptr && ptr->next)
 		ptr = ptr->next;
@@ -186,10 +158,6 @@
 	return 0;
 }
 
-/*
- *  Add memory resource to resources list.
- */
-
 int pnp_add_mem_resource(struct pnp_dev *dev, int depnum, struct pnp_mem *data)
 {
 	struct pnp_resources *res;
@@ -209,32 +177,6 @@
 	return 0;
 }
 
-/*
- *  Add 32-bit memory resource to resources list.
- */
-
-int pnp_add_mem32_resource(struct pnp_dev *dev, int depnum, struct pnp_mem32 *data)
-{
-	struct pnp_resources *res;
-	struct pnp_mem32 *ptr;
-	res = pnp_find_resources(dev,depnum);
-	if (!res)
-		return -EINVAL;
-	if (!data)
-		return -EINVAL;
-	ptr = res->mem32;
-	while (ptr && ptr->next)
-		ptr = ptr->next;
-	if (ptr)
-		ptr->next = data;
-	else
-		res->mem32 = data;
-	return 0;
-}
-
-
-/* resource removing functions */
-
 static void pnp_free_port(struct pnp_port *port)
 {
 	struct pnp_port *next;
@@ -279,17 +221,6 @@
 	}
 }
 
-static void pnp_free_mem32(struct pnp_mem32 *mem32)
-{
-	struct pnp_mem32 *next;
-
-	while (mem32) {
-		next = mem32->next;
-		kfree(mem32);
-		mem32 = next;
-	}
-}
-
 void pnp_free_resources(struct pnp_resources *resources)
 {
 	struct pnp_resources *next;
@@ -300,597 +231,449 @@
 		pnp_free_irq(resources->irq);
 		pnp_free_dma(resources->dma);
 		pnp_free_mem(resources->mem);
-		pnp_free_mem32(resources->mem32);
 		kfree(resources);
 		resources = next;
 	}
 }
 
 
-/* resource validity checking functions */
+/*
+ * resource validity checking
+ */
 
-static int pnp_check_port(int port, int size, int idx, struct pnp_cfg *config)
-{
-	int i, tmp, rport, rsize;
-	struct pnp_dev *dev;
+#define length(start, end) (*(end) - *(start) + 1)
 
-	if (check_region(port, size))
-		return 1;
-	for (i = 0; i < 8; i++) {
-		rport = pnp_reserve_io[i << 1];
-		rsize = pnp_reserve_io[(i << 1) + 1];
-		if (port >= rport && port < rport + rsize)
-			return 1;
-		if (port + size > rport && port + size < (rport + rsize) - 1)
-			return 1;
-	}
-
-	pnp_for_each_dev(dev) {
-		if (dev->active) {
-			for (tmp = 0; tmp < 8; tmp++) {
-				if (pnp_port_valid(dev, tmp)) {
-					rport = pnp_port_start(dev, tmp);
-					rsize = pnp_port_len(dev, tmp);
-					if (port >= rport && port < rport + rsize)
-						return 1;
-					if (port + size > rport && port + size < (rport + rsize) - 1)
-						return 1;
-				}
+/* ranged_conflict - used to determine if two resource ranges conflict
+ * condition 1: check if the start of a is within b
+ * condition 2: check if the end of a is within b
+ * condition 3: check if b is engulfed by a */
+
+#define ranged_conflict(starta, enda, startb, endb) \
+((*(starta) >= *(startb) && *(starta) <= *(endb)) || \
+ (*(enda) >= *(startb) && *(enda) <= *(endb)) || \
+ (*(starta) < *(startb) && *(enda) > *(endb)))
+
+struct pnp_dev * pnp_check_port_conflicts(struct pnp_dev * dev, int idx, int mode)
+{
+	int tmp;
+	unsigned long *port, *end, *tport, *tend;
+	struct pnp_dev *tdev;
+	port = &dev->res.port_resource[idx].start;
+	end = &dev->res.port_resource[idx].end;
+
+	/* if the resource doesn't exist, don't complain about it */
+	if (dev->res.port_resource[idx].start == 0)
+		return NULL;
+
+	/* check for cold conflicts */
+	pnp_for_each_dev(tdev) {
+		/* Is the device configurable? */
+		if (tdev == dev || (mode ? !tdev->active : tdev->active))
+			continue;
+		for (tmp = 0; tmp < PNP_MAX_PORT; tmp++) {
+			if (tdev->res.port_resource[tmp].flags & IORESOURCE_IO) {
+				tport = &tdev->res.port_resource[tmp].start;
+				tend = &tdev->res.port_resource[tmp].end;
+				if (ranged_conflict(port,end,tport,tend))
+					return tdev;
 			}
 		}
 	}
-	for (tmp = 0; tmp < 8 && tmp != idx; tmp++) {
-		if (pnp_port_valid(dev, tmp) &&
-		    pnp_flags_valid(&config->request.io_resource[tmp])) {
-			rport = config->request.io_resource[tmp].start;
-			rsize = (config->request.io_resource[tmp].end - rport) + 1;
-			if (port >= rport && port < rport + rsize)
-				return 1;
-			if (port + size > rport && port + size < (rport + rsize) - 1)
-				return 1;
+	return NULL;
+}
+
+int pnp_check_port(struct pnp_dev * dev, int idx)
+{
+	int tmp;
+	unsigned long *port, *end, *tport, *tend;
+	port = &dev->res.port_resource[idx].start;
+	end = &dev->res.port_resource[idx].end;
+
+	/* if the resource doesn't exist, don't complain about it */
+	if (dev->res.port_resource[idx].start == 0)
+		return 0;
+
+	/* check if the resource is already in use, skip if the device is active because it itself may be in use */
+	if(!dev->active) {
+		if (check_region(*port, length(port,end)))
+			return CONFLICT_TYPE_IN_USE;
+	}
+
+	/* check if the resource is reserved */
+	for (tmp = 0; tmp < 8; tmp++) {
+		int rport = pnp_reserve_io[tmp << 1];
+		int rend = pnp_reserve_io[(tmp << 1) + 1] + rport - 1;
+		if (ranged_conflict(port,end,&rport,&rend))
+			return CONFLICT_TYPE_RESERVED;
+	}
+
+	/* check for internal conflicts */
+	for (tmp = 0; tmp < PNP_MAX_PORT && tmp != idx; tmp++) {
+		if (dev->res.port_resource[tmp].flags & IORESOURCE_IO) {
+			tport = &dev->res.port_resource[tmp].start;
+			tend = &dev->res.port_resource[tmp].end;
+			if (ranged_conflict(port,end,tport,tend))
+				return CONFLICT_TYPE_INTERNAL;
 		}
 	}
+
+	/* check for warm conflicts */
+	if (pnp_check_port_conflicts(dev, idx, SEARCH_WARM))
+		return CONFLICT_TYPE_PNP_WARM;
+
 	return 0;
 }
 
-static int pnp_check_mem(unsigned int addr, unsigned int size, int idx, struct pnp_cfg *config)
+struct pnp_dev * pnp_check_mem_conflicts(struct pnp_dev * dev, int idx, int mode)
 {
-	int i, tmp;
-	unsigned int raddr, rsize;
-	struct pnp_dev *dev;
-
-	for (i = 0; i < 8; i++) {
-		raddr = (unsigned int)pnp_reserve_mem[i << 1];
-		rsize = (unsigned int)pnp_reserve_mem[(i << 1) + 1];
-		if (addr >= raddr && addr < raddr + rsize)
-			return 1;
-		if (addr + size > raddr && addr + size < (raddr + rsize) - 1)
-			return 1;
-		if (__check_region(&iomem_resource, addr, size))
-			return 1;
-	}
-	pnp_for_each_dev(dev) {
-		if (dev->active) {
-			for (tmp = 0; tmp < 4; tmp++) {
-				if (pnp_mem_valid(dev, tmp)) {
-					raddr = pnp_mem_start(dev, tmp);
-					rsize = pnp_mem_len(dev, tmp);
-					if (addr >= raddr && addr < raddr + rsize)
-						return 1;
-					if (addr + size > raddr && addr + size < (raddr + rsize) - 1)
-						return 1;
-				}
+	int tmp;
+	unsigned long *addr, *end, *taddr, *tend;
+	struct pnp_dev *tdev;
+	addr = &dev->res.mem_resource[idx].start;
+	end = &dev->res.mem_resource[idx].end;
+
+	/* if the resource doesn't exist, don't complain about it */
+	if (dev->res.mem_resource[idx].start == 0)
+		return NULL;
+
+	/* check for cold conflicts */
+	pnp_for_each_dev(tdev) {
+		/* Is the device configurable? */
+		if (tdev == dev || (mode ? !tdev->active : tdev->active))
+			continue;
+		for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) {
+			if (tdev->res.mem_resource[tmp].flags & IORESOURCE_MEM) {
+				taddr = &tdev->res.mem_resource[tmp].start;
+				tend = &tdev->res.mem_resource[tmp].end;
+				if (ranged_conflict(addr,end,taddr,tend))
+					return tdev;
 			}
 		}
 	}
-	for (tmp = 0; tmp < 4 && tmp != idx; tmp++) {
-		if (pnp_mem_valid(dev, tmp) &&
-		    pnp_flags_valid(&config->request.mem_resource[tmp])) {
-			raddr = config->request.mem_resource[tmp].start;
-			rsize = (config->request.mem_resource[tmp].end - raddr) + 1;
-			if (addr >= raddr && addr < raddr + rsize)
-				return 1;
-			if (addr + size > raddr && addr + size < (raddr + rsize) - 1)
-				return 1;
+	return NULL;
+}
+
+int pnp_check_mem(struct pnp_dev * dev, int idx)
+{
+	int tmp;
+	unsigned long *addr, *end, *taddr, *tend;
+	addr = &dev->res.mem_resource[idx].start;
+	end = &dev->res.mem_resource[idx].end;
+
+	/* if the resource doesn't exist, don't complain about it */
+	if (dev->res.mem_resource[idx].start == 0)
+		return 0;
+
+	/* check if the resource is already in use, skip if the device is active because it itself may be in use */
+	if(!dev->active) {
+		if (__check_region(&iomem_resource, *addr, length(addr,end)))
+			return CONFLICT_TYPE_IN_USE;
+	}
+
+	/* check if the resource is reserved */
+	for (tmp = 0; tmp < 8; tmp++) {
+		int raddr = pnp_reserve_mem[tmp << 1];
+		int rend = pnp_reserve_mem[(tmp << 1) + 1] + raddr - 1;
+		if (ranged_conflict(addr,end,&raddr,&rend))
+			return CONFLICT_TYPE_RESERVED;
+	}
+
+	/* check for internal conflicts */
+	for (tmp = 0; tmp < PNP_MAX_MEM && tmp != idx; tmp++) {
+		if (dev->res.mem_resource[tmp].flags & IORESOURCE_MEM) {
+			taddr = &dev->res.mem_resource[tmp].start;
+			tend = &dev->res.mem_resource[tmp].end;
+			if (ranged_conflict(addr,end,taddr,tend))
+				return CONFLICT_TYPE_INTERNAL;
 		}
 	}
+
+	/* check for warm conflicts */
+	if (pnp_check_mem_conflicts(dev, idx, SEARCH_WARM))
+		return CONFLICT_TYPE_PNP_WARM;
+
 	return 0;
 }
 
+struct pnp_dev * pnp_check_irq_conflicts(struct pnp_dev * dev, int idx, int mode)
+{
+	int tmp;
+	struct pnp_dev * tdev;
+	unsigned long * irq = &dev->res.irq_resource[idx].start;
+
+	/* if the resource doesn't exist, don't complain about it */
+	if (dev->res.irq_resource[idx].start == -1)
+		return NULL;
+
+	/* check for cold conflicts */
+	pnp_for_each_dev(tdev) {
+		/* Is the device configurable? */
+		if (tdev == dev || (mode ? !tdev->active : tdev->active))
+			continue;
+		for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) {
+			if (tdev->res.irq_resource[tmp].flags & IORESOURCE_IRQ) {
+				if ((tdev->res.irq_resource[tmp].start == *irq))
+					return tdev;
+			}
+		}
+	}
+	return NULL;
+}
+
 static void pnp_test_handler(int irq, void *dev_id, struct pt_regs *regs)
 {
 }
 
-static int pnp_check_interrupt(int irq, struct pnp_cfg *config)
+int pnp_check_irq(struct pnp_dev * dev, int idx)
 {
-	int i;
-#ifdef CONFIG_PCI
-	struct pci_dev *pci;
-#endif
-	struct pnp_dev *dev;
-	if (!config)
-		return 1;
+	int tmp;
+	unsigned long * irq = &dev->res.irq_resource[idx].start;
 
-	if (irq < 0 || irq > 15)
-		return 1;
-	for (i = 0; i < 16; i++) {
-		if (pnp_reserve_irq[i] == irq)
-			return 1;
-	}
-	pnp_for_each_dev(dev) {
-		if (dev->active) {
-			if ((pnp_irq_valid(dev, 0) && dev->irq_resource[0].start == irq) ||
-			    (pnp_irq_valid(dev, 1) && dev->irq_resource[1].start == irq))
-				return 1;
+	/* if the resource doesn't exist, don't complain about it */
+	if (dev->res.irq_resource[idx].start == -1)
+		return 0;
+
+	/* check if the resource is valid */
+	if (*irq < 0 || *irq > 15)
+		return CONFLICT_TYPE_INVALID;
+
+	/* check if the resource is reserved */
+	for (tmp = 0; tmp < 16; tmp++) {
+		if (pnp_reserve_irq[tmp] == *irq)
+			return CONFLICT_TYPE_RESERVED;
+	}
+
+	/* check for internal conflicts */
+	for (tmp = 0; tmp < PNP_MAX_IRQ && tmp != idx; tmp++) {
+		if (dev->res.irq_resource[tmp].flags & IORESOURCE_IRQ) {
+			if (dev->res.irq_resource[tmp].start == *irq)
+				return CONFLICT_TYPE_INTERNAL;
 		}
 	}
-	if (pnp_flags_valid(&config->request.irq_resource[0]) &&
-	    pnp_flags_valid(&config->request.irq_resource[1]) &&
-	    (config->request.irq_resource[0].start == irq))
-		return 1;
+
 #ifdef CONFIG_PCI
+	/* check if the resource is being used by a pci device */
 	if (!pnp_skip_pci_scan) {
+		struct pci_dev * pci;
 		pci_for_each_dev(pci) {
-			if (pci->irq == irq)
-				return 1;
+			if (pci->irq == *irq)
+				return CONFLICT_TYPE_PCI;
 		}
 	}
 #endif
-	if (request_irq(irq, pnp_test_handler, SA_INTERRUPT, "pnp", NULL))
-		return 1;
-	free_irq(irq, NULL);
-	return 0;
-}
-
-static int pnp_check_dma(int dma, struct pnp_cfg *config)
-{
-	int i, mindma = 1;
-	struct pnp_dev *dev;
-	if (!config)
-		return 1;
 
-	if (pnp_allow_dma0 == 1)
-		mindma = 0;
-	if (dma < mindma || dma == 4 || dma > 7)
-		return 1;
-	for (i = 0; i < 8; i++) {
-		if (pnp_reserve_dma[i] == dma)
-			return 1;
-	}
-	pnp_for_each_dev(dev) {
-		if (dev->active) {
-			if ((pnp_dma_valid(dev, 0) && pnp_dma(dev, 0) == dma) ||
-			    (pnp_dma_valid(dev, 1) && pnp_dma(dev, 1) == dma))
-				return 1;
-		}
+	/* check if the resource is already in use, skip if the device is active because it itself may be in use */
+	if(!dev->active) {
+		if (request_irq(*irq, pnp_test_handler, SA_INTERRUPT, "pnp", NULL))
+			return CONFLICT_TYPE_IN_USE;
+		free_irq(*irq, NULL);
 	}
-	if (pnp_flags_valid(&config->request.dma_resource[0]) &&
-	    pnp_flags_valid(&config->request.dma_resource[1]) &&
-	    (config->request.dma_resource[0].start == dma))
-		return 1;
-	if (request_dma(dma, "pnp"))
-		return 1;
-	free_dma(dma);
-	return 0;
-}
 
+	/* check for warm conflicts */
+	if (pnp_check_irq_conflicts(dev, idx, SEARCH_WARM))
+		return CONFLICT_TYPE_PNP_WARM;
 
-/* config generation functions */
-static int pnp_generate_port(struct pnp_cfg *config, int num)
-{
-	struct pnp_port *port;
-	unsigned long *value1, *value2, *value3;
-	if (!config || num < 0 || num > 7)
-		return -EINVAL;
-	port = config->port[num];
-	if (!port)
-		return 0;
-	value1 = &config->request.io_resource[num].start;
-	value2 = &config->request.io_resource[num].end;
-	value3 = &config->request.io_resource[num].flags;
-	*value1 = port->min;
-	*value2 = *value1 + port->size - 1;
-	*value3 = port->flags | IORESOURCE_IO;
-	while (pnp_check_port(*value1, port->size, num, config)) {
-		*value1 += port->align;
-		*value2 = *value1 + port->size - 1;
-		if (*value1 > port->max || !port->align)
-			return -ENOENT;
-	}
 	return 0;
 }
 
-static int pnp_generate_mem(struct pnp_cfg *config, int num)
-{
-	struct pnp_mem *mem;
-	unsigned long *value1, *value2, *value3;
-	if (!config || num < 0 || num > 3)
-		return -EINVAL;
-	mem = config->mem[num];
-	if (!mem)
-		return 0;
-	value1 = &config->request.mem_resource[num].start;
-	value2 = &config->request.mem_resource[num].end;
-	value3 = &config->request.mem_resource[num].flags;
-	*value1 = mem->min;
-	*value2 = *value1 + mem->size - 1;
-	*value3 = mem->flags | IORESOURCE_MEM;
-	if (!(mem->flags & IORESOURCE_MEM_WRITEABLE))
-		*value3 |= IORESOURCE_READONLY;
-	if (mem->flags & IORESOURCE_MEM_CACHEABLE)
-		*value3 |= IORESOURCE_CACHEABLE;
-	if (mem->flags & IORESOURCE_MEM_RANGELENGTH)
-		*value3 |= IORESOURCE_RANGELENGTH;
-	if (mem->flags & IORESOURCE_MEM_SHADOWABLE)
-		*value3 |= IORESOURCE_SHADOWABLE;
-	while (pnp_check_mem(*value1, mem->size, num, config)) {
-		*value1 += mem->align;
-		*value2 = *value1 + mem->size - 1;
-		if (*value1 > mem->max || !mem->align)
-			return -ENOENT;
-	}
-	return 0;
-}
 
-static int pnp_generate_irq(struct pnp_cfg *config, int num)
+struct pnp_dev * pnp_check_dma_conflicts(struct pnp_dev * dev, int idx, int mode)
 {
-	struct pnp_irq *irq;
-	unsigned long *value1, *value2, *value3;
-	/* IRQ priority: this table is good for i386 */
-	static unsigned short xtab[16] = {
-		5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2
-	};
-	int i;
-	if (!config || num < 0 || num > 1)
-		return -EINVAL;
-	irq = config->irq[num];
-	if (!irq)
-		return 0;
-	value1 = &config->request.irq_resource[num].start;
-	value2 = &config->request.irq_resource[num].end;
-	value3 = &config->request.irq_resource[num].flags;
-	*value3 = irq->flags | IORESOURCE_IRQ;
+	int tmp;
+	struct pnp_dev * tdev;
+	unsigned long * dma = &dev->res.dma_resource[idx].start;
 
-	for (i=0; i < 16; i++)
-	{
-		if(irq->map & (1<<xtab[i])) {
-		*value1 = *value2 = xtab[i];
-		if(pnp_check_interrupt(*value1,config)==0)
-			return 0;
+	/* if the resource doesn't exist, don't complain about it */
+	if (dev->res.dma_resource[idx].start == -1)
+		return NULL;
+
+	/* check for cold conflicts */
+	pnp_for_each_dev(tdev) {
+		/* Is the device configurable? */
+		if (tdev == dev || (mode ? !tdev->active : tdev->active))
+			continue;
+		for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) {
+			if (tdev->res.dma_resource[tmp].flags & IORESOURCE_DMA) {
+				if ((tdev->res.dma_resource[tmp].start == *dma))
+					return tdev;
+			}
 		}
 	}
-	return -ENOENT;
+	return NULL;
 }
 
-static int pnp_generate_dma(struct pnp_cfg *config, int num)
+int pnp_check_dma(struct pnp_dev * dev, int idx)
 {
-	struct pnp_dma *dma;
-	unsigned long *value1, *value2, *value3;
-	/* DMA priority: this table is good for i386 */
-	static unsigned short xtab[16] = {
-		1, 3, 5, 6, 7, 0, 2, 4
-	};
-	int i;
-	if (!config || num < 0 || num > 1)
-		return -EINVAL;
-	dma = config->dma[num];
-	if (!dma)
+	int tmp, mindma = 1;
+	unsigned long * dma = &dev->res.dma_resource[idx].start;
+
+	/* if the resource doesn't exist, don't complain about it */
+	if (dev->res.dma_resource[idx].start == -1)
 		return 0;
-	value1 = &config->request.dma_resource[num].start;
-	value2 = &config->request.dma_resource[num].end;
-	value3 = &config->request.dma_resource[num].flags;
-	*value3 = dma->flags | IORESOURCE_DMA;
 
-	for (i=0; i < 8; i++)
-	{
-		if(dma->map & (1<<xtab[i])) {
-		*value1 = *value2 = xtab[i];
-		if(pnp_check_dma(*value1,config)==0)
-			return 0;
-		}
+	/* check if the resource is valid */
+	if (pnp_allow_dma0 == 1)
+		mindma = 0;
+	if (*dma < mindma || *dma == 4 || *dma > 7)
+		return CONFLICT_TYPE_INVALID;
+
+	/* check if the resource is reserved */
+	for (tmp = 0; tmp < 8; tmp++) {
+		if (pnp_reserve_dma[tmp] == *dma)
+			return CONFLICT_TYPE_RESERVED;
 	}
-	return -ENOENT;
-}
 
-int pnp_init_res_cfg(struct pnp_res_cfg *res_config)
-{
-	int idx;
+	/* check for internal conflicts */
+	for (tmp = 0; tmp < PNP_MAX_DMA && tmp != idx; tmp++) {
+		if (dev->res.dma_resource[tmp].flags & IORESOURCE_DMA) {
+			if (dev->res.dma_resource[tmp].start == *dma)
+				return CONFLICT_TYPE_INTERNAL;
+		}
+	}
 
-	if (!res_config)
-		return -EINVAL;
-	for (idx = 0; idx < DEVICE_COUNT_IRQ; idx++) {
-		res_config->irq_resource[idx].start = -1;
-		res_config->irq_resource[idx].end = -1;
-		res_config->irq_resource[idx].flags = IORESOURCE_IRQ|IORESOURCE_UNSET;
-	}
-	for (idx = 0; idx < DEVICE_COUNT_DMA; idx++) {
-		res_config->dma_resource[idx].name = NULL;
-		res_config->dma_resource[idx].start = -1;
-		res_config->dma_resource[idx].end = -1;
-		res_config->dma_resource[idx].flags = IORESOURCE_DMA|IORESOURCE_UNSET;
-	}
-	for (idx = 0; idx < DEVICE_COUNT_IO; idx++) {
-		res_config->io_resource[idx].name = NULL;
-		res_config->io_resource[idx].start = 0;
-		res_config->io_resource[idx].end = 0;
-		res_config->io_resource[idx].flags = IORESOURCE_IO|IORESOURCE_UNSET;
-	}
-	for (idx = 0; idx < DEVICE_COUNT_MEM; idx++) {
-		res_config->mem_resource[idx].name = NULL;
-		res_config->mem_resource[idx].start = 0;
-		res_config->mem_resource[idx].end = 0;
-		res_config->mem_resource[idx].flags = IORESOURCE_MEM|IORESOURCE_UNSET;
+	/* check if the resource is already in use, skip if the device is active because it itself may be in use */
+	if(!dev->active) {
+		if (request_dma(*dma, "pnp"))
+			return CONFLICT_TYPE_IN_USE;
+		free_dma(*dma);
 	}
-	return 0;
-}
 
-static int pnp_prepare_request(struct pnp_dev *dev, struct pnp_cfg *config, struct pnp_res_cfg *template)
-{
-	int idx, err;
-	if (!config)
-		return -EINVAL;
-	if (dev->lock_resources)
-		return -EPERM;
-	if (dev->active)
-		return -EBUSY;
-	err = pnp_init_res_cfg(&config->request);
-	if (err < 0)
-		return err;
-	if (!template)
-		return 0;
-	for (idx = 0; idx < DEVICE_COUNT_IRQ; idx++)
-		if (pnp_flags_valid(&template->irq_resource[idx]))
-			config->request.irq_resource[idx] = template->irq_resource[idx];
-	for (idx = 0; idx < DEVICE_COUNT_DMA; idx++)
-		if (pnp_flags_valid(&template->dma_resource[idx]))
-			config->request.dma_resource[idx] = template->dma_resource[idx];
-	for (idx = 0; idx < DEVICE_COUNT_IO; idx++)
-		if (pnp_flags_valid(&template->io_resource[idx]))
-			config->request.io_resource[idx] = template->io_resource[idx];
-	for (idx = 0; idx < DEVICE_COUNT_MEM; idx++)
-		if (pnp_flags_valid(&template->io_resource[idx]))
-			config->request.mem_resource[idx] = template->mem_resource[idx];
+	/* check for warm conflicts */
+	if (pnp_check_dma_conflicts(dev, idx, SEARCH_WARM))
+		return CONFLICT_TYPE_PNP_WARM;
 	return 0;
 }
 
-static int pnp_generate_request(struct pnp_dev *dev, struct pnp_cfg *config, struct pnp_res_cfg *template)
+
+/**
+ * pnp_init_resource_table - Resets a resource table to default values.
+ * @table: pointer to the desired resource table
+ *
+ */
+
+void pnp_init_resource_table(struct pnp_resource_table *table)
 {
-	int i, err;
-	if (!config)
-		return -EINVAL;
-	if ((err = pnp_prepare_request(dev, config, template))<0)
-		return err;
-	for (i=0; i<=7; i++)
-	{
-		if(pnp_generate_port(config,i)<0)
-			return -ENOENT;
-	}
-	for (i=0; i<=3; i++)
-	{
-		if(pnp_generate_mem(config,i)<0)
-			return -ENOENT;
-	}
-	for (i=0; i<=1; i++)
-	{
-		if(pnp_generate_irq(config,i)<0)
-			return -ENOENT;
-	}
-	for (i=0; i<=1; i++)
-	{
-		if(pnp_generate_dma(config,i)<0)
-			return -ENOENT;
+	int idx;
+	for (idx = 0; idx < PNP_MAX_IRQ; idx++) {
+		table->irq_resource[idx].name = NULL;
+		table->irq_resource[idx].start = -1;
+		table->irq_resource[idx].end = -1;
+		table->irq_resource[idx].flags = 0;
+	}
+	for (idx = 0; idx < PNP_MAX_DMA; idx++) {
+		table->dma_resource[idx].name = NULL;
+		table->dma_resource[idx].start = -1;
+		table->dma_resource[idx].end = -1;
+		table->dma_resource[idx].flags = 0;
+	}
+	for (idx = 0; idx < PNP_MAX_PORT; idx++) {
+		table->port_resource[idx].name = NULL;
+		table->port_resource[idx].start = 0;
+		table->port_resource[idx].end = 0;
+		table->port_resource[idx].flags = 0;
+	}
+	for (idx = 0; idx < PNP_MAX_MEM; idx++) {
+		table->mem_resource[idx].name = NULL;
+		table->mem_resource[idx].start = 0;
+		table->mem_resource[idx].end = 0;
+		table->mem_resource[idx].flags = 0;
 	}
-	return 0;
 }
 
 
+/**
+ * pnp_generate_rule - Creates a rule table structure based on depnum and device.
+ * @dev: pointer to the desired device
+ * @depnum: dependent function, if not valid will return an error
+ * @rule: pointer to a rule structure to record data to
+ *
+ */
 
-static struct pnp_cfg * pnp_generate_config(struct pnp_dev *dev, int depnum)
+int pnp_generate_rule(struct pnp_dev * dev, int depnum, struct pnp_rule_table * rule)
 {
-	struct pnp_cfg * config;
 	int nport = 0, nirq = 0, ndma = 0, nmem = 0;
 	struct pnp_resources * res;
 	struct pnp_port * port;
 	struct pnp_mem * mem;
 	struct pnp_irq * irq;
 	struct pnp_dma * dma;
-	if (!dev)
-		return NULL;
-	if (depnum < 0)
-		return NULL;
-	config = pnp_alloc(sizeof(struct pnp_cfg));
-	if (!config)
-		return NULL;
+
+	if (depnum < 0 || !rule)
+		return -EINVAL;
 
 	/* independent */
 	res = pnp_find_resources(dev, 0);
 	if (!res)
-		goto fail;
+		return -ENODEV;
 	port = res->port;
 	mem = res->mem;
 	irq = res->irq;
 	dma = res->dma;
 	while (port){
-		config->port[nport] = port;
+		rule->port[nport] = port;
 		nport++;
 		port = port->next;
 	}
 	while (mem){
-		config->mem[nmem] = mem;
+		rule->mem[nmem] = mem;
 		nmem++;
 		mem = mem->next;
 	}
 	while (irq){
-		config->irq[nirq] = irq;
+		rule->irq[nirq] = irq;
 		nirq++;
 		irq = irq->next;
 	}
 	while (dma){
-		config->dma[ndma] = dma;
+		rule->dma[ndma] = dma;
 		ndma++;
 		dma = dma->next;
 	}
 
 	/* dependent */
 	if (depnum == 0)
-		return config;
+		return 1;
 	res = pnp_find_resources(dev, depnum);
 	if (!res)
-		goto fail;
+		return -ENODEV;
 	port = res->port;
 	mem = res->mem;
 	irq = res->irq;
 	dma = res->dma;
 	while (port){
-		config->port[nport] = port;
+		rule->port[nport] = port;
 		nport++;
 		port = port->next;
 	}
 	while (mem){
-		config->mem[nmem] = mem;
+		rule->mem[nmem] = mem;
 		nmem++;
 		mem = mem->next;
 	}
 
 	while (irq){
-		config->irq[nirq] = irq;
+		rule->irq[nirq] = irq;
 		nirq++;
 		irq = irq->next;
 	}
 	while (dma){
-		config->dma[ndma] = dma;
+		rule->dma[ndma] = dma;
 		ndma++;
 		dma = dma->next;
 	}
-	return config;
-
-	fail:
-	kfree(config);
-	return NULL;
-}
-
-/* PnP Device Resource Management */
-
-/**
- * pnp_activate_dev - activates a PnP device for use
- * @dev: pointer to the desired device
- *
- * finds the best resource configuration and then informs the correct pnp protocol
- */
-
-int pnp_activate_dev(struct pnp_dev *dev, struct pnp_res_cfg *template)
-{
-	int depnum, max;
-	struct pnp_cfg *config;
-	if (!dev)
-		return -EINVAL;
-        max = pnp_get_max_depnum(dev);
-	if (!pnp_can_configure(dev))
-		return -EBUSY;
-	if (dev->status != PNP_READY && dev->status != PNP_ATTACHED){
-		printk(KERN_INFO "pnp: Automatic configuration failed because the PnP device '%s' is busy\n", dev->dev.bus_id);
-		return -EINVAL;
-	}
-	if (!pnp_can_write(dev))
-		return -EINVAL;
-	if (max == 0)
-		return 0;
-	for (depnum=1; depnum <= max; depnum++)
-	{
-		config = pnp_generate_config(dev,depnum);
-		if (!config)
-			return -EINVAL;
-		if (pnp_generate_request(dev,config,template)==0)
-			goto done;
-		kfree(config);
-	}
-	printk(KERN_ERR "pnp: Automatic configuration failed for device '%s' due to resource conflicts\n", dev->dev.bus_id);
-	return -ENOENT;
-
-	done:
-	pnp_dbg("the device '%s' has been activated", dev->dev.bus_id);
-	dev->protocol->set(dev,config);
-	if (pnp_can_read(dev))
-		dev->protocol->get(dev);
-	kfree(config);
-	return 0;
-}
-
-/**
- * pnp_disable_dev - disables device
- * @dev: pointer to the desired device
- *
- * inform the correct pnp protocol so that resources can be used by other devices
- */
-
-int pnp_disable_dev(struct pnp_dev *dev)
-{
-        if (!dev)
-                return -EINVAL;
-	if (dev->status != PNP_READY){
-		printk(KERN_INFO "pnp: Disable failed becuase the PnP device '%s' is busy\n", dev->dev.bus_id);
-		return -EINVAL;
-	}
-	if (dev->lock_resources)
-		return -EPERM;
-	if (!pnp_can_disable(dev) || !dev->active)
-		return -EINVAL;
-	pnp_dbg("the device '%s' has been disabled", dev->dev.bus_id);
-	return dev->protocol->disable(dev);
-}
-
-/**
- * pnp_raw_set_dev - same as pnp_activate_dev except the resource config can be specified
- * @dev: pointer to the desired device
- * @depnum: resource dependent function
- * @mode: static or dynamic
- *
- */
 
-int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, struct pnp_res_cfg *template)
-{
-	struct pnp_cfg *config;
-	if (!dev)
-		return -EINVAL;
-	if (dev->status != PNP_READY){
-		printk(KERN_INFO "pnp: Unable to set resources because the PnP device '%s' is busy\n", dev->dev.bus_id);
-		return -EINVAL;
-	}
-	if (!pnp_can_write(dev) || !pnp_can_configure(dev))
-		return -EINVAL;
-        config = pnp_generate_config(dev,depnum);
-	if (!config)
-		return -EINVAL;
-	if (pnp_generate_request(dev,config,template)==0)
-		goto done;
-	kfree(config);
-	printk(KERN_ERR "pnp: Manual configuration failed for device '%s' due to resource conflicts\n", dev->dev.bus_id);
-	return -ENOENT;
-
-	done:
-	dev->protocol->set(dev,config);
-	if (pnp_can_read(dev))
-		dev->protocol->get(dev);
-	kfree(config);
-	return 0;
+	/* clear the remaining values */
+	for (; nport < PNP_MAX_PORT; nport++)
+		rule->port[nport] = NULL;
+	for (; nmem < PNP_MAX_MEM; nmem++)
+		rule->mem[nmem] = NULL;
+	for (; nirq < PNP_MAX_IRQ; nirq++)
+		rule->irq[nirq] = NULL;
+	for (; ndma < PNP_MAX_DMA; ndma++)
+		rule->dma[ndma] = NULL;
+	return 1;
 }
 
-/**
- * pnp_resource_change - change one resource
- * @resource: pointer to resource to be changed
- * @start: start of region
- * @size: size of region
- *
- */
- 
-void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size)
-{
-	if (resource == NULL)
-		return;
-	resource->flags &= ~(IORESOURCE_AUTO|IORESOURCE_UNSET);
-	resource->start = start;
-	resource->end = start + size - 1;
-}
 
 EXPORT_SYMBOL(pnp_build_resource);
 EXPORT_SYMBOL(pnp_find_resources);
@@ -899,12 +682,9 @@
 EXPORT_SYMBOL(pnp_add_dma_resource);
 EXPORT_SYMBOL(pnp_add_port_resource);
 EXPORT_SYMBOL(pnp_add_mem_resource);
-EXPORT_SYMBOL(pnp_add_mem32_resource);
-EXPORT_SYMBOL(pnp_init_res_cfg);
-EXPORT_SYMBOL(pnp_activate_dev);
-EXPORT_SYMBOL(pnp_disable_dev);
-EXPORT_SYMBOL(pnp_raw_set_dev);
-EXPORT_SYMBOL(pnp_resource_change);
+EXPORT_SYMBOL(pnp_init_resource_table);
+EXPORT_SYMBOL(pnp_generate_rule);
+
 
 /* format is: allowdma0 */
 
diff -Nru a/drivers/pnp/support.c b/drivers/pnp/support.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/pnp/support.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,676 @@
+/*
+ * support.c - provides standard pnp functions for the use of pnp protocol drivers,
+ *
+ * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
+ *
+ * Resource parsing functions are based on those in the linux pnpbios driver.
+ * Copyright Christian Schmidt, Tom Lees, David Hinds, Alan Cox, Thomas Hood,
+ * Brian Gerst and Adam Belay.
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+
+#ifdef CONFIG_PNP_DEBUG
+	#define DEBUG
+#else
+	#undef DEBUG
+#endif
+
+#include <linux/pnp.h>
+#include "base.h"
+
+#define SMALL_TAG_PNPVERNO		0x01
+#define SMALL_TAG_LOGDEVID		0x02
+#define SMALL_TAG_COMPATDEVID		0x03
+#define SMALL_TAG_IRQ			0x04
+#define SMALL_TAG_DMA			0x05
+#define SMALL_TAG_STARTDEP		0x06
+#define SMALL_TAG_ENDDEP		0x07
+#define SMALL_TAG_PORT			0x08
+#define SMALL_TAG_FIXEDPORT		0x09
+#define SMALL_TAG_VENDOR		0x0e
+#define SMALL_TAG_END			0x0f
+#define LARGE_TAG			0x80
+#define LARGE_TAG_MEM			0x01
+#define LARGE_TAG_ANSISTR		0x02
+#define LARGE_TAG_UNICODESTR		0x03
+#define LARGE_TAG_VENDOR		0x04
+#define LARGE_TAG_MEM32			0x05
+#define LARGE_TAG_FIXEDMEM32		0x06
+
+
+/**
+ * pnp_is_active - Determines if a device is active based on its current resources
+ * @dev: pointer to the desired PnP device
+ *
+ */
+
+int pnp_is_active(struct pnp_dev * dev)
+{
+	if (!pnp_port_start(dev, 0) && pnp_port_len(dev, 0) <= 1 &&
+	    !pnp_mem_start(dev, 0) && pnp_mem_len(dev, 0) <= 1 &&
+	    pnp_irq(dev, 0) == -1 &&
+	    pnp_dma(dev, 0) == -1)
+	    	return 0;
+	else
+		return 1;
+}
+
+
+/*
+ * Current resource reading functions *
+ */
+
+static void current_irqresource(struct pnp_resource_table * res, int irq)
+{
+	int i = 0;
+	while ((res->irq_resource[i].flags & IORESOURCE_IRQ) && i < PNP_MAX_IRQ) i++;
+	if (i < PNP_MAX_IRQ) {
+		res->irq_resource[i].start =
+		res->irq_resource[i].end = (unsigned long) irq;
+		res->irq_resource[i].flags = IORESOURCE_IRQ;  // Also clears _UNSET flag
+	}
+}
+
+static void current_dmaresource(struct pnp_resource_table * res, int dma)
+{
+	int i = 0;
+	while ((res->dma_resource[i].flags & IORESOURCE_DMA) && i < PNP_MAX_DMA) i++;
+	if (i < PNP_MAX_DMA) {
+		res->dma_resource[i].start =
+		res->dma_resource[i].end = (unsigned long) dma;
+		res->dma_resource[i].flags = IORESOURCE_DMA;  // Also clears _UNSET flag
+	}
+}
+
+static void current_ioresource(struct pnp_resource_table * res, int io, int len)
+{
+	int i = 0;
+	while ((res->port_resource[i].flags & IORESOURCE_IO) && i < PNP_MAX_PORT) i++;
+	if (i < PNP_MAX_PORT) {
+		res->port_resource[i].start = (unsigned long) io;
+		res->port_resource[i].end = (unsigned long)(io + len - 1);
+		res->port_resource[i].flags = IORESOURCE_IO;  // Also clears _UNSET flag
+	}
+}
+
+static void current_memresource(struct pnp_resource_table * res, int mem, int len)
+{
+	int i = 0;
+	while ((res->mem_resource[i].flags & IORESOURCE_MEM) && i < PNP_MAX_MEM) i++;
+	if (i < PNP_MAX_MEM) {
+		res->mem_resource[i].start = (unsigned long) mem;
+		res->mem_resource[i].end = (unsigned long)(mem + len - 1);
+		res->mem_resource[i].flags = IORESOURCE_MEM;  // Also clears _UNSET flag
+	}
+}
+
+/**
+ * pnp_parse_current_resources - Extracts current resource information from a raw PnP resource structure
+ * @p: pointer to the start of the structure
+ * @end: pointer to the end of the structure
+ * @res: pointer to the resource table to record to
+ *
+ */
+
+unsigned char * pnp_parse_current_resources(unsigned char * p, unsigned char * end, struct pnp_resource_table * res)
+{
+	int len;
+
+	if (!p)
+		return NULL;
+
+	/* Blank the resource table values */
+	pnp_init_resource_table(res);
+
+	while ((char *)p < (char *)end) {
+
+		if(p[0] & LARGE_TAG) { /* large tag */
+			len = (p[2] << 8) | p[1];
+			switch (p[0] & 0x7f) {
+			case LARGE_TAG_MEM:
+			{
+				int io = *(short *) &p[4];
+				int size = *(short *) &p[10];
+				if (len != 9)
+					goto lrg_err;
+				current_memresource(res, io, size);
+				break;
+			}
+			case LARGE_TAG_ANSISTR:
+			{
+				/* ignore this for now */
+				break;
+			}
+			case LARGE_TAG_VENDOR:
+			{
+				/* do nothing */
+				break;
+			}
+			case LARGE_TAG_MEM32:
+			{
+				int io = *(int *) &p[4];
+				int size = *(int *) &p[16];
+				if (len != 17)
+					goto lrg_err;
+				current_memresource(res, io, size);
+				break;
+			}
+			case LARGE_TAG_FIXEDMEM32:
+			{
+				int io = *(int *) &p[4];
+				int size = *(int *) &p[8];
+				if (len != 9)
+					goto lrg_err;
+				current_memresource(res, io, size);
+				break;
+			}
+			default: /* an unkown tag */
+			{
+				lrg_err:
+				pnp_warn("parser: Unknown large tag '0x%x'.", p[0] & 0x7f);
+				break;
+			}
+			} /* switch */
+			p += len + 3;
+			continue;
+		} /* end large tag */
+
+		/* small tag */
+		len = p[0] & 0x07;
+		switch ((p[0]>>3) & 0x0f) {
+		case SMALL_TAG_IRQ:
+		{
+			int i, mask, irq = -1;
+			if (len < 2 || len > 3)
+				goto sm_err;
+			mask= p[1] + p[2]*256;
+			for (i=0;i<16;i++, mask=mask>>1)
+				if(mask & 0x01) irq=i;
+			current_irqresource(res, irq);
+			break;
+		}
+		case SMALL_TAG_DMA:
+		{
+			int i, mask, dma = -1;
+			if (len != 2)
+				goto sm_err;
+			mask = p[1];
+			for (i=0;i<8;i++, mask = mask>>1)
+				if(mask & 0x01) dma=i;
+			current_dmaresource(res, dma);
+			break;
+		}
+		case SMALL_TAG_PORT:
+		{
+			int io= p[2] + p[3] *256;
+			int size = p[7];
+			if (len != 7)
+				goto sm_err;
+			current_ioresource(res, io, size);
+			break;
+		}
+		case SMALL_TAG_VENDOR:
+		{
+			/* do nothing */
+			break;
+		}
+		case SMALL_TAG_FIXEDPORT:
+		{
+			int io = p[1] + p[2] * 256;
+			int size = p[3];
+			if (len != 3)
+				goto sm_err;
+			current_ioresource(res, io, size);
+			break;
+		}
+		case SMALL_TAG_END:
+		{
+			p = p + 2;
+        		return (unsigned char *)p;
+			break;
+		}
+		default: /* an unkown tag */
+		{
+			sm_err:
+			pnp_warn("parser: Unknown small tag '0x%x'.", p[0]>>3);
+			break;
+		}
+		}
+                p += len + 1;
+	}
+	pnp_err("parser: Resource structure does not contain an end tag.");
+
+	return NULL;
+}
+
+
+/*
+ * Possible resource reading functions *
+ */
+
+static void possible_mem(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
+{
+	struct pnp_mem * mem;
+	mem = pnp_alloc(sizeof(struct pnp_mem));
+	if (!mem)
+		return;
+	mem->min = ((p[3] << 8) | p[2]) << 8;
+	mem->max = ((p[5] << 8) | p[4]) << 8;
+	mem->align = (p[7] << 8) | p[6];
+	mem->size = ((p[9] << 8) | p[8]) << 8;
+	mem->flags = p[1];
+	pnp_add_mem_resource(dev,depnum,mem);
+	return;
+}
+
+static void possible_mem32(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
+{
+	struct pnp_mem * mem;
+	mem = pnp_alloc(sizeof(struct pnp_mem));
+	if (!mem)
+		return;
+	mem->min = (p[5] << 24) | (p[4] << 16) | (p[3] << 8) | p[2];
+	mem->max = (p[9] << 24) | (p[8] << 16) | (p[7] << 8) | p[6];
+	mem->align = (p[13] << 24) | (p[12] << 16) | (p[11] << 8) | p[10];
+	mem->size = (p[17] << 24) | (p[16] << 16) | (p[15] << 8) | p[14];
+	mem->flags = p[1];
+	pnp_add_mem_resource(dev,depnum,mem);
+	return;
+}
+
+static void possible_fixed_mem32(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
+{
+	struct pnp_mem * mem;
+	mem = pnp_alloc(sizeof(struct pnp_mem));
+	if (!mem)
+		return;
+	mem->min = mem->max = (p[5] << 24) | (p[4] << 16) | (p[3] << 8) | p[2];
+	mem->size = (p[9] << 24) | (p[8] << 16) | (p[7] << 8) | p[6];
+	mem->align = 0;
+	mem->flags = p[1];
+	pnp_add_mem_resource(dev,depnum,mem);
+	return;
+}
+
+static void possible_irq(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
+{
+	struct pnp_irq * irq;
+	irq = pnp_alloc(sizeof(struct pnp_irq));
+	if (!irq)
+		return;
+	irq->map = (p[2] << 8) | p[1];
+	if (size > 2)
+		irq->flags = p[3];
+	pnp_add_irq_resource(dev,depnum,irq);
+	return;
+}
+
+static void possible_dma(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
+{
+	struct pnp_dma * dma;
+	dma = pnp_alloc(sizeof(struct pnp_dma));
+	if (!dma)
+		return;
+	dma->map = p[1];
+	dma->flags = p[2];
+	pnp_add_dma_resource(dev,depnum,dma);
+	return;
+}
+
+static void possible_port(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
+{
+	struct pnp_port * port;
+	port = pnp_alloc(sizeof(struct pnp_port));
+	if (!port)
+		return;
+	port->min = (p[3] << 8) | p[2];
+	port->max = (p[5] << 8) | p[4];
+	port->align = p[6];
+	port->size = p[7];
+	port->flags = p[1] ? PNP_PORT_FLAG_16BITADDR : 0;
+	pnp_add_port_resource(dev,depnum,port);
+	return;
+}
+
+static void possible_fixed_port(unsigned char *p, int size, int depnum, struct pnp_dev *dev)
+{
+	struct pnp_port * port;
+	port = pnp_alloc(sizeof(struct pnp_port));
+	if (!port)
+		return;
+	port->min = port->max = (p[2] << 8) | p[1];
+	port->size = p[3];
+	port->align = 0;
+	port->flags = PNP_PORT_FLAG_FIXED;
+	pnp_add_port_resource(dev,depnum,port);
+	return;
+}
+
+/**
+ * pnp_parse_possible_resources - Extracts possible resource information from a raw PnP resource structure
+ * @p: pointer to the start of the structure
+ * @end: pointer to the end of the structure
+ * @dev: pointer to the desired PnP device
+ *
+ */
+
+unsigned char * pnp_parse_possible_resources(unsigned char * p, unsigned char * end, struct pnp_dev *dev)
+{
+	int len, depnum = 0, dependent = 0;
+
+	if (!p)
+		return NULL;
+
+	if (pnp_build_resource(dev, 0) == NULL)
+		return NULL;
+
+	while ((char *)p < (char *)end) {
+
+		if(p[0] & LARGE_TAG) { /* large tag */
+			len = (p[2] << 8) | p[1];
+			switch (p[0] & 0x7f) {
+			case LARGE_TAG_MEM:
+			{
+				if (len != 9)
+					goto lrg_err;
+				possible_mem(p,len,depnum,dev);
+				break;
+			}
+			case LARGE_TAG_MEM32:
+			{
+				if (len != 17)
+					goto lrg_err;
+				possible_mem32(p,len,depnum,dev);
+				break;
+			}
+			case LARGE_TAG_FIXEDMEM32:
+			{
+				if (len != 9)
+					goto lrg_err;
+				possible_fixed_mem32(p,len,depnum,dev);
+				break;
+			}
+			default: /* an unkown tag */
+			{
+				lrg_err:
+				pnp_warn("parser: Unknown large tag '0x%x'.", p[0] & 0x7f);
+				break;
+			}
+			} /* switch */
+                        p += len + 3;
+			continue;
+		} /* end large tag */
+
+		/* small tag */
+		len = p[0] & 0x07;
+		switch ((p[0]>>3) & 0x0f) {
+		case SMALL_TAG_IRQ:
+		{
+			if (len < 2 || len > 3)
+				goto sm_err;
+			possible_irq(p,len,depnum,dev);
+			break;
+		}
+		case SMALL_TAG_DMA:
+		{
+			if (len != 2)
+				goto sm_err;
+			possible_dma(p,len,depnum,dev);
+			break;
+		}
+		case SMALL_TAG_STARTDEP:
+		{
+			if (len > 1)
+				goto sm_err;
+			dependent = 0x100 | PNP_RES_PRIORITY_ACCEPTABLE;
+			if (len > 0)
+				dependent = 0x100 | p[1];
+			pnp_build_resource(dev,dependent);
+			depnum = pnp_get_max_depnum(dev);
+			break;
+		}
+		case SMALL_TAG_ENDDEP:
+		{
+			if (len != 0)
+				goto sm_err;
+			depnum = 0;
+			break;
+		}
+		case SMALL_TAG_PORT:
+		{
+			if (len != 7)
+				goto sm_err;
+			possible_port(p,len,depnum,dev);
+			break;
+		}
+		case SMALL_TAG_FIXEDPORT:
+		{
+			if (len != 3)
+				goto sm_err;
+			possible_fixed_port(p,len,depnum,dev);
+			break;
+		}
+		case SMALL_TAG_END:
+		{
+			p = p + 2;
+			return (unsigned char *)p;
+			break;
+		}
+		default: /* an unkown tag */
+		{
+			sm_err:
+			pnp_warn("parser: Unknown small tag '0x%x'.", p[0]>>3);
+			break;
+		}
+		}
+                p += len + 1;
+	}
+	pnp_err("parser: Resource structure does not contain an end tag.");
+
+	return NULL;
+}
+
+
+/*
+ * Resource Writing functions
+ */
+
+static void write_mem(unsigned char *p, struct resource * res)
+{
+	unsigned long base = res->start;
+	unsigned long len = res->end - res->start + 1;
+	p[2] = (base >> 8) & 0xff;
+	p[3] = ((base >> 8) >> 8) & 0xff;
+	p[4] = (base >> 8) & 0xff;
+	p[5] = ((base >> 8) >> 8) & 0xff;
+	p[8] = (len >> 8) & 0xff;
+	p[9] = ((len >> 8) >> 8) & 0xff;
+	return;
+}
+
+static void write_mem32(unsigned char *p, struct resource * res)
+{
+	unsigned long base = res->start;
+	unsigned long len = res->end - res->start + 1;
+	p[2] = base & 0xff;
+	p[3] = (base >> 8) & 0xff;
+	p[4] = (base >> 16) & 0xff;
+	p[5] = (base >> 24) & 0xff;
+	p[6] = base & 0xff;
+	p[7] = (base >> 8) & 0xff;
+	p[8] = (base >> 16) & 0xff;
+	p[9] = (base >> 24) & 0xff;
+	p[14] = len & 0xff;
+	p[15] = (len >> 8) & 0xff;
+	p[16] = (len >> 16) & 0xff;
+	p[17] = (len >> 24) & 0xff;
+	return;
+}
+
+static void write_fixed_mem32(unsigned char *p, struct resource * res)
+{	unsigned long base = res->start;
+	unsigned long len = res->end - res->start + 1;
+	p[2] = base & 0xff;
+	p[3] = (base >> 8) & 0xff;
+	p[4] = (base >> 16) & 0xff;
+	p[5] = (base >> 24) & 0xff;
+	p[6] = len & 0xff;
+	p[7] = (len >> 8) & 0xff;
+	p[8] = (len >> 16) & 0xff;
+	p[9] = (len >> 24) & 0xff;
+	return;
+}
+
+static void write_irq(unsigned char *p, struct resource * res)
+{
+	unsigned long map = 0;
+	map = 1 << res->start;
+	p[1] = map & 0xff;
+	p[2] = (map >> 8) & 0xff;
+	return;
+}
+
+static void write_dma(unsigned char *p, struct resource * res)
+{
+	unsigned long map = 0;
+	map = 1 << res->start;
+	p[1] = map & 0xff;
+	return;
+}
+
+static void write_port(unsigned char *p, struct resource * res)
+{
+	unsigned long base = res->start;
+	unsigned long len = res->end - res->start + 1;
+	p[2] = base & 0xff;
+	p[3] = (base >> 8) & 0xff;
+	p[4] = base & 0xff;
+	p[5] = (base >> 8) & 0xff;
+	p[7] = len & 0xff;
+	return;
+}
+
+static void write_fixed_port(unsigned char *p, struct resource * res)
+{
+	unsigned long base = res->start;
+	unsigned long len = res->end - res->start + 1;
+	p[1] = base & 0xff;
+	p[2] = (base >> 8) & 0xff;
+	p[3] = len & 0xff;
+	return;
+}
+
+/**
+ * pnp_write_resources - Writes resource information to a raw PnP resource structure
+ * @p: pointer to the start of the structure
+ * @end: pointer to the end of the structure
+ * @res: pointer to a resource table containing the resources to set
+ *
+ */
+
+unsigned char * pnp_write_resources(unsigned char * p, unsigned char * end, struct pnp_resource_table * res)
+{
+	int len, port = 0, irq = 0, dma = 0, mem = 0;
+
+	if (!p)
+		return NULL;
+
+	while ((char *)p < (char *)end) {
+
+		if(p[0] & LARGE_TAG) { /* large tag */
+			len = (p[2] << 8) | p[1];
+			switch (p[0] & 0x7f) {
+			case LARGE_TAG_MEM:
+			{
+				if (len != 9)
+					goto lrg_err;
+				write_mem(p, &res->mem_resource[mem]);
+				mem++;
+				break;
+			}
+			case LARGE_TAG_MEM32:
+			{
+				if (len != 17)
+					goto lrg_err;
+				write_mem32(p, &res->mem_resource[mem]);
+				break;
+			}
+			case LARGE_TAG_FIXEDMEM32:
+			{
+				if (len != 9)
+					goto lrg_err;
+				write_fixed_mem32(p, &res->mem_resource[mem]);
+				break;
+			}
+			default: /* an unkown tag */
+			{
+				lrg_err:
+				pnp_warn("parser: Unknown large tag '0x%x'.", p[0] & 0x7f);
+				break;
+			}
+			} /* switch */
+                        p += len + 3;
+			continue;
+		} /* end large tag */
+
+		/* small tag */
+		len = p[0] & 0x07;
+		switch ((p[0]>>3) & 0x0f) {
+		case SMALL_TAG_IRQ:
+		{
+			if (len < 2 || len > 3)
+				goto sm_err;
+			write_irq(p, &res->irq_resource[irq]);
+			irq++;
+			break;
+		}
+		case SMALL_TAG_DMA:
+		{
+			if (len != 2)
+				goto sm_err;
+			write_dma(p, &res->dma_resource[irq]);
+			dma++;
+			break;
+		}
+		case SMALL_TAG_PORT:
+		{
+			if (len != 7)
+				goto sm_err;
+			write_port(p, &res->port_resource[port]);
+			port++;
+			break;
+		}
+		case SMALL_TAG_FIXEDPORT:
+		{
+			if (len != 3)
+				goto sm_err;
+			write_fixed_port(p, &res->port_resource[port]);
+			port++;
+			break;
+		}
+		case SMALL_TAG_END:
+		{
+			p = p + 2;
+			return (unsigned char *)p;
+			break;
+		}
+		default: /* an unkown tag */
+		{
+			sm_err:
+			pnp_warn("parser: Unknown small tag '0x%x'.", p[0]>>3);
+			break;
+		}
+		}
+                p += len + 1;
+	}
+	pnp_err("parser: Resource structure does not contain an end tag.");
+
+	return NULL;
+}
+
+EXPORT_SYMBOL(pnp_is_active);
+EXPORT_SYMBOL(pnp_parse_current_resources);
+EXPORT_SYMBOL(pnp_parse_possible_resources);
+EXPORT_SYMBOL(pnp_write_resources);
diff -Nru a/drivers/pnp/system.c b/drivers/pnp/system.c
--- a/drivers/pnp/system.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/pnp/system.c	Sun Feb 23 22:25:27 2003
@@ -53,7 +53,7 @@
 {
 	int i;
 
-	for (i=0;i<DEVICE_COUNT_IO;i++) {
+	for (i=0;i<PNP_MAX_PORT;i++) {
 		if (pnp_port_valid(dev, i))
 			/* end of resources */
 			continue;
@@ -93,6 +93,7 @@
 
 static struct pnp_driver system_pnp_driver = {
 	.name		= "system",
+	.flags		= PNP_DRIVER_DO_NOT_ACTIVATE, 
 	.id_table	= pnp_dev_table,
 	.probe		= system_pnp_probe,
 	.remove		= NULL,
diff -Nru a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
--- a/drivers/s390/block/dasd.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/s390/block/dasd.c	Sun Feb 23 22:25:24 2003
@@ -555,7 +555,7 @@
 dasd_profile_end(dasd_device_t *device, dasd_ccw_req_t * cqr,
 		 struct request *req)
 {
-	long strtime, irqtime, endtime, tottime;	/* in microsecnds */
+	long strtime, irqtime, endtime, tottime;	/* in microseconds */
 	long tottimeps, sectors;
 
 	if (dasd_profile_level != DASD_PROFILE_ON)
diff -Nru a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
--- a/drivers/s390/cio/chsc.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/s390/cio/chsc.c	Sun Feb 23 22:25:24 2003
@@ -486,7 +486,7 @@
 	case 2: /* i/o resource accessibiliy */
 		CIO_CRW_EVENT(4, "chsc_process_crw: "
 			      "channel subsystem reports some I/O "
-			      "devices may have become accessable\n");
+			      "devices may have become accessible\n");
 		pr_debug( KERN_DEBUG "Data received after sei: \n");
 		pr_debug( KERN_DEBUG "Validity flags: %x\n", sei_res->vf);
 
diff -Nru a/drivers/sbus/char/aurora.c b/drivers/sbus/char/aurora.c
--- a/drivers/sbus/char/aurora.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/sbus/char/aurora.c	Sun Feb 23 22:25:22 2003
@@ -116,11 +116,11 @@
 		KERN_DEBUG "aurora: Warning: null aurora port for device %s in %s\n";
 
 	if (!port) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (port->magic != AURORA_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
--- a/drivers/scsi/3w-xxxx.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/scsi/3w-xxxx.c	Sun Feb 23 22:25:26 2003
@@ -8,7 +8,7 @@
 
    Copyright (C) 1999-2002 3ware Inc.
 
-   Kernel compatablity By: 	Andre Hedrick <andre@suse.com>
+   Kernel compatiblity By: 	Andre Hedrick <andre@suse.com>
    Non-Copyright (C) 2000	Andre Hedrick <andre@suse.com>
    
    Further tiny build fixes and trivial hoovering    Alan Cox
@@ -960,7 +960,9 @@
 			host->max_sectors = TW_MAX_SECTORS;
 #endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+			scsi_set_device(host, &tw_pci_dev->dev);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4)
 			scsi_set_pci_device(host, tw_pci_dev);
 #endif
 
diff -Nru a/drivers/scsi/3w-xxxx.h b/drivers/scsi/3w-xxxx.h
--- a/drivers/scsi/3w-xxxx.h	Sun Feb 23 22:25:22 2003
+++ b/drivers/scsi/3w-xxxx.h	Sun Feb 23 22:25:22 2003
@@ -8,7 +8,7 @@
 
    Copyright (C) 1999-2002 3ware Inc.
 
-   Kernel compatablity By:	Andre Hedrick <andre@suse.com>
+   Kernel compatiblity By:	Andre Hedrick <andre@suse.com>
    Non-Copyright (C) 2000	Andre Hedrick <andre@suse.com>
 
    This program is free software; you can redistribute it and/or modify
diff -Nru a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
--- a/drivers/scsi/53c700.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/scsi/53c700.c	Sun Feb 23 22:25:22 2003
@@ -122,6 +122,7 @@
 #include <linux/ioport.h>
 #include <linux/delay.h>
 #include <linux/spinlock.h>
+#include <linux/completion.h>
 #include <linux/sched.h>
 #include <linux/proc_fs.h>
 #include <asm/dma.h>
@@ -325,6 +326,7 @@
 	host->max_lun = NCR_700_MAX_LUNS;
 	host->unique_id = hostdata->base;
 	host->base = hostdata->base;
+	hostdata->eh_complete = NULL;
 	host->hostdata[0] = (unsigned long)hostdata;
 	/* kick the chip */
 	NCR_700_writeb(0xff, host, CTEST9_REG);
@@ -1525,6 +1527,9 @@
 
 			hostdata->state = NCR_700_HOST_FREE;
 			hostdata->cmd = NULL;
+			/* signal back if this was an eh induced reset */
+			if(hostdata->eh_complete != NULL)
+				complete(hostdata->eh_complete);
 			goto out_unlock;
 		} else if(sstat0 & SELECTION_TIMEOUT) {
 			DEBUG(("scsi%d: (%d:%d) selection timeout\n",
@@ -1769,7 +1774,7 @@
 	NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) + 1);
 
 	/* begin the command here */
-	/* no need to check for NULL, test for command_slot_cound above
+	/* no need to check for NULL, test for command_slot_count above
 	 * ensures a slot is free */
 	slot = find_empty_slot(hostdata);
 
@@ -1949,10 +1954,27 @@
 STATIC int
 NCR_700_bus_reset(Scsi_Cmnd * SCp)
 {
+	DECLARE_COMPLETION(complete);
+	struct NCR_700_Host_Parameters *hostdata = 
+		(struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0];
+
 	printk(KERN_INFO "scsi%d (%d:%d) New error handler wants BUS reset, cmd %p\n\t",
 	       SCp->device->host->host_no, SCp->device->id, SCp->device->lun, SCp);
 	print_command(SCp->cmnd);
+	/* In theory, eh_complete should always be null because the
+	 * eh is single threaded, but just in case we're handling a
+	 * reset via sg or something */
+	while(hostdata->eh_complete != NULL) {
+		spin_unlock_irq(SCp->device->host->host_lock);
+		schedule_timeout(HZ/10);
+		spin_lock_irq(SCp->device->host->host_lock);
+	}
+	hostdata->eh_complete = &complete;
 	NCR_700_internal_bus_reset(SCp->device->host);
+	spin_unlock_irq(SCp->device->host->host_lock);
+	wait_for_completion(&complete);
+	spin_lock_irq(SCp->device->host->host_lock);
+	hostdata->eh_complete = NULL;
 	return SUCCESS;
 }
 
diff -Nru a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h
--- a/drivers/scsi/53c700.h	Sun Feb 23 22:25:21 2003
+++ b/drivers/scsi/53c700.h	Sun Feb 23 22:25:21 2003
@@ -136,38 +136,6 @@
 	((unsigned long)SDp->hostdata) &= ~(flag & 0xffff0000);
 }
 
-/* These represent the Nexus hashing functions.  A Nexus in SCSI terms
- * just means the identification of an outstanding command, by ITL
- * (Initiator Target Lun) or ITLQ (Initiator Target Lun Tag).  I'm not
- * very keen on XOR based hashes, so these are based on number theory
- * instead.  All you need to do is to fix your hash bucket size and
- * then choose reasonable strides which are coprime with the chosen
- * bucket size
- *
- * Note: this mathematical hash can be made very efficient, if the
- * compiler is good at optimising: Choose the number of buckets to be
- * 2^n and the modulo becomes a logical and with (2^n-1).
- * Additionally, if you chose the coprimes of the form 2^n-2^n the
- * multiplication can be done by a shift and an addition. */
-#define MAX_ITL_HASH_BUCKETS	16
-#define ITL_HASH_PRIME		7
-
-#define MAX_ITLQ_HASH_BUCKETS	64
-#define ITLQ_PUN_PRIME		7
-#define ITLQ_LUN_PRIME		3
-
-static inline int
-hash_ITL(__u8 pun, __u8 lun)
-{
-	return (pun*ITL_HASH_PRIME + lun) % MAX_ITL_HASH_BUCKETS;
-}
-
-static inline int
-hash_ITLQ(__u8 pun, __u8 lun, __u8 tag)
-{
-	return (pun*ITLQ_PUN_PRIME + lun*ITLQ_LUN_PRIME + tag) % MAX_ITLQ_HASH_BUCKETS;
-}
-
 struct NCR_700_command_slot {
 	struct NCR_700_SG_List	SG[NCR_700_SG_SEGMENTS+1];
 	struct NCR_700_SG_List	*pSG;
@@ -186,12 +154,8 @@
 	/* if this command is a pci_single mapping, holds the dma address
 	 * for later unmapping in the done routine */
 	dma_addr_t	dma_handle;
-	/* Doubly linked ITL/ITLQ list kept in strict time order
-	 * (latest at the back) */
+	/* historical remnant, now used to link free commands */
 	struct NCR_700_command_slot *ITL_forw;
-	struct NCR_700_command_slot *ITL_back;
-	struct NCR_700_command_slot *ITLQ_forw;
-	struct NCR_700_command_slot *ITLQ_back;
 };
 
 struct NCR_700_Host_Parameters {
@@ -238,20 +202,15 @@
 	__u8	tag_negotiated;
 	__u8	rev;
 	__u8	reselection_id;
-	/* flags for the host */
-
-	/* ITL list.  ALL outstanding commands are hashed here in strict
-	 * order, latest at the back */
-	struct NCR_700_command_slot *ITL_Hash_forw[MAX_ITL_HASH_BUCKETS];
-	struct NCR_700_command_slot *ITL_Hash_back[MAX_ITL_HASH_BUCKETS];
-
-	/* Only tagged outstanding commands are hashed here (also latest
-	 * at the back) */
-	struct NCR_700_command_slot *ITLQ_Hash_forw[MAX_ITLQ_HASH_BUCKETS];
-	struct NCR_700_command_slot *ITLQ_Hash_back[MAX_ITLQ_HASH_BUCKETS];
 
 	/* Free list, singly linked by ITL_forw elements */
 	struct NCR_700_command_slot *free_list;
+	/* Completion for waited for ops, like reset, abort or
+	 * device reset.
+	 *
+	 * NOTE: relies on single threading in the error handler to
+	 * have only one outstanding at once */
+	struct completion *eh_complete;
 };
 
 /*
diff -Nru a/drivers/scsi/53c7xx.c b/drivers/scsi/53c7xx.c
--- a/drivers/scsi/53c7xx.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/scsi/53c7xx.c	Sun Feb 23 22:25:27 2003
@@ -5794,7 +5794,7 @@
  *	so we don't perturb hostdata.  We don't use a field of the 
  *	NCR53c7x0_cmd structure since we may not have allocated one 
  *	for the command causing the reset.) of Scsi_Cmnd structures that 
- *  	had propogated below the Linux issue queue level.  If free is set, 
+ *  	had propagated below the Linux issue queue level.  If free is set, 
  *	free the NCR53c7x0_cmd structures which are associated with 
  *	the Scsi_Cmnd structures, and clean up any internal 
  *	NCR lists that the commands were on.  If issue is set,
diff -Nru a/drivers/scsi/AM53C974.c b/drivers/scsi/AM53C974.c
--- a/drivers/scsi/AM53C974.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/scsi/AM53C974.c	Sun Feb 23 22:25:24 2003
@@ -680,7 +680,7 @@
 		printk(KERN_WARNING "AM53C974: Unable to register host, aborting.\n");
 		return 0;
 	}
-	scsi_set_pci_device(instance, pdev);
+	scsi_set_device(instance, &pdev->dev);
 	hostdata = (struct AM53C974_hostdata *) instance->hostdata;
 	instance->base = 0;
 	instance->io_port = pci_resource_start(pdev, 0);
diff -Nru a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
--- a/drivers/scsi/Kconfig	Sun Feb 23 22:25:26 2003
+++ b/drivers/scsi/Kconfig	Sun Feb 23 22:25:26 2003
@@ -129,6 +129,7 @@
 config SCSI_REPORT_LUNS
 	bool "Build with SCSI REPORT LUNS support"
 	depends on SCSI
+	default y
 	help
 	  If you want to build with SCSI REPORT LUNS support in the kernel, say Y here.
 	  The REPORT LUNS command is useful for devices (such as disk arrays) with
@@ -471,10 +472,6 @@
 	  SCSI-HOWTO, available from
 	  <http://www.linuxdoc.org/docs.html#howto>.
 
-	  Note that there is also another driver for the same hardware
-	  available: "EATA-DMA [Obsolete] (DPT, NEC, AT&T, SNI, AST, Olivetti,
-	  Alphatronix) support". You should say Y to only one of them.
-
 	  If you want to compile this as a module ( = code which can be
 	  inserted in and removed from the running kernel whenever you want),
 	  say M here and read <file:Documentation/modules.txt>.  The module
@@ -512,24 +509,6 @@
 	  by the driver for each probed SCSI device is reported at boot time.
 	  This is equivalent to the "eata=mq:8" boot option.
 
-config SCSI_EATA_DMA
-	tristate "EATA-DMA [Obsolete] (DPT, NEC, AT&T, SNI, AST, Olivetti, Alphatronix) support"
-	depends on SCSI
-	---help---
-	  This is support for the EATA-DMA protocol compliant SCSI Host
-	  Adapters like the SmartCache III/IV, SmartRAID controller families
-	  and the DPT PM2011B and PM2012B controllers.
-
-	  Note that this driver is obsolete; if you have one of the above
-	  SCSI Host Adapters, you should normally say N here and Y to "EATA
-	  ISA/EISA/PCI support", below.  Please read the SCSI-HOWTO, available
-	  from <http://www.linuxdoc.org/docs.html#howto>.
-
-	  This driver is also available as a module ( = code which can be
-	  inserted in and removed from the running kernel whenever you want).
-	  The module will be called eata_dma.  If you want to compile it as
-	  a module, say M here and read <file:Documentation/modules.txt>.
-
 config SCSI_EATA_PIO
 	tristate "EATA-PIO (old DPT PM2001, PM2012A) support"
 	depends on SCSI
@@ -1728,6 +1707,13 @@
 	  Y to this question.  If you're in doubt about whether you have one,
 	  see the picture at
 	  <http://amiga.multigraph.com/photos/oktagon.html>.
+
+config SCSI_PC980155
+	tristate "NEC PC-9801-55 SCSI support"
+	depends on X86_PC9800 && SCSI
+	help
+	  If you have the NEC PC-9801-55 SCSI interface card or compatibles
+	  for NEC PC-9801/PC-9821, say Y.
 
 #      bool 'Cyberstorm Mk III SCSI support (EXPERIMENTAL)' CONFIG_CYBERSTORMIII_SCSI
 #      bool 'GVP Turbo 040/060 SCSI support (EXPERIMENTAL)' CONFIG_GVP_TURBO_SCSI
diff -Nru a/drivers/scsi/Makefile b/drivers/scsi/Makefile
--- a/drivers/scsi/Makefile	Sun Feb 23 22:25:26 2003
+++ b/drivers/scsi/Makefile	Sun Feb 23 22:25:26 2003
@@ -82,7 +82,6 @@
 obj-$(CONFIG_SCSI_SYM53C8XX)	+= sym53c8xx.o 
 obj-$(CONFIG_SCSI_NCR53C8XX)	+= ncr53c8xx.o 
 obj-$(CONFIG_SCSI_ZALON)	+= zalon7xx.o
-obj-$(CONFIG_SCSI_EATA_DMA)	+= eata_dma.o
 obj-$(CONFIG_SCSI_EATA_PIO)	+= eata_pio.o
 obj-$(CONFIG_SCSI_7000FASST)	+= wd7000.o
 obj-$(CONFIG_SCSI_MCA_53C9X)	+= NCR53C9x.o	mca_53c9x.o
diff -Nru a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
--- a/drivers/scsi/aacraid/linit.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/scsi/aacraid/linit.c	Sun Feb 23 22:25:23 2003
@@ -217,7 +217,7 @@
 			host_ptr->irq = dev->irq;		/* Adapter IRQ number */
 			/* host_ptr->base = ( char * )(dev->resource[0].start & ~0xff); */
 			host_ptr->base = dev->resource[0].start;
-			scsi_set_pci_device(host_ptr, dev);
+			scsi_set_device(host_ptr, &dev->dev);
 			dprintk((KERN_DEBUG "Device base address = 0x%lx [0x%lx].\n", host_ptr->base, dev->resource[0].start));
 			dprintk((KERN_DEBUG "Device irq = 0x%x.\n", dev->irq));
 			/*
@@ -734,5 +734,3 @@
 	*start_ptr = proc_buffer;
 	return sprintf(proc_buffer, "%s  %d\n", "Raid Controller, scsi hba number", host_no);
 }
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
--- a/drivers/scsi/advansys.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/scsi/advansys.c	Sun Feb 23 22:25:23 2003
@@ -4791,9 +4791,8 @@
             if (shp == NULL) {
                 continue;
             }
-#ifdef CONFIG_PCI
-	    scsi_set_pci_device(shp, pci_devp);
-#endif
+
+	    scsi_set_device(shp, &pci_devp->dev);
 
             /* Save a pointer to the Scsi_host of each board found. */
             asc_host[asc_board_count++] = shp;
diff -Nru a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
--- a/drivers/scsi/aha152x.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/scsi/aha152x.c	Sun Feb 23 22:25:21 2003
@@ -306,9 +306,9 @@
 #define ERR_LEAD	KERN_ERR	LEAD
 #define DEBUG_LEAD	KERN_DEBUG	LEAD
 #define CMDINFO(cmd) \
-			(cmd) ? ((cmd)->host->host_no) : -1, \
-                        (cmd) ? ((cmd)->target & 0x0f) : -1, \
-			(cmd) ? ((cmd)->lun & 0x07) : -1
+			(cmd) ? ((cmd)->device->host->host_no) : -1, \
+                        (cmd) ? ((cmd)->device->id & 0x0f) : -1, \
+			(cmd) ? ((cmd)->device->lun & 0x07) : -1
 
 #define DELAY_DEFAULT 1000
 
@@ -583,8 +583,8 @@
 
 #define DATA_LEN		(HOSTDATA(shpnt)->data_len)
 
-#define SYNCRATE		(HOSTDATA(shpnt)->syncrate[CURRENT_SC->target])
-#define SYNCNEG			(HOSTDATA(shpnt)->syncneg[CURRENT_SC->target])
+#define SYNCRATE		(HOSTDATA(shpnt)->syncrate[CURRENT_SC->device->id])
+#define SYNCNEG			(HOSTDATA(shpnt)->syncneg[CURRENT_SC->device->id])
 
 #define DELAY			(HOSTDATA(shpnt)->delay)
 #define EXT_TRANS		(HOSTDATA(shpnt)->ext_trans)
@@ -771,7 +771,7 @@
 	Scsi_Cmnd *ptr, *prev;
 
 	for (ptr = *SC, prev = NULL;
-	     ptr && ((ptr->target != target) || (ptr->lun != lun));
+	     ptr && ((ptr->device->id != target) || (ptr->device->lun != lun));
 	     prev = ptr, ptr = SCNEXT(ptr))
 	     ;
 
@@ -1476,7 +1476,7 @@
  */
 int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct semaphore *sem, int phase, Scsi_Cmnd *done_SC, void (*done)(Scsi_Cmnd *))
 {
-	struct Scsi_Host *shpnt = SCpnt->host;
+	struct Scsi_Host *shpnt = SCpnt->device->host;
 	unsigned long flags;
 
 #if defined(AHA152X_DEBUG)
@@ -1589,7 +1589,7 @@
  */
 int aha152x_abort(Scsi_Cmnd *SCpnt)
 {
-	struct Scsi_Host *shpnt = SCpnt->host;
+	struct Scsi_Host *shpnt = SCpnt->device->host;
 	Scsi_Cmnd *ptr;
 	unsigned long flags;
 
@@ -1641,7 +1641,7 @@
 {
 	Scsi_Cmnd	 *SCp   = (Scsi_Cmnd *)p;
 	struct semaphore *sem   = SCSEM(SCp);
-	struct Scsi_Host *shpnt = SCp->host;
+	struct Scsi_Host *shpnt = SCp->device->host;
 
 	/* remove command from issue queue */
 	if(remove_SC(&ISSUE_SC, SCp)) {
@@ -1663,10 +1663,11 @@
  */
 int aha152x_device_reset(Scsi_Cmnd * SCpnt)
 {
-	struct Scsi_Host *shpnt = SCpnt->host;
+	struct Scsi_Host *shpnt = SCpnt->device->host;
 	DECLARE_MUTEX_LOCKED(sem);
 	struct timer_list timer;
-	Scsi_Cmnd cmnd;
+	Scsi_Cmnd *cmd;
+	int ret;
 
 #if defined(AHA152X_DEBUG)
 	if(HOSTDATA(shpnt)->debug & debug_eh) {
@@ -1680,31 +1681,42 @@
 		return FAILED;
 	}
 
-	cmnd.cmd_len         = 0;
-	cmnd.host            = SCpnt->host;
-	cmnd.target          = SCpnt->target;
-	cmnd.lun             = SCpnt->lun;
-	cmnd.use_sg          = 0;
-	cmnd.request_buffer  = 0;
-	cmnd.request_bufflen = 0;
+	spin_unlock_irq(shpnt->host_lock);
+	cmd = scsi_get_command(SCpnt->device, GFP_ATOMIC);
+	if (!cmd) {
+		spin_lock_irq(shpnt->host_lock);
+		return FAILED;
+	}
+
+	cmd->cmd_len         = 0;
+	cmd->device->host    = SCpnt->device->host;
+	cmd->device->id      = SCpnt->device->id;
+	cmd->device->lun     = SCpnt->device->lun;
+	cmd->use_sg          = 0;
+	cmd->request_buffer  = 0;
+	cmd->request_bufflen = 0;
 
 	init_timer(&timer);
-	timer.data     = (unsigned long) &cmnd;
+	timer.data     = (unsigned long) cmd;
 	timer.expires  = jiffies + 100*HZ;   /* 10s */
 	timer.function = (void (*)(unsigned long)) timer_expired;
 
-	aha152x_internal_queue(&cmnd, &sem, resetting, 0, internal_done);
+	aha152x_internal_queue(cmd, &sem, resetting, 0, internal_done);
 
 	add_timer(&timer);
 	down(&sem);
 
 	del_timer(&timer);
 
-	if(cmnd.SCp.phase & resetted) {
-		return SUCCESS;
+	if(cmd->SCp.phase & resetted) {
+		ret = SUCCESS;
 	} else {
-		return FAILED;
+		ret = FAILED;
 	}
+
+	scsi_put_command(cmd);
+	spin_lock_irq(shpnt->host_lock);
+	return ret;
 }
 
 void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs)
@@ -1738,7 +1750,7 @@
  */
 int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
 {
-	struct Scsi_Host *shpnt = SCpnt->host;
+	struct Scsi_Host *shpnt = SCpnt->device->host;
 	unsigned long flags;
 
 #if defined(AHA152X_DEBUG)
@@ -1822,7 +1834,7 @@
 	aha152x_bus_reset(SCpnt);
 
 	DPRINTK(debug_eh, DEBUG_LEAD "resetting ports\n", CMDINFO(SCpnt));
-	reset_ports(SCpnt->host);
+	reset_ports(SCpnt->device->host);
 
 	return SUCCESS;
 }
@@ -2052,9 +2064,9 @@
 					cmnd->cmnd[4]         = sizeof(ptr->sense_buffer);
 					cmnd->cmnd[5]         = 0;
 					cmnd->cmd_len	      = 6;
-					cmnd->host            = ptr->host;
-					cmnd->target          = ptr->target;
-					cmnd->lun             = ptr->lun;
+					cmnd->device->host    = ptr->device->host;
+					cmnd->device->id      = ptr->device->id;
+					cmnd->device->lun     = ptr->device->lun;
 					cmnd->use_sg          = 0; 
 					cmnd->request_buffer  = ptr->sense_buffer;
 					cmnd->request_bufflen = sizeof(ptr->sense_buffer);
@@ -2113,7 +2125,7 @@
 		/* clear selection timeout */
 		SETPORT(SSTAT1, SELTO);
 
-		SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->target);
+		SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->device->id);
 		SETPORT(SXFRCTL1, (PARITY ? ENSPCHK : 0 ) | ENSTIMER);
 		SETPORT(SCSISEQ, ENSELO | ENAUTOATNO | (DISCONNECTED_SC ? ENRESELI : 0));
 	} else {
@@ -2152,7 +2164,7 @@
 
 	SETPORT(SSTAT0, CLRSELDO);
 	
-	ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->lun));
+	ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun));
 
 	if (CURRENT_SC->SCp.phase & aborting) {
 		ADDMSGO(ABORT);
@@ -2472,7 +2484,7 @@
 {
 	if(MSGOLEN==0) {
 		if((CURRENT_SC->SCp.phase & syncneg) && SYNCNEG==2 && SYNCRATE==0) {
-			ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->lun));
+			ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun));
 		} else {
 			printk(INFO_LEAD "unexpected MESSAGE OUT phase; rejecting\n", CMDINFO(CURRENT_SC));
 			ADDMSGO(MESSAGE_REJECT);
@@ -3376,7 +3388,7 @@
 static void show_command(Scsi_Cmnd *ptr)
 {
 	printk(KERN_DEBUG "0x%08x: target=%d; lun=%d; cmnd=(",
-	       (unsigned int) ptr, ptr->target, ptr->lun);
+	       (unsigned int) ptr, ptr->device->id, ptr->device->lun);
 
 	print_command(ptr->cmnd);
 
@@ -3441,7 +3453,7 @@
 	int i;
 
 	SPRINTF("0x%08x: target=%d; lun=%d; cmnd=( ",
-		(unsigned int) ptr, ptr->target, ptr->lun);
+		(unsigned int) ptr, ptr->device->id, ptr->device->lun);
 
 	for (i = 0; i < COMMAND_SIZE(ptr->cmnd[0]); i++)
 		SPRINTF("0x%02x ", ptr->cmnd[i]);
diff -Nru a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h
--- a/drivers/scsi/aic7xxx/aic79xx.h	Sun Feb 23 22:25:25 2003
+++ b/drivers/scsi/aic7xxx/aic79xx.h	Sun Feb 23 22:25:25 2003
@@ -404,7 +404,7 @@
  * Initiator mode SCB shared data area.
  * If the embedded CDB is 12 bytes or less, we embed
  * the sense buffer address in the SCB.  This allows
- * us to retrieve sense information without interupting
+ * us to retrieve sense information without interrupting
  * the host in packetized mode.
  */
 typedef uint32_t sense_addr_t;
diff -Nru a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c	Sun Feb 23 22:25:24 2003
@@ -1826,7 +1826,7 @@
 	 * At least in 2.2.14, malloc is a slab allocator so all
 	 * allocations are aligned.  We assume for these kernel versions
 	 * that all allocations will be bellow 4Gig, physically contiguous,
-	 * and accessable via DMA by the controller.
+	 * and accessible via DMA by the controller.
 	 */
 	map = NULL; /* No additional information to store */
 	*vaddr = malloc(dmat->maxsize, M_DEVBUF, M_NOWAIT);
@@ -2381,7 +2381,9 @@
 		ahd_set_name(ahd, new_name);
 	}
 	host->unique_id = ahd->unit;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+	scsi_set_device(host, &ahd->dev_softc->dev);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4)
 	scsi_set_pci_device(host, ahd->dev_softc);
 #endif
 	ahd_linux_initialize_scsi_bus(ahd);
@@ -4268,6 +4270,7 @@
 		 */
 		hscb->control = 0;
 		hscb->scsiid = BUILD_SCSIID(ahd, cmd);
+		hscb->lun = cmd->device->lun;
 		scb->hscb->task_management = 0;
 		mask = SCB_GET_TARGET_MASK(ahd, scb);
 
diff -Nru a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c
--- a/drivers/scsi/aic7xxx/aic79xx_pci.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/scsi/aic7xxx/aic79xx_pci.c	Sun Feb 23 22:25:24 2003
@@ -740,7 +740,7 @@
 		if (i == 5)
 			continue;
 		pci_status[i] = ahd_inb(ahd, reg);
-		/* Clear latched errors.  So our interupt deasserts. */
+		/* Clear latched errors.  So our interrupt deasserts. */
 		ahd_outb(ahd, reg, pci_status[i]);
 	}
 
@@ -796,14 +796,14 @@
 
 		split_status[i] = ahd_inb(ahd, DCHSPLTSTAT0);
 		split_status1[i] = ahd_inb(ahd, DCHSPLTSTAT1);
-		/* Clear latched errors.  So our interupt deasserts. */
+		/* Clear latched errors.  So our interrupt deasserts. */
 		ahd_outb(ahd, DCHSPLTSTAT0, split_status[i]);
 		ahd_outb(ahd, DCHSPLTSTAT1, split_status1[i]);
 		if (i != 0)
 			continue;
 		sg_split_status[i] = ahd_inb(ahd, SGSPLTSTAT0);
 		sg_split_status1[i] = ahd_inb(ahd, SGSPLTSTAT1);
-		/* Clear latched errors.  So our interupt deasserts. */
+		/* Clear latched errors.  So our interrupt deasserts. */
 		ahd_outb(ahd, SGSPLTSTAT0, sg_split_status[i]);
 		ahd_outb(ahd, SGSPLTSTAT1, sg_split_status1[i]);
 	}
diff -Nru a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c	Sun Feb 23 22:25:21 2003
@@ -1435,7 +1435,7 @@
 	 * At least in 2.2.14, malloc is a slab allocator so all
 	 * allocations are aligned.  We assume for these kernel versions
 	 * that all allocations will be bellow 4Gig, physically contiguous,
-	 * and accessable via DMA by the controller.
+	 * and accessible via DMA by the controller.
 	 */
 	map = NULL; /* No additional information to store */
 	*vaddr = malloc(dmat->maxsize, M_DEVBUF, M_NOWAIT);
@@ -1861,7 +1861,9 @@
 		ahc_set_name(ahc, new_name);
 	}
 	host->unique_id = ahc->unit;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+	scsi_set_device(host, &ahc->dev_softc->dev);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4)
 	scsi_set_pci_device(host, ahc->dev_softc);
 #endif
 	ahc_linux_initialize_scsi_bus(ahc);
diff -Nru a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
--- a/drivers/scsi/aic7xxx_old.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/scsi/aic7xxx_old.c	Sun Feb 23 22:25:24 2003
@@ -8450,7 +8450,7 @@
     }
     p->host_no = host->host_no;
   }
-  scsi_set_pci_device(host, p->pdev);
+  scsi_set_device(host, &p->pdev->dev);
   return (p);
 }
 
diff -Nru a/drivers/scsi/cpqfcTSinit.c b/drivers/scsi/cpqfcTSinit.c
--- a/drivers/scsi/cpqfcTSinit.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/scsi/cpqfcTSinit.c	Sun Feb 23 22:25:21 2003
@@ -337,7 +337,7 @@
       DEBUG_PCI(printk("  PciDev->baseaddress[3]= %lx\n", 
 				PciDev->resource[3].start));
 
-      scsi_set_pci_device(HostAdapter, PciDev);      
+      scsi_set_device(HostAdapter, &PciDev->dev);
       HostAdapter->irq = PciDev->irq;  // copy for Scsi layers
       
       // HP Tachlite uses two (255-byte) ranges of Port I/O (lower & upper),
diff -Nru a/drivers/scsi/cpqioctl.c b/drivers/scsi/cpqioctl.c
--- a/drivers/scsi/cpqioctl.c	Sun Feb 23 22:25:23 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,76 +0,0 @@
-// Test program for CPQFCTS ioctl calls
-// build with:
-// gcc -o cpqioctl cpqioctl.c
-// ld -o cpqioctl /lib/crt0.o cpqioctl.o -lc
-
-#include <stdio.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <linux/types.h>
-#include "../../include/scsi/scsi.h"
-#include "cpqfcTSioctl.h"
-
-typedef struct scsi_fctargaddress {
-        unsigned long host_port_id;
-        unsigned char host_wwn[8];
-} Scsi_FCTargAddress;
-
-int main(int argc, char **argv) {
-
- int fd, i;
- Scsi_FCTargAddress targ;
- int uselect=0;
-
-
-
-  if ( argc < 2 ) {
-    printf("usage: cpqioctl <Devfile>\n");
-    exit(1);
-  }
-
-  if ( (fd = open(argv[1], O_RDONLY)) == -1) {
-    perror("open");
-    exit(1);
-  }
-
-  if ( ioctl(fd, SCSI_IOCTL_FC_TARGET_ADDRESS, &targ) ) {
-    perror("ioctl");
-    exit(1);
-  }
-
-
-  printf("portid: %08x. wwn: ", targ.host_port_id);
-
-  for (i=0;i<8;i++) printf(" %02x", targ.host_wwn[i]);
-  printf("\n");
-
- while( uselect != 27 ) // not ESC key
-  {
-    printf("\n IOCTL \n");
-    printf( "1. Get PCI info\n");
-    printf( "2. Send Passthru\n");
-    printf( " ==> ");
-    scanf("%c", &uselect);
-
-    switch( uselect  )
-    {
-      case '1':
-      {
-        cciss_pci_info_struct pciinfo;
-	
-  	if( ioctl( fd, CCPQFCTS_GETPCIINFO ,&pciinfo ))
-          perror("ioctl");
-	else
-          printf( "\nPCI bus %d, dev_fn %d, board_id %Xh\n",
-            pciinfo.bus, pciinfo.dev_fn, pciinfo.board_id);
-      }
-
-    }
-  }
-
-
-  close(fd);
-  return 0;
-} 
diff -Nru a/drivers/scsi/dmx3191d.c b/drivers/scsi/dmx3191d.c
--- a/drivers/scsi/dmx3191d.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/scsi/dmx3191d.c	Sun Feb 23 22:25:24 2003
@@ -86,7 +86,7 @@
 			release_region(port, DMX3191D_REGION);
 			continue;
 		}
-		scsi_set_pci_device(instance, pdev);
+		scsi_set_device(instance, &pdev->dev);
 		instance->io_port = port;
 		instance->irq = pdev->irq;
 		NCR5380_init(instance, FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E);
diff -Nru a/drivers/scsi/eata.c b/drivers/scsi/eata.c
--- a/drivers/scsi/eata.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/scsi/eata.c	Sun Feb 23 22:25:26 2003
@@ -1228,7 +1228,6 @@
       sh[j]->unchecked_isa_dma = FALSE;
    else {
       unsigned long flags;
-      scsi_register_blocked_host(sh[j]);
       sh[j]->unchecked_isa_dma = TRUE;
 
       flags=claim_dma_lock();
@@ -2352,8 +2351,6 @@
 
    if (sh[j] == NULL) panic("%s: release, invalid Scsi_Host pointer.\n",
                             driver_name);
-
-   if(sh[j]->unchecked_isa_dma) scsi_deregister_blocked_host(sh[j]);
 
    for (i = 0; i < sh[j]->can_queue; i++)
       if ((&HD(j)->cp[i])->sglist) kfree((&HD(j)->cp[i])->sglist);
diff -Nru a/drivers/scsi/eata_dma.c b/drivers/scsi/eata_dma.c
--- a/drivers/scsi/eata_dma.c	Sun Feb 23 22:25:21 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1572 +0,0 @@
-/************************************************************
- *							    *
- *		    Linux EATA SCSI driver		    *
- *							    *
- *  based on the CAM document CAM/89-004 rev. 2.0c,	    *
- *  DPT's driver kit, some internal documents and source,   *
- *  and several other Linux scsi drivers and kernel docs.   *
- *							    *
- *  The driver currently:				    *
- *	-supports all ISA based EATA-DMA boards		    *
- *       like PM2011, PM2021, PM2041, PM3021                *
- *	-supports all EISA based EATA-DMA boards	    *
- *       like PM2012B, PM2022, PM2122, PM2322, PM2042,      *
- *            PM3122, PM3222, PM3332                        *
- *	-supports all PCI based EATA-DMA boards		    *
- *       like PM2024, PM2124, PM2044, PM2144, PM3224,       *
- *            PM3334                                        *
- *      -supports the Wide, Ultra Wide and Differential     *
- *       versions of the boards                             *
- *	-supports multiple HBAs with & without IRQ sharing  *
- *	-supports all SCSI channels on multi channel boards *
- *      -supports ix86 and MIPS, untested on ALPHA          *
- *	-needs identical IDs on all channels of a HBA	    * 
- *	-can be loaded as module			    *
- *	-displays statistical and hardware information	    *
- *	 in /proc/scsi/eata_dma				    *
- *      -provides rudimentary latency measurement           * 
- *       possibilities via /proc/scsi/eata_dma/<hostnum>    *
- *							    *
- *  (c)1993-96 Michael Neuffer			            *
- *             mike@i-Connect.Net                           *
- *	       neuffer@mail.uni-mainz.de	            *
- *							    *
- *  This program is free software; you can redistribute it  *
- *  and/or modify it under the terms of the GNU General	    *
- *  Public License as published by the Free Software	    *
- *  Foundation; either version 2 of the License, or	    *
- *  (at your option) any later version.			    *
- *							    *
- *  This program is distributed in the hope that it will be *
- *  useful, but WITHOUT ANY WARRANTY; without even the	    *
- *  implied warranty of MERCHANTABILITY or FITNESS FOR A    *
- *  PARTICULAR PURPOSE.	 See the GNU General Public License *
- *  for more details.					    *
- *							    *
- *  You should have received a copy of the GNU General	    *
- *  Public License along with this kernel; if not, write to *
- *  the Free Software Foundation, Inc., 675 Mass Ave,	    *
- *  Cambridge, MA 02139, USA.				    *
- *							    *
- * I have to thank DPT for their excellent support. I took  *
- * me almost a year and a stopover at their HQ, on my first *
- * trip to the USA, to get it, but since then they've been  *
- * very helpful and tried to give me all the infos and	    *
- * support I need.					    *
- *							    *
- * Thanks also to Simon Shapiro, Greg Hosler and Mike       *
- * Jagdis who did a lot of testing and found quite a number *
- * of bugs during the development.                          *
- ************************************************************
- *  last change: 96/10/21                 OS: Linux 2.0.23  *
- ************************************************************/
-
-/* Look in eata_dma.h for configuration and revision information */
-
-#error Please convert me to Documentation/DMA-mapping.txt
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/string.h>
-#include <linux/ioport.h>
-#include <linux/slab.h>
-#include <linux/in.h>
-#include <linux/pci.h>
-#include <linux/proc_fs.h>
-#include <linux/delay.h>
-#include <asm/byteorder.h>
-#include <asm/types.h>
-#include <asm/io.h>
-#include <asm/dma.h>
-#include <asm/pgtable.h>
-#ifdef __mips__
-#include <asm/cachectl.h>
-#include <linux/spinlock.h>
-#endif
-#include <linux/blk.h>
-#include "scsi.h"
-#include "hosts.h"
-#include "eata_dma.h"
-#include "eata_dma_proc.h" 
-
-#include <linux/stat.h>
-#include <linux/config.h>	/* for CONFIG_PCI */
-
-static u32 ISAbases[] =
-{0x1F0, 0x170, 0x330, 0x230};
-static unchar EISAbases[] =
-{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
-static uint registered_HBAs = 0;
-static struct Scsi_Host *last_HBA = NULL;
-static struct Scsi_Host *first_HBA = NULL;
-static unchar reg_IRQ[] =
-{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-static unchar reg_IRQL[] =
-{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-static struct eata_sp *status = 0;   /* Statuspacket array   */
-static void *dma_scratch = 0;
-
-static struct eata_register *fake_int_base;
-static int fake_int_result;
-static int fake_int_happened;
-
-static ulong int_counter = 0;
-static ulong queue_counter = 0;
-
-void eata_fake_int_handler(s32 irq, void *dev_id, struct pt_regs * regs)
-{
-    fake_int_result = inb((ulong)fake_int_base + HA_RSTATUS);
-    fake_int_happened = TRUE;
-    DBG(DBG_INTR3, printk("eata_fake_int_handler called irq%d base %p"
-			  " res %#x\n", irq, fake_int_base, fake_int_result));
-    return;
-}
-
-#include "eata_dma_proc.c"
-
-#ifdef MODULE
-int eata_release(struct Scsi_Host *sh)
-{
-    uint i;
-    if (sh->irq && reg_IRQ[sh->irq] == 1) free_irq(sh->irq, NULL);
-    else reg_IRQ[sh->irq]--;
-    
-    kfree((void *)status);
-    kfree((void *)dma_scratch - 4);
-    for (i = 0; i < sh->can_queue; i++){ /* Free all SG arrays */
-	if(SD(sh)->ccb[i].sg_list != NULL)
-	    kfree((void *) SD(sh)->ccb[i].sg_list);
-    }
-    
-    if (SD(sh)->channel == 0) {
-	if (sh->dma_channel != BUSMASTER) free_dma(sh->dma_channel);
-	if (sh->io_port && sh->n_io_port)
-	    release_region(sh->io_port, sh->n_io_port);
-    }
-    return(TRUE);
-}
-#endif
-
-
-inline void eata_latency_in(struct eata_ccb *cp, hostdata *hd)
-{
-    uint time;
-    time = jiffies - cp->timestamp;
-    if(hd->all_lat[1] > time)
-        hd->all_lat[1] = time;
-    if(hd->all_lat[2] < time)
-        hd->all_lat[2] = time;
-    hd->all_lat[3] += time;
-    hd->all_lat[0]++;
-    if((cp->rw_latency) == WRITE) { /* was WRITE */
-        if(hd->writes_lat[cp->sizeindex][1] > time)
-	    hd->writes_lat[cp->sizeindex][1] = time;
-	if(hd->writes_lat[cp->sizeindex][2] < time)
-	    hd->writes_lat[cp->sizeindex][2] = time;
-	hd->writes_lat[cp->sizeindex][3] += time;
-	hd->writes_lat[cp->sizeindex][0]++;
-    } else if((cp->rw_latency) == READ) {
-        if(hd->reads_lat[cp->sizeindex][1] > time)
-	    hd->reads_lat[cp->sizeindex][1] = time;
-	if(hd->reads_lat[cp->sizeindex][2] < time)
-	    hd->reads_lat[cp->sizeindex][2] = time;
-	hd->reads_lat[cp->sizeindex][3] += time;
-	hd->reads_lat[cp->sizeindex][0]++;
-    }
-} 
-
-inline void eata_latency_out(struct eata_ccb *cp, Scsi_Cmnd *cmd)
-{
-    int x, z;
-    short *sho;
-    long *lon;
-    x = 0;	                        /* just to keep GCC quiet */ 
-    cp->timestamp = jiffies;	        /* For latency measurements */
-    switch(cmd->cmnd[0]) {
-    case WRITE_6:   
-        x = cmd->cmnd[4]/2; 
-	cp->rw_latency = WRITE;
-	break;
-    case READ_6:    
-        x = cmd->cmnd[4]/2; 
-	cp->rw_latency = READ;
-	break;
-    case WRITE_10:   
-        sho = (short *) &cmd->cmnd[7];
-	x = ntohs(*sho)/2;	      
-	cp->rw_latency = WRITE;
-	break;
-    case READ_10:
-        sho = (short *) &cmd->cmnd[7];
-	x = ntohs(*sho)/2;	      
-	cp->rw_latency = READ;
-	break;
-    case WRITE_12:   
-        lon = (long *) &cmd->cmnd[6];
-	x = ntohl(*lon)/2;	      
-	cp->rw_latency = WRITE;
-	break;
-    case READ_12:
-        lon = (long *) &cmd->cmnd[6];
-	x = ntohl(*lon)/2;	      
-	cp->rw_latency = READ;
-	break;
-    default:
-        cp->rw_latency = OTHER;
-	break;
-    }
-    if (cmd->cmnd[0] == WRITE_6 || cmd->cmnd[0] == WRITE_10 || 
-	cmd->cmnd[0] == WRITE_12 || cmd->cmnd[0] == READ_6 || 
-	cmd->cmnd[0] == READ_10 || cmd->cmnd[0] == READ_12) {
-        for(z = 0; (x > (1 << z)) && (z <= 11); z++) 
-	    /* nothing */;
-	cp->sizeindex = z;
-    } 
-}
-
-void eata_int_handler(int, void *, struct pt_regs *);
-
-void do_eata_int_handler(int irq, void *dev_id, struct pt_regs * regs)
-{
-    unsigned long flags;
-    struct Scsi_Host *dev = dev_id;
-    
-    spin_lock_irqsave(dev->host_lock, flags);
-    eata_int_handler(irq, dev_id, regs);
-    spin_unlock_irqrestore(dev->host_lock, flags);
-}
-
-void eata_int_handler(int irq, void *dev_id, struct pt_regs * regs)
-{
-    uint i, result = 0;
-    uint hba_stat, scsi_stat, eata_stat;
-    Scsi_Cmnd *cmd;
-    struct eata_ccb *ccb;
-    struct eata_sp *sp;
-    uint base;
-    uint x;
-    struct Scsi_Host *sh;
-
-    for (x = 1, sh = first_HBA; x <= registered_HBAs; x++, sh = SD(sh)->next) {
-	if (sh->irq != irq)
-	    continue;
-	
-	while(inb((uint)sh->base + HA_RAUXSTAT) & HA_AIRQ) {
-	    
-	    int_counter++;
-	    
-	    sp = &SD(sh)->sp;
-#ifdef __mips__
-            sys_cacheflush(sp, sizeof(struct eata_sp), 2);
-#endif
-	    ccb = sp->ccb;
-	    
-	    if(ccb == NULL) {
-		eata_stat = inb((uint)sh->base + HA_RSTATUS);
-		printk("eata_dma: int_handler, Spurious IRQ %d "
-		       "received. CCB pointer not set.\n", irq);
-		break;
-	    }
-
-	    cmd = ccb->cmd;
-	    base = (uint) cmd->device->host->base;
-       	    hba_stat = sp->hba_stat;
-	    
-	    scsi_stat = (sp->scsi_stat >> 1) & 0x1f; 
-	    
-	    if (sp->EOC == FALSE) {
-		eata_stat = inb(base + HA_RSTATUS);
-		printk(KERN_WARNING "eata_dma: int_handler, board: %x cmd %lx "
-		       "returned unfinished.\n"
-		       "EATA: %x HBA: %x SCSI: %x spadr %lx spadrirq %lx, "
-		       "irq%d\n", base, (long)ccb, eata_stat, hba_stat, 
-		       scsi_stat,(long)&status, (long)&status[irq], irq);
-		cmd->result = DID_ERROR << 16;
-		ccb->status = FREE;
-		cmd->scsi_done(cmd);
-		break;
-	    } 
-	    
-           sp->EOC = FALSE; /* Clean out this flag */
-
-           if (ccb->status == LOCKED || ccb->status == RESET) {
-               printk("eata_dma: int_handler, reseted command pid %ld returned"
-		      "\n", cmd->pid);
-	       DBG(DBG_INTR && DBG_DELAY, DELAY(1));
-	    }
-	    
-	    eata_stat = inb(base + HA_RSTATUS); 
-	    DBG(DBG_INTR, printk("IRQ %d received, base %#.4x, pid %ld, "
-				 "target: %x, lun: %x, ea_s: %#.2x, hba_s: "
-				 "%#.2x \n", irq, base, cmd->pid, cmd->device->id,
-				 cmd->device->lun, eata_stat, hba_stat));
-	    
-	    switch (hba_stat) {
-	    case HA_NO_ERROR:	/* NO Error */
-		if(HD(cmd)->do_latency == TRUE && ccb->timestamp) 
-		    eata_latency_in(ccb, HD(cmd));
-		result = DID_OK << 16;
-		break;
-	    case HA_ERR_SEL_TO:	        /* Selection Timeout */
-	    case HA_ERR_CMD_TO:	        /* Command Timeout   */
-		result = DID_TIME_OUT << 16;
-		break;
-	    case HA_BUS_RESET:		/* SCSI Bus Reset Received */
-		result = DID_RESET << 16;
-		DBG(DBG_STATUS, printk(KERN_WARNING "scsi%d: BUS RESET "
-				       "received on cmd %ld\n", 
-				       HD(cmd)->HBA_number, cmd->pid));
-		break;
-	    case HA_INIT_POWERUP:	/* Initial Controller Power-up */
-		if (cmd->device->type != TYPE_TAPE)
-		    result = DID_BUS_BUSY << 16;
-		else
-		    result = DID_ERROR << 16;
-		
-		for (i = 0; i < MAXTARGET; i++)
-		DBG(DBG_STATUS, printk(KERN_DEBUG "scsi%d: cmd pid %ld "
-				       "returned with INIT_POWERUP\n", 
-				       HD(cmd)->HBA_number, cmd->pid));
-		break;
-	    case HA_CP_ABORT_NA:
-	    case HA_CP_ABORTED:
-		result = DID_ABORT << 16;
-		DBG(DBG_STATUS, printk(KERN_WARNING "scsi%d: aborted cmd "
-				       "returned\n", HD(cmd)->HBA_number));
- 		break;
-	    case HA_CP_RESET_NA:
-	    case HA_CP_RESET:
-	        HD(cmd)->resetlevel[cmd->device->channel] = 0; 
-		result = DID_RESET << 16;
-		DBG(DBG_STATUS, printk(KERN_WARNING "scsi%d: reseted cmd "
-				       "pid %ldreturned\n", 
-				       HD(cmd)->HBA_number, cmd->pid));
-	    case HA_SCSI_HUNG:	        /* SCSI Hung                 */
-	        printk(KERN_ERR "scsi%d: SCSI hung\n", HD(cmd)->HBA_number);
-		result = DID_ERROR << 16;
-		break;
-	    case HA_RSENSE_FAIL:        /* Auto Request-Sense Failed */
-	        DBG(DBG_STATUS, printk(KERN_ERR "scsi%d: Auto Request Sense "
-				       "Failed\n", HD(cmd)->HBA_number));
-		result = DID_ERROR << 16;
-		break;
-	    case HA_UNX_BUSPHASE:	/* Unexpected Bus Phase */
-	    case HA_UNX_BUS_FREE:	/* Unexpected Bus Free */
-	    case HA_BUS_PARITY:	        /* Bus Parity Error */
-	    case HA_UNX_MSGRJCT:	/* Unexpected Message Reject */
-	    case HA_RESET_STUCK:        /* SCSI Bus Reset Stuck */
-	    case HA_PARITY_ERR:	        /* Controller Ram Parity */
-	    default:
-		result = DID_ERROR << 16;
-		break;
-	    }
-	    cmd->result = result | (scsi_stat << 1); 
-	    
-#if DBG_INTR2
-	    if (scsi_stat || result || hba_stat || eata_stat != 0x50 
-		|| cmd->scsi_done == NULL || cmd->device->id == 7) 
-		printk("HBA: %d, channel %d, id: %d, lun %d, pid %ld:\n" 
-		       "eata_stat %#x, hba_stat %#.2x, scsi_stat %#.2x, "
-		       "sense_key: %#x, result: %#.8x\n", x, 
-		       cmd->device->channel, cmd->device->id, cmd->device->lun,
-		       cmd->pid, eata_stat, hba_stat, scsi_stat, 
-		       cmd->sense_buffer[2] & 0xf, cmd->result); 
-	    DBG(DBG_INTR&&DBG_DELAY,DELAY(1));
-#endif
-	    
-	    ccb->status = FREE;	    /* now we can release the slot  */
-	    cmd->scsi_done(cmd);
-	}
-    }
-
-    return;
-}
-
-inline int eata_send_command(u32 addr, u32 base, u8 command)
-{
-    long loop = R_LIMIT;
-    
-    while (inb(base + HA_RAUXSTAT) & HA_ABUSY)
-	if (--loop == 0)
-	    return(FALSE);
-
-    if(addr != (u32) NULL)
-        addr = virt_to_bus((void *)addr);
-
-    /*
-     * This is overkill.....but the MIPSen seem to need this
-     * and it will be optimized away for i86 and ALPHA machines.
-     */
-    flush_cache_all();
-
-    /* And now the address in nice little byte chunks */
-#ifdef __LITTLE_ENDIAN
-    outb(addr,       base + HA_WDMAADDR);
-    outb(addr >> 8,  base + HA_WDMAADDR + 1);
-    outb(addr >> 16, base + HA_WDMAADDR + 2);
-    outb(addr >> 24, base + HA_WDMAADDR + 3);
-#else
-    outb(addr >> 24, base + HA_WDMAADDR);
-    outb(addr >> 16, base + HA_WDMAADDR + 1);
-    outb(addr >> 8,  base + HA_WDMAADDR + 2);
-    outb(addr,       base + HA_WDMAADDR + 3);
-#endif
-    outb(command, base + HA_WCOMMAND);
-    return(TRUE);
-}
-
-inline int eata_send_immediate(u32 base, u32 addr, u8 ifc, u8 code, u8 code2)
-{
-    if(addr != (u32) NULL)
-        addr = virt_to_bus((void *)addr);
-
-    /*
-     * This is overkill.....but the MIPSen seem to need this
-     * and it will be optimized away for i86 and ALPHA machines.
-     */
-    flush_cache_all();
-
-    outb(0x0, base + HA_WDMAADDR - 1);
-    if(addr){
-#ifdef __LITTLE_ENDIAN
-        outb(addr,       base + HA_WDMAADDR);
-	outb(addr >> 8,  base + HA_WDMAADDR + 1);
-	outb(addr >> 16, base + HA_WDMAADDR + 2);
-	outb(addr >> 24, base + HA_WDMAADDR + 3);
-#else
-        outb(addr >> 24, base + HA_WDMAADDR);
-	outb(addr >> 16, base + HA_WDMAADDR + 1);
-	outb(addr >> 8,  base + HA_WDMAADDR + 2);
-	outb(addr,       base + HA_WDMAADDR + 3);
-#endif
-    } else {
-        outb(0x0, base + HA_WDMAADDR);
-        outb(0x0, base + HA_WDMAADDR + 1);
- 	outb(code2, base + HA_WCODE2);
-	outb(code,  base + HA_WCODE);
-    }
-    
-    outb(ifc, base + HA_WIFC);
-    outb(EATA_CMD_IMMEDIATE, base + HA_WCOMMAND);
-    return(TRUE);
-}
-
-int eata_queue(Scsi_Cmnd * cmd, void (* done) (Scsi_Cmnd *))
-{
-    unsigned int i, x, y;
-    ulong flags;
-    hostdata *hd;
-    struct Scsi_Host *sh;
-    struct eata_ccb *ccb;
-    struct scatterlist *sl;
-
-    
-    save_flags(flags);
-    cli();
-
-#if 0
-    for (x = 1, sh = first_HBA; x <= registered_HBAs; x++, sh = SD(sh)->next) {
-      if(inb((uint)sh->base + HA_RAUXSTAT) & HA_AIRQ) {
-            printk("eata_dma: scsi%d interrupt pending in eata_queue.\n"
-		   "          Calling interrupt handler.\n", sh->host_no);
-            eata_int_handler(sh->irq, 0, 0);
-      }
-    }
-#endif
-    
-    queue_counter++;
-
-    hd = HD(cmd);
-    sh = cmd->device->host;
-    
-    if (cmd->cmnd[0] == REQUEST_SENSE && cmd->sense_buffer[0] != 0) {
-        DBG(DBG_REQSENSE, printk(KERN_DEBUG "Tried to REQUEST SENSE\n"));
-	cmd->result = DID_OK << 16;
-	done(cmd);
-	restore_flags(flags);
-
-	return(0);
-    }
-
-    /* check for free slot */
-    for (y = hd->last_ccb + 1, x = 0; x < sh->can_queue; x++, y++) { 
-	if (y >= sh->can_queue)
-	    y = 0;
-	if (hd->ccb[y].status == FREE)
-	    break;
-    }
-    
-    hd->last_ccb = y;
-
-    if (x >= sh->can_queue) { 
-	cmd->result = DID_BUS_BUSY << 16;
-	DBG(DBG_QUEUE && DBG_ABNORM, 
-	    printk(KERN_CRIT "eata_queue pid %ld, HBA QUEUE FULL..., "
-		   "returning DID_BUS_BUSY\n", cmd->pid));
-	done(cmd);
-	restore_flags(flags);
-	return(0);
-    }
-    ccb = &hd->ccb[y];
-    
-    memset(ccb, 0, sizeof(struct eata_ccb) - sizeof(struct eata_sg_list *));
-    
-    ccb->status = USED;			/* claim free slot */
-
-    restore_flags(flags);
-    
-    DBG(DBG_QUEUE, printk("eata_queue pid %ld, target: %x, lun: %x, y %d\n",
-			  cmd->pid, cmd->device->id, cmd->device->lun, y));
-    DBG(DBG_QUEUE && DBG_DELAY, DELAY(1));
-    
-    if(hd->do_latency == TRUE) 
-        eata_latency_out(ccb, cmd);
-
-    cmd->scsi_done = (void *)done;
-    
-    switch (cmd->cmnd[0]) {
-    case CHANGE_DEFINITION: case COMPARE:	  case COPY:
-    case COPY_VERIFY:	    case LOG_SELECT:	  case MODE_SELECT:
-    case MODE_SELECT_10:    case SEND_DIAGNOSTIC: case WRITE_BUFFER:
-    case FORMAT_UNIT:	    case REASSIGN_BLOCKS: case RESERVE:
-    case SEARCH_EQUAL:	    case SEARCH_HIGH:	  case SEARCH_LOW:
-    case WRITE_6:	    case WRITE_10:	  case WRITE_VERIFY:
-    case UPDATE_BLOCK:	    case WRITE_LONG:	  case WRITE_SAME:	
-    case SEARCH_HIGH_12:    case SEARCH_EQUAL_12: case SEARCH_LOW_12:
-    case WRITE_12:	    case WRITE_VERIFY_12: case SET_WINDOW: 
-    case MEDIUM_SCAN:	    case SEND_VOLUME_TAG:	     
-    case 0xea:	    /* alternate number for WRITE LONG */
-	ccb->DataOut = TRUE;	/* Output mode */
-	break;
-    case TEST_UNIT_READY:
-    default:
-	ccb->DataIn = TRUE;	/* Input mode  */
-    }
-
-    /* FIXME: This will will have to be changed once the midlevel driver 
-     *        allows different HBA IDs on every channel.
-     */
-    if (cmd->device->id == sh->this_id) 
-	ccb->Interpret = TRUE;	/* Interpret command */
-
-    if (cmd->use_sg) {
-	ccb->scatter = TRUE;	/* SG mode     */
-	if (ccb->sg_list == NULL) {
-	    ccb->sg_list = kmalloc(sh->sg_tablesize * sizeof(struct eata_sg_list),
-				  GFP_ATOMIC | GFP_DMA);
-	}
-	if (ccb->sg_list == NULL)
-	{
-	    /*
-	     *	Claim the bus was busy. Actually we are the problem but this
-	     *  will do a deferred retry for us ;)
-	     */
-	    printk(KERN_ERR "eata_dma: Run out of DMA memory for SG lists !\n");
-	    cmd->result = DID_BUS_BUSY << 16;
-	    ccb->status = FREE;    
-	    done(cmd);
-	    return(0);
-	}
-	ccb->cp_dataDMA = htonl(virt_to_bus(ccb->sg_list)); 
-	
-	ccb->cp_datalen = htonl(cmd->use_sg * sizeof(struct eata_sg_list));
-	sl=(struct scatterlist *)cmd->request_buffer;
-	for(i = 0; i < cmd->use_sg; i++, sl++){
-	    ccb->sg_list[i].data = htonl(virt_to_bus(sl->address));
-	    ccb->sg_list[i].len = htonl((u32) sl->length);
-	}
-    } else {
-	ccb->scatter = FALSE;
-	ccb->cp_datalen = htonl(cmd->request_bufflen);
-	ccb->cp_dataDMA = htonl(virt_to_bus(cmd->request_buffer));
-    }
-    
-    ccb->Auto_Req_Sen = TRUE;
-    ccb->cp_reqDMA = htonl(virt_to_bus(cmd->sense_buffer));
-    ccb->reqlen = sizeof(cmd->sense_buffer);
-    
-    ccb->cp_id = cmd->device->id;
-    ccb->cp_channel = cmd->device->channel;
-    ccb->cp_lun = cmd->device->lun;
-    ccb->cp_dispri = TRUE;
-    ccb->cp_identify = TRUE;
-    memcpy(ccb->cp_cdb, cmd->cmnd, cmd->cmd_len);
-    
-    ccb->cp_statDMA = htonl(virt_to_bus(&(hd->sp)));
-    
-    ccb->cp_viraddr = ccb; /* This will be passed thru, so we don't need to 
-			    * convert it */
-    ccb->cmd = cmd;
-    cmd->host_scribble = (char *)&hd->ccb[y];	
-    
-    if(eata_send_command((u32) ccb, (u32) sh->base, EATA_CMD_DMA_SEND_CP) == FALSE) {
-	cmd->result = DID_BUS_BUSY << 16;
-	DBG(DBG_QUEUE && DBG_ABNORM, 
-	    printk("eata_queue target %d, pid %ld, HBA busy, "
-		   "returning DID_BUS_BUSY\n",cmd->device->id, cmd->pid));
-	ccb->status = FREE;    
-	done(cmd);
-	return(0);
-    }
-    DBG(DBG_QUEUE, printk("Queued base %#.4x pid: %ld target: %x lun: %x "
-			 "slot %d irq %d\n", (s32)sh->base, cmd->pid, 
-			 cmd->device->id, cmd->device->lun, y, sh->irq));
-    DBG(DBG_QUEUE && DBG_DELAY, DELAY(1));
-
-    return(0);
-}
-
-
-int eata_abort(Scsi_Cmnd * cmd)
-{
-    ulong loop = HZ / 2;
-    ulong flags;
-    int x;
-    struct Scsi_Host *sh;
- 
-    save_flags(flags);
-    cli();
-
-    DBG(DBG_ABNORM, printk("eata_abort called pid: %ld target: %x lun: %x"
-			   " reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun, 
-			   cmd->abort_reason));
-    DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
-
-    /* Some interrupt controllers seem to loose interrupts */
-    for (x = 1, sh = first_HBA; x <= registered_HBAs; x++, sh = SD(sh)->next) {
-        if(inb((uint)sh->base + HA_RAUXSTAT) & HA_AIRQ) {
-            printk("eata_dma: scsi%d interrupt pending in eata_abort.\n"
-		   "          Calling interrupt handler.\n", sh->host_no);
-	    eata_int_handler(sh->irq, 0, 0);
-	}
-    }
-
-    while (inb((u32)(cmd->device->host->base) + HA_RAUXSTAT) & HA_ABUSY) {
-	if (--loop == 0) {
-	    printk("eata_dma: abort, timeout error.\n");
-	    DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
-	    restore_flags(flags);
-	    return (SCSI_ABORT_ERROR);
-	}
-    }
-    if (CD(cmd)->status == RESET) {
-	printk("eata_dma: abort, command reset error.\n");
-	DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
-	restore_flags(flags);
-	return (SCSI_ABORT_ERROR);
-    }
-    if (CD(cmd)->status == LOCKED) {
-	DBG(DBG_ABNORM, printk("eata_dma: abort, queue slot locked.\n"));
-	DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
-	restore_flags(flags);
-	return (SCSI_ABORT_NOT_RUNNING);
-    }
-    if (CD(cmd)->status == USED) {
-	DBG(DBG_ABNORM, printk("Returning: SCSI_ABORT_BUSY\n"));
-	restore_flags(flags);
-	return (SCSI_ABORT_BUSY);  /* SNOOZE */ 
-    }
-    if (CD(cmd)->status == FREE) {
-	DBG(DBG_ABNORM, printk("Returning: SCSI_ABORT_NOT_RUNNING\n")); 
-	restore_flags(flags);
-	return (SCSI_ABORT_NOT_RUNNING);
-    }
-    restore_flags(flags);
-    panic("eata_dma: abort: invalid slot status\n");
-}
-
-int eata_reset(Scsi_Cmnd * cmd, unsigned int resetflags)
-{
-    uint x; 
-    /* 10 million PCI reads take at least one third of a second */
-    ulong loop = 10 * 1000 * 1000;
-    ulong flags;
-    unchar success = FALSE;
-    Scsi_Cmnd *sp; 
-    struct Scsi_Host *sh;
-    
-    save_flags(flags);
-    cli();
-    
-    DBG(DBG_ABNORM, printk("eata_reset called pid:%ld target: %x lun: %x"
-			   " reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun, 
-			   cmd->abort_reason));
-	
-    for (x = 1, sh = first_HBA; x <= registered_HBAs; x++, sh = SD(sh)->next) {
-        if(inb((uint)sh->base + HA_RAUXSTAT) & HA_AIRQ) {
-            printk("eata_dma: scsi%d interrupt pending in eata_reset.\n"
-		   "          Calling interrupt handler.\n", sh->host_no);
-            eata_int_handler(sh->irq, 0, 0);
-      }
-    }
-
-    if (HD(cmd)->state == RESET) {
-	printk("eata_reset: exit, already in reset.\n");
-	restore_flags(flags);
-	DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
-	return (SCSI_RESET_ERROR);
-    }
-    
-    while (inb((u32)(cmd->device->host->base) + HA_RAUXSTAT) & HA_ABUSY)
-	if (--loop == 0) {
-	    printk("eata_reset: exit, timeout error.\n");
-	    restore_flags(flags);
-	    DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
-	    return (SCSI_RESET_ERROR);
-	}
- 
-    for (x = 0; x < cmd->device->host->can_queue; x++) {
-	if (HD(cmd)->ccb[x].status == FREE)
-	    continue;
-
-	if (HD(cmd)->ccb[x].status == LOCKED) {
-	    HD(cmd)->ccb[x].status = FREE;
-	    printk("eata_reset: locked slot %d forced free.\n", x);
-	    DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
-	    continue;
-	}
-
-
-	sp = HD(cmd)->ccb[x].cmd;
-	HD(cmd)->ccb[x].status = RESET;
-	
-	if (sp == NULL)
-	    panic("eata_reset: slot %d, sp==NULL.\n", x);
-
-	printk("eata_reset: slot %d in reset, pid %ld.\n", x, sp->pid);
-
-	DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
-	
-	if (sp == cmd)
-	    success = TRUE;
-    }
-    
-    /* hard reset the HBA  */
-    inb((u32) (cmd->device->host->base) + HA_RSTATUS);	/* This might cause trouble */
-    eata_send_command(0, (u32) cmd->device->host->base, EATA_CMD_RESET);
-    
-    HD(cmd)->state = RESET;
-
-    DBG(DBG_ABNORM, printk("eata_reset: board reset done, enabling "
-			   "interrupts.\n"));
-
-    DELAY(2); /* In theorie we should get interrupts and set free all
-	       * used queueslots */
-    
-    DBG(DBG_ABNORM, printk("eata_reset: interrupts disabled again.\n"));
-    DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
-    
-    for (x = 0; x < cmd->device->host->can_queue; x++) {
-	
-	/* Skip slots already set free by interrupt and those that 
-         * are still LOCKED from the last reset */
-	if (HD(cmd)->ccb[x].status != RESET)
-	    continue;
-	
-	sp = HD(cmd)->ccb[x].cmd;
-	sp->result = DID_RESET << 16;
-	
-	/* This mailbox is still waiting for its interrupt */
-	HD(cmd)->ccb[x].status = LOCKED;
-	
-	printk("eata_reset: slot %d locked, DID_RESET, pid %ld done.\n",
-	       x, sp->pid);
-	DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
-
-	sp->scsi_done(sp);
-    }
-    
-    HD(cmd)->state = FALSE;
-    restore_flags(flags);
-    
-    if (success) {
-	DBG(DBG_ABNORM, printk("eata_reset: exit, pending.\n"));
-	DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
-	return (SCSI_RESET_PENDING);
-    } else {
-	DBG(DBG_ABNORM, printk("eata_reset: exit, wakeup.\n"));
-	DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
-	return (SCSI_RESET_PUNT);
-    }
-}
-
-/* Here we try to determine the optimum queue depth for
- * each attached device.
- *
- * At the moment the algorithm is rather simple
- */
-static void eata_select_queue_depths(struct Scsi_Host *host, 
-				     Scsi_Device *devicelist)
-{
-    Scsi_Device *device;
-    int devcount = 0; 
-    int factor = 0;
-
-#if CRIPPLE_QUEUE    
-    for(device = devicelist; device != NULL; device = device->next) {
-        if(device->host == host)
-	    device->queue_depth = 2;
-    }
-#else
-    /* First we do a sample run go find out what we have */
-    for(device = devicelist; device != NULL; device = device->next) {
-        if (device->host == host) {
-	    devcount++;
-	    switch(device->type) {
-	    case TYPE_DISK:
-	    case TYPE_MOD:
-	        factor += TYPE_DISK_QUEUE;
-		break;
-	    case TYPE_TAPE:
-	        factor += TYPE_TAPE_QUEUE;
-		break;
-	    case TYPE_WORM:
-	    case TYPE_ROM:
-	        factor += TYPE_ROM_QUEUE;
-		break;
-	    case TYPE_PROCESSOR:
-	    case TYPE_SCANNER:
-	    default:
-	        factor += TYPE_OTHER_QUEUE;
-		break;
-	    }
-	}
-    }
-
-    DBG(DBG_REGISTER, printk(KERN_DEBUG "scsi%d: needed queueslots %d\n", 
-			     host->host_no, factor));
-
-    if(factor == 0)    /* We don't want to get a DIV BY ZERO error */
-        factor = 1;
-
-    factor = (SD(host)->queuesize * 10) / factor;
-
-    DBG(DBG_REGISTER, printk(KERN_DEBUG "scsi%d: using factor %dE-1\n", 
-			     host->host_no, factor));
-
-    /* Now that have the factor we can set the individual queuesizes */
-    for(device = devicelist; device != NULL; device = device->next) {
-        if(device->host == host) {
-	    if(SD(device->host)->bustype != IS_ISA){
-	        switch(device->type) {
-		case TYPE_DISK:
-		case TYPE_MOD:
-		    device->queue_depth = (TYPE_DISK_QUEUE * factor) / 10;
-		    break;
-		case TYPE_TAPE:
-		    device->queue_depth = (TYPE_TAPE_QUEUE * factor) / 10;
-		    break;
-		case TYPE_WORM:
-		case TYPE_ROM:
-	            device->queue_depth = (TYPE_ROM_QUEUE * factor) / 10;
-		    break;
-		case TYPE_PROCESSOR:
-		case TYPE_SCANNER:
-		default:
-		    device->queue_depth = (TYPE_OTHER_QUEUE * factor) / 10;
-		    break;
-		}
-	    } else /* ISA forces us to limit the queue depth because of the 
-		    * bounce buffer memory overhead. I know this is cruel */
-	        device->queue_depth = 2; 
-
-	    /* 
-	     * It showed that we need to set an upper limit of commands 
-             * we can allow to  queue for a single device on the bus. 
-	     * If we get above that limit, the broken midlevel SCSI code 
-	     * will produce bogus timeouts and aborts en masse. :-(
-	     */
-	    if(device->queue_depth > UPPER_DEVICE_QUEUE_LIMIT)
-		device->queue_depth = UPPER_DEVICE_QUEUE_LIMIT;
-	    if(device->queue_depth == 0) 
-		device->queue_depth = 1;
-
-	    printk(KERN_INFO "scsi%d: queue depth for target %d on channel %d "
-		   "set to %d\n", host->host_no, device->id, device->channel,
-		   device->queue_depth);
-	}
-    }
-#endif
-}
-
-#if CHECK_BLINK
-int check_blink_state(long base)
-{
-    ushort loops = 10;
-    u32 blinkindicator;
-    u32 state = 0x12345678;
-    u32 oldstate = 0;
-
-    blinkindicator = htonl(0x54504442);
-    while ((loops--) && (state != oldstate)) {
-	oldstate = state;
-	state = inl((uint) base + 1);
-    }
-
-    DBG(DBG_BLINK, printk("Did Blink check. Status: %d\n",
-	      (state == oldstate) && (state == blinkindicator)));
-
-    if ((state == oldstate) && (state == blinkindicator))
-	return(TRUE);
-    else
-	return (FALSE);
-}
-#endif
-
-char * get_board_data(u32 base, u32 irq, u32 id)
-{
-    struct eata_ccb *cp;
-    struct eata_sp  *sp;
-    static char *buff;
-    ulong i;
-
-    cp = (struct eata_ccb *) kmalloc(sizeof(struct eata_ccb),
-				     GFP_ATOMIC | GFP_DMA);
-				     
-    if(cp==NULL)
-    	return NULL;
-    	
-    sp = (struct eata_sp *) kmalloc(sizeof(struct eata_sp), 
-					     GFP_ATOMIC | GFP_DMA);
-    if(sp==NULL)
-    {
-        kfree(cp);
-        return NULL;
-    }				  
-
-    buff = dma_scratch;
- 
-    memset(cp, 0, sizeof(struct eata_ccb));
-    memset(sp, 0, sizeof(struct eata_sp));
-    memset(buff, 0, 256);
-
-    cp->DataIn = TRUE;	   
-    cp->Interpret = TRUE;   /* Interpret command */
-    cp->cp_dispri = TRUE;
-    cp->cp_identify = TRUE;
- 
-    cp->cp_datalen = htonl(56);  
-    cp->cp_dataDMA = htonl(virt_to_bus(buff));
-    cp->cp_statDMA = htonl(virt_to_bus(sp));
-    cp->cp_viraddr = cp;
-    
-    cp->cp_id = id;
-    cp->cp_lun = 0;
-
-    cp->cp_cdb[0] = INQUIRY;
-    cp->cp_cdb[1] = 0;
-    cp->cp_cdb[2] = 0;
-    cp->cp_cdb[3] = 0;
-    cp->cp_cdb[4] = 56;
-    cp->cp_cdb[5] = 0;
-
-    fake_int_base = (struct eata_register *) base;
-    fake_int_result = FALSE;
-    fake_int_happened = FALSE;
-
-    eata_send_command((u32) cp, (u32) base, EATA_CMD_DMA_SEND_CP);
-    
-    i = jiffies + (3 * HZ);
-    while (fake_int_happened == FALSE && time_before_eq(jiffies, i)) 
-	barrier();
-    
-    DBG(DBG_INTR3, printk(KERN_DEBUG "fake_int_result: %#x hbastat %#x "
-			  "scsistat %#x, buff %p sp %p\n",
-			  fake_int_result, (u32) (sp->hba_stat /*& 0x7f*/), 
-			  (u32) sp->scsi_stat, buff, sp));
-
-    kfree((void *)cp);
-    kfree((void *)sp);
-    
-    if ((fake_int_result & HA_SERROR) || time_after(jiffies, i)){
-	printk(KERN_WARNING "eata_dma: trying to reset HBA at %x to clear "
-	       "possible blink state\n", base); 
-	/* hard reset the HBA  */
-	inb((u32) (base) + HA_RSTATUS);
-	eata_send_command(0, base, EATA_CMD_RESET);
-	DELAY(1);
-	return (NULL);
-    } else
-	return (buff);
-}
-
-
-int get_conf_PIO(u32 base, struct get_conf *buf)
-{
-    ulong loop = R_LIMIT;
-    u16 *p;
-
-    if(check_region(base, 9)) 
-	return (FALSE);
-     
-    memset(buf, 0, sizeof(struct get_conf));
-
-    while (inb(base + HA_RSTATUS) & HA_SBUSY)
-	if (--loop == 0) 
-	    return (FALSE);
-
-    fake_int_base = (struct eata_register *) base;
-    fake_int_result = FALSE;
-    fake_int_happened = FALSE;
-       
-    DBG(DBG_PIO && DBG_PROBE,
-	printk("Issuing PIO READ CONFIG to HBA at %#x\n", base));
-    eata_send_command(0, base, EATA_CMD_PIO_READ_CONFIG);
-
-    loop = R_LIMIT;
-    for (p = (u16 *) buf; 
-	 (long)p <= ((long)buf + (sizeof(struct get_conf) / 2)); p++) {
-	while (!(inb(base + HA_RSTATUS) & HA_SDRQ))
-	    if (--loop == 0)
-		return (FALSE);
-
-	loop = R_LIMIT;
-	*p = inw(base + HA_RDATA);
-    }
-
-    if (!(inb(base + HA_RSTATUS) & HA_SERROR)) {	    /* Error ? */
-	if (htonl(EATA_SIGNATURE) == buf->signature) {
-	    DBG(DBG_PIO&&DBG_PROBE, printk("EATA Controller found at %x "
-					   "EATA Level: %x\n", (uint) base, 
-					   (uint) (buf->version)));
-	    
-	    while (inb(base + HA_RSTATUS) & HA_SDRQ) 
-		inw(base + HA_RDATA);
-	    return (TRUE);
-	} 
-    } else {
-	DBG(DBG_PROBE, printk("eata_dma: get_conf_PIO, error during transfer "
-		  "for HBA at %lx\n", (long)base));
-    }
-    return (FALSE);
-}
-
-
-void print_config(struct get_conf *gc)
-{
-    printk("LEN: %d ver:%d OCS:%d TAR:%d TRNXFR:%d MORES:%d DMAS:%d\n",
-	   (u32) ntohl(gc->len), gc->version,
-	   gc->OCS_enabled, gc->TAR_support, gc->TRNXFR, gc->MORE_support,
-	   gc->DMA_support);
-    printk("DMAV:%d HAAV:%d SCSIID0:%d ID1:%d ID2:%d QUEUE:%d SG:%d SEC:%d\n",
-	   gc->DMA_valid, gc->HAA_valid, gc->scsi_id[3], gc->scsi_id[2],
-	   gc->scsi_id[1], ntohs(gc->queuesiz), ntohs(gc->SGsiz), gc->SECOND);
-    printk("IRQ:%d IRQT:%d DMAC:%d FORCADR:%d SG_64K:%d SG_UAE:%d MID:%d "
-	   "MCH:%d MLUN:%d\n",
-	   gc->IRQ, gc->IRQ_TR, (8 - gc->DMA_channel) & 7, gc->FORCADR, 
-	   gc->SG_64K, gc->SG_UAE, gc->MAX_ID, gc->MAX_CHAN, gc->MAX_LUN); 
-    printk("RIDQ:%d PCI:%d EISA:%d\n",
-	   gc->ID_qest, gc->is_PCI, gc->is_EISA);
-    DBG(DPT_DEBUG, DELAY(14));
-}
-
-short register_HBA(u32 base, struct get_conf *gc, Scsi_Host_Template * tpnt, 
-		   u8 bustype)
-{
-    ulong size = 0;
-    unchar dma_channel = 0;
-    char *buff = 0;
-    unchar bugs = 0;
-    struct Scsi_Host *sh;
-    hostdata *hd;
-    int x;
-    
-    
-    DBG(DBG_REGISTER, print_config(gc));
-
-    if (gc->DMA_support == FALSE) {
-	printk("The EATA HBA at %#.4x does not support DMA.\n" 
-	       "Please use the EATA-PIO driver.\n", base);
-	return (FALSE);
-    }
-    if(gc->HAA_valid == FALSE || ntohl(gc->len) < 0x22) 
-	gc->MAX_CHAN = 0;
-
-    if (reg_IRQ[gc->IRQ] == FALSE) {	/* Interrupt already registered ? */
-	if (!request_irq(gc->IRQ, (void *) eata_fake_int_handler, SA_INTERRUPT,
-			 "eata_dma", NULL)){
-	    reg_IRQ[gc->IRQ]++;
-	    if (!gc->IRQ_TR)
-		reg_IRQL[gc->IRQ] = TRUE;   /* IRQ is edge triggered */
-	} else {
-	    printk("Couldn't allocate IRQ %d, Sorry.", gc->IRQ);
-	    return (FALSE);
-	}
-    } else {		/* More than one HBA on this IRQ */
-	if (reg_IRQL[gc->IRQ] == TRUE) {
-	    printk("Can't support more than one HBA on this IRQ,\n"
-		   "  if the IRQ is edge triggered. Sorry.\n");
-	    return (FALSE);
-	} else
-	    reg_IRQ[gc->IRQ]++;
-    }
-
- 
-    /* If DMA is supported but DMA_valid isn't set to indicate that
-     * the channel number is given we must have pre 2.0 firmware (1.7?)
-     * which leaves us to guess since the "newer ones" also don't set the 
-     * DMA_valid bit.
-     */
-    if (gc->DMA_support && !gc->DMA_valid && gc->DMA_channel) {
-      printk(KERN_WARNING "eata_dma: If you are using a pre 2.0 firmware "
-	     "please update it !\n"
-	     "          You can get new firmware releases from ftp.dpt.com\n");
-	gc->DMA_channel = (base == 0x1f0 ? 3 /* DMA=5 */ : 2 /* DMA=6 */);
-	gc->DMA_valid = TRUE;
-    }
-
-    /* if gc->DMA_valid it must be an ISA HBA and we have to register it */
-    dma_channel = BUSMASTER;
-    if (gc->DMA_valid) {
-	if (request_dma(dma_channel = (8 - gc->DMA_channel) & 7, "eata_dma")) {
-	    printk(KERN_WARNING "Unable to allocate DMA channel %d for ISA HBA"
-		   " at %#.4x.\n", dma_channel, base);
-	    reg_IRQ[gc->IRQ]--;
-	    if (reg_IRQ[gc->IRQ] == 0)
-		free_irq(gc->IRQ, NULL);
-	    if (gc->IRQ_TR == FALSE)
-		reg_IRQL[gc->IRQ] = FALSE; 
-	    return (FALSE);
-	}
-    }
-
-    if (dma_channel != BUSMASTER) {
-	disable_dma(dma_channel);
-	clear_dma_ff(dma_channel);
-	set_dma_mode(dma_channel, DMA_MODE_CASCADE);
-	enable_dma(dma_channel);
-    }
-
-    if (bustype != IS_EISA && bustype != IS_ISA)
-	buff = get_board_data(base, gc->IRQ, gc->scsi_id[3]);
-
-    if (buff == NULL) {
-	if (bustype == IS_EISA || bustype == IS_ISA) {
-	    bugs = bugs || BROKEN_INQUIRY;
-	} else {
-	    if (gc->DMA_support == FALSE)
-		printk(KERN_WARNING "HBA at %#.4x doesn't support DMA. "
-		       "Sorry\n", base);
-	    else
-		printk(KERN_WARNING "HBA at %#.4x does not react on INQUIRY. "
-		       "Sorry.\n", base);
-	    if (gc->DMA_valid) 
-		free_dma(dma_channel);
-	    reg_IRQ[gc->IRQ]--;
-	    if (reg_IRQ[gc->IRQ] == 0)
-		free_irq(gc->IRQ, NULL);
-	    if (gc->IRQ_TR == FALSE)
-		reg_IRQL[gc->IRQ] = FALSE; 
-	    return (FALSE);
-	}
-    }
- 
-    if (gc->DMA_support == FALSE && buff != NULL)  
-	printk(KERN_WARNING "HBA %.12sat %#.4x doesn't set the DMA_support "
-	       "flag correctly.\n", &buff[16], base);
-    
-    request_region(base, 9, "eata_dma"); /* We already checked the 
-					  * availability, so this
-					  * should not fail.
-					  */
-    
-    if(ntohs(gc->queuesiz) == 0) {
-	gc->queuesiz = ntohs(64);
-	printk(KERN_WARNING "Warning: Queue size has to be corrected. Assuming"
-	       " 64 queueslots\n"
-	       "         This might be a PM2012B with a defective Firmware\n"
-	       "         Contact DPT support@dpt.com for an upgrade\n");
-    }
-
-    size = sizeof(hostdata) + ((sizeof(struct eata_ccb) + sizeof(long)) 
-			       * ntohs(gc->queuesiz));
-
-    DBG(DBG_REGISTER, printk("scsi_register size: %ld\n", size));
-
-    sh = scsi_register(tpnt, size);
-    
-    if(sh != NULL) {
-
-        hd = SD(sh);		   
-
-	memset(hd->reads, 0, sizeof(u32) * 26); 
-	
-	sh->select_queue_depths = eata_select_queue_depths;
-	
-	hd->bustype = bustype;
-
-	/*
-	 * If we are using a ISA board, we can't use extended SG,
-	 * because we would need excessive amounts of memory for
-	 * bounce buffers.
-	 */
-	if (gc->SG_64K==TRUE && ntohs(gc->SGsiz)==64 && hd->bustype!=IS_ISA){
-	    sh->sg_tablesize = SG_SIZE_BIG;
-	} else {
-	    sh->sg_tablesize = ntohs(gc->SGsiz);
-	    if (sh->sg_tablesize > SG_SIZE || sh->sg_tablesize == 0) {
-	        if (sh->sg_tablesize == 0)
-		    printk(KERN_WARNING "Warning: SG size had to be fixed.\n"
-			   "This might be a PM2012 with a defective Firmware"
-			   "\nContact DPT support@dpt.com for an upgrade\n");
-		sh->sg_tablesize = SG_SIZE;
-	    }
-	}
-	hd->sgsize = sh->sg_tablesize;
-    }
-
-    if(sh != NULL) {
-        sh->can_queue = hd->queuesize = ntohs(gc->queuesiz);
-       	sh->cmd_per_lun = 0;
-    }
-
-    if(sh == NULL) { 
-        DBG(DBG_REGISTER, printk(KERN_NOTICE "eata_dma: couldn't register HBA"
-				 " at%x \n", base));
-	scsi_unregister(sh);
-	if (gc->DMA_valid) 
-	    free_dma(dma_channel);
-	
-	reg_IRQ[gc->IRQ]--;
-	if (reg_IRQ[gc->IRQ] == 0)
-	    free_irq(gc->IRQ, NULL);
-	if (gc->IRQ_TR == FALSE)
-	    reg_IRQL[gc->IRQ] = FALSE; 
-	return (FALSE);
-    }
-
-    
-    hd->broken_INQUIRY = (bugs & BROKEN_INQUIRY);
-
-    if(hd->broken_INQUIRY == TRUE) {
-	strcpy(hd->vendor, "DPT");
-	strcpy(hd->name, "??????????");
-	strcpy(hd->revision, "???.?");
-        hd->firmware_revision = 0;
-    } else {	
-	strncpy(hd->vendor, &buff[8], 8);
-	hd->vendor[8] = 0;
-	strncpy(hd->name, &buff[16], 17);
-	hd->name[17] = 0;
-	hd->revision[0] = buff[32];
-	hd->revision[1] = buff[33];
-	hd->revision[2] = buff[34];
-	hd->revision[3] = '.';
-	hd->revision[4] = buff[35];
-	hd->revision[5] = 0;
-        hd->firmware_revision = (buff[32] << 24) + (buff[33] << 16) 
-	                            + (buff[34] << 8) + buff[35]; 
-    }
-
-    if (hd->firmware_revision >= (('0'<<24) + ('7'<<16) + ('G'<< 8) + '0'))
-        hd->immediate_support = 1;
-    else 
-        hd->immediate_support = 0;
-
-    switch (ntohl(gc->len)) {
-    case 0x1c:
-	hd->EATA_revision = 'a';
-	break;
-    case 0x1e:
-	hd->EATA_revision = 'b';
-	break;
-    case 0x22:
-	hd->EATA_revision = 'c';
-	break;
-    case 0x24:
-	hd->EATA_revision = 'z';		
-    default:
-	hd->EATA_revision = '?';
-    }
-
-
-    if(ntohl(gc->len) >= 0x22) {
-	sh->max_id = gc->MAX_ID + 1;
-	sh->max_lun = gc->MAX_LUN + 1;
-    } else {
-	sh->max_id = 8;
-	sh->max_lun = 8;
-    }
-
-    hd->HBA_number = sh->host_no;
-    hd->channel = gc->MAX_CHAN;	    
-    sh->max_channel = gc->MAX_CHAN; 
-    sh->unique_id = base;
-    sh->base = base;
-    sh->io_port = base;
-    sh->n_io_port = 9;
-    sh->irq = gc->IRQ;
-    sh->dma_channel = dma_channel;
-    
-    /* FIXME:
-     * SCSI midlevel code should support different HBA ids on every channel
-     */
-    sh->this_id = gc->scsi_id[3];
-    
-    if (gc->SECOND)
-	hd->primary = FALSE;
-    else
-	hd->primary = TRUE;
-    
-    if (hd->bustype != IS_ISA) {
-	sh->unchecked_isa_dma = FALSE;
-    } else {
-	sh->unchecked_isa_dma = TRUE;	/* We're doing ISA DMA */
-    }
-    
-    for(x = 0; x <= 11; x++){		 /* Initialize min. latency */
-	hd->writes_lat[x][1] = 0xffffffff;
-	hd->reads_lat[x][1] = 0xffffffff;
-    }
-    hd->all_lat[1] = 0xffffffff;
-
-    hd->next = NULL;	/* build a linked list of all HBAs */
-    hd->prev = last_HBA;
-    if(hd->prev != NULL)
-	SD(hd->prev)->next = sh;
-    last_HBA = sh;
-    if (first_HBA == NULL)
-	first_HBA = sh;
-    registered_HBAs++;
-    
-    return (TRUE);
-}
-
-
-
-void find_EISA(struct get_conf *buf, Scsi_Host_Template * tpnt)
-{
-    u32 base;
-    int i;
-    
-#if CHECKPAL
-    u8 pal1, pal2, pal3;
-#endif
-    
-    for (i = 0; i < MAXEISA; i++) {
-	if (EISAbases[i] == TRUE) { /* Still a possibility ?	      */
-	    
-	    base = 0x1c88 + (i * 0x1000);
-#if CHECKPAL
-	    pal1 = inb((u16)base - 8);
-	    pal2 = inb((u16)base - 7);
-	    pal3 = inb((u16)base - 6);
-	    
-	    if (((pal1 == DPT_ID1) && (pal2 == DPT_ID2)) ||
-		((pal1 == NEC_ID1) && (pal2 == NEC_ID2) && (pal3 == NEC_ID3))||
-		((pal1 == ATT_ID1) && (pal2 == ATT_ID2) && (pal3 == ATT_ID3))){
-		DBG(DBG_PROBE, printk("EISA EATA id tags found: %x %x %x \n",
-				      (int)pal1, (int)pal2, (int)pal3));
-#endif
-		if (get_conf_PIO(base, buf) == TRUE) {
-		    if (buf->IRQ) {  
-			DBG(DBG_EISA, printk("Registering EISA HBA\n"));
-			register_HBA(base, buf, tpnt, IS_EISA);
-		    } else
-			printk("eata_dma: No valid IRQ. HBA removed from list\n");
-		}
-#if CHECK_BLINK
-		else {
-		    if (check_blink_state(base)) 
-			printk("HBA is in BLINK state. Consult your HBAs "
-			       "Manual to correct this.\n");
-		} 
-#endif
-		/* Nothing found here so we take it from the list */
-		EISAbases[i] = 0;  
-#if CHECKPAL
-	    } 
-#endif
-	}
-    }
-    return; 
-}
-
-void find_ISA(struct get_conf *buf, Scsi_Host_Template * tpnt)
-{
-    int i;
-    
-    for (i = 0; i < MAXISA; i++) {  
-	if (ISAbases[i]) {  
-	    if (get_conf_PIO(ISAbases[i],buf) == TRUE){
-		DBG(DBG_ISA, printk("Registering ISA HBA\n"));
-		register_HBA(ISAbases[i], buf, tpnt, IS_ISA);
-	    } 
-#if CHECK_BLINK
-	    else {
-		if (check_blink_state(ISAbases[i])) 
-		    printk("HBA is in BLINK state. Consult your HBAs "
-			   "Manual to correct this.\n");
-	    }
-#endif
-	    ISAbases[i] = 0;
-	}
-    }
-    return;
-}
-
-void find_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt)
-{
-#ifndef CONFIG_PCI
-    printk("eata_dma: kernel PCI support not enabled. Skipping scan for PCI HBAs.\n");
-#else
-    struct pci_dev *dev = NULL; 
-    u32 base, x;
-    u8 pal1, pal2, pal3;
-
-    while ((dev = pci_find_device(PCI_VENDOR_ID_DPT, PCI_DEVICE_ID_DPT, dev)) != NULL) {
-	    DBG(DBG_PROBE && DBG_PCI, 
-		printk("eata_dma: find_PCI, HBA at %s\n", dev->name));
-	    if (pci_enable_device(dev))
-	    	continue;
-	    pci_set_master(dev);
-	    base = pci_resource_flags(dev, 0);
-	    if (base & IORESOURCE_MEM) {
-		printk("eata_dma: invalid base address of device %s\n", dev->name);
-		continue;
-	    }
-	    base = pci_resource_start(dev, 0);
-            /* EISA tag there ? */
-	    pal1 = inb(base);
-	    pal2 = inb(base + 1);
-	    pal3 = inb(base + 2);
-	    if (((pal1 == DPT_ID1) && (pal2 == DPT_ID2)) ||
-		((pal1 == NEC_ID1) && (pal2 == NEC_ID2) && 
-		(pal3 == NEC_ID3)) ||
-		((pal1 == ATT_ID1) && (pal2 == ATT_ID2) && 
-		(pal3 == ATT_ID3)))
-		base += 0x08;
-	    else
-		base += 0x10;   /* Now, THIS is the real address */
-	    if (base != 0x1f8) {
-		/* We didn't find it in the primary search */
-		if (get_conf_PIO(base, buf) == TRUE) {
-		    /* OK. We made it till here, so we can go now  
-		     * and register it. We only have to check and 
-		     * eventually remove it from the EISA and ISA list 
-		     */
-		    DBG(DBG_PCI, printk("Registering PCI HBA\n"));
-		    register_HBA(base, buf, tpnt, IS_PCI);
-		    
-		    if (base < 0x1000) {
-			for (x = 0; x < MAXISA; ++x) {
-			    if (ISAbases[x] == base) {
-				ISAbases[x] = 0;
-				break;
-			    }
-			}
-		    } else if ((base & 0x0fff) == 0x0c88) 
-			EISAbases[(base >> 12) & 0x0f] = 0;
-		} 
-#if CHECK_BLINK
-		else if (check_blink_state(base) == TRUE) {
-		    printk("eata_dma: HBA is in BLINK state.\n"
-			   "Consult your HBAs manual to correct this.\n");
-		}
-#endif
-	    }
-	}
-#endif /* #ifndef CONFIG_PCI */
-}
-
-int eata_detect(Scsi_Host_Template * tpnt)
-{
-    struct Scsi_Host *HBA_ptr;
-    struct get_conf gc;
-    int i;
-    
-    DBG((DBG_PROBE && DBG_DELAY) || DPT_DEBUG,
-	printk("Using lots of delays to let you read the debugging output\n"));
-
-    tpnt->proc_name = "eata_dma";
-
-    status = kmalloc(512, GFP_ATOMIC | GFP_DMA);
-    dma_scratch = kmalloc(1024, GFP_ATOMIC | GFP_DMA);
-
-    if(status == NULL || dma_scratch == NULL) {
-	printk("eata_dma: can't allocate enough memory to probe for hosts !\n");
-	if(status)
-		kfree(status);
-	if(dma_scratch)
-		kfree(dma_scratch);
-	return(0);
-    }
-
-    dma_scratch += 4;
-
-    find_PCI(&gc, tpnt);
-    
-    find_EISA(&gc, tpnt);
-    
-    find_ISA(&gc, tpnt);
-    
-    for (i = 0; i <= MAXIRQ; i++) { /* Now that we know what we have, we     */
-	if (reg_IRQ[i] >= 1){       /* exchange the interrupt handler which  */
-	    free_irq(i, NULL);      /* we used for probing with the real one */
-	    request_irq(i, (void *)(do_eata_int_handler), SA_INTERRUPT|SA_SHIRQ, 
-			"eata_dma", first_HBA); /* Check it */
-	}
-    }
-
-    HBA_ptr = first_HBA;
-
-    if (registered_HBAs != 0) {
-        printk("EATA (Extended Attachment) driver version: %d.%d%s"
-               "\ndeveloped in co-operation with DPT\n"
-               "(c) 1993-96 Michael Neuffer, mike@i-Connect.Net\n",
-               VER_MAJOR, VER_MINOR, VER_SUB);
-        printk("Registered HBAs:");
-        printk("\nHBA no. Boardtype    Revis  EATA Bus  BaseIO IRQ"
-               " DMA Ch ID Pr QS  S/G IS\n");
-        for (i = 1; i <= registered_HBAs; i++) {
-    	    printk("scsi%-2d: %.12s v%s 2.0%c %s %#.4x  %2d",
-		   HBA_ptr->host_no, SD(HBA_ptr)->name, SD(HBA_ptr)->revision,
-		   SD(HBA_ptr)->EATA_revision, (SD(HBA_ptr)->bustype == 'P')? 
-		   "PCI ":(SD(HBA_ptr)->bustype == 'E')?"EISA":"ISA ",
-		   (u32) HBA_ptr->base, HBA_ptr->irq);
-	    if(HBA_ptr->dma_channel != BUSMASTER)
-		printk("  %2x ", HBA_ptr->dma_channel);
-	    else
-		printk(" %s", "BMST");
-	    printk(" %d  %d  %c %3d %3d %c\n", 
-		   SD(HBA_ptr)->channel+1, HBA_ptr->this_id, 
-		   (SD(HBA_ptr)->primary == TRUE)?'Y':'N', 
-		   HBA_ptr->can_queue, HBA_ptr->sg_tablesize, 
-		   (SD(HBA_ptr)->immediate_support == TRUE)?'Y':'N'); 
-	    HBA_ptr = SD(HBA_ptr)->next;
-	}
-    } else {
-	kfree((void *)status);
-    }
-
-    kfree((void *)dma_scratch - 4);
-
-    DBG(DPT_DEBUG, DELAY(12));
-
-    return(registered_HBAs);
-}
-
-MODULE_LICENSE("GPL");
-
-/* Eventually this will go into an include file, but this will be later */
-static Scsi_Host_Template driver_template = EATA_DMA;
-#include "scsi_module.c"
-
-/*
- * Overrides for Emacs so that we almost follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-indent-level: 4
- * c-brace-imaginary-offset: 0
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * c-continued-statement-offset: 4
- * c-continued-brace-offset: 0
- * tab-width: 8
- * End:
- */
diff -Nru a/drivers/scsi/eata_dma.h b/drivers/scsi/eata_dma.h
--- a/drivers/scsi/eata_dma.h	Sun Feb 23 22:25:27 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,114 +0,0 @@
-/********************************************************
-* Header file for eata_dma.c Linux EATA-DMA SCSI driver *
-* (c) 1993-96 Michael Neuffer                           *
-*             mike@i-Connect.Net                        *
-*             neuffer@mail.uni-mainz.de                 *
-*********************************************************
-* last change: 96/10/14                                 *
-********************************************************/
-
-#ifndef _EATA_DMA_H
-#define _EATA_DMA_H
-
-#include "eata_generic.h"
-
-
-#define VER_MAJOR 2
-#define VER_MINOR 5
-#define VER_SUB   "9b"
-
-
-/************************************************************************
- * Here you can switch parts of the code on and of                      *
- ************************************************************************/
-
-#define CHECKPAL        0        /* EISA pal checking on/off            */
-#define CHECK_BLINK     1        /* Switch Blink state check off, might *
-                                  * be nessessary for some MIPS machines*/ 
-#define CRIPPLE_QUEUE   0        /* Only enable this if the interrupt 
-                                  * controller on your motherboard is 
-                                  * broken and you are experiencing 
-                                  * massive interrupt losses */
-
-/************************************************************************
- * Debug options.                                                       * 
- * Enable DEBUG and whichever options you require.                      *
- ************************************************************************/
-#define DEBUG_EATA      1       /* Enable debug code.                   */
-#define DPT_DEBUG       0       /* Bobs special                         */
-#define DBG_DELAY       0       /* Build in delays so debug messages can be
-				 * be read before they vanish of the top of
-				 * the screen!                          */
-#define DBG_PROBE       0       /* Debug probe routines.                */
-#define DBG_PCI         0       /* Trace PCI routines                   */
-#define DBG_EISA        0       /* Trace EISA routines                  */
-#define DBG_ISA         0       /* Trace ISA routines                   */ 
-#define DBG_BLINK       0       /* Trace Blink check                    */
-#define DBG_PIO         0       /* Trace get_config_PIO                 */
-#define DBG_COM         0       /* Trace command call                   */
-#define DBG_QUEUE       0       /* Trace command queueing.              */
-#define DBG_QUEUE2      0       /* Trace command queueing SG.           */
-#define DBG_INTR        0       /* Trace interrupt service routine.     */
-#define DBG_INTR2       0       /* Trace interrupt service routine.     */
-#define DBG_INTR3       0       /* Trace get_board_data interrupts.     */
-#define DBG_REQSENSE    0       /* Trace request sense commands         */     
-#define DBG_RESET       0       /* Trace reset calls                    */     
-#define DBG_STATUS      0       /* Trace status generation              */
-#define DBG_PROC        0       /* Debug proc-fs related statistics     */
-#define DBG_PROC_WRITE  0
-#define DBG_REGISTER    0       /* */
-#define DBG_ABNORM      1       /* Debug abnormal actions (reset, abort)*/
-
-#if DEBUG_EATA 
-#define DBG(x, y)   if ((x)) {y;} 
-#else
-#define DBG(x, y)
-#endif
-
-int eata_detect(Scsi_Host_Template *);
-const char *eata_info(struct Scsi_Host *);
-int eata_command(Scsi_Cmnd *);
-int eata_queue(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *));
-int eata_abort(Scsi_Cmnd *);
-int eata_reset(Scsi_Cmnd *, unsigned int);
-int eata_proc_info(char *, char **, off_t, int, int, int);
-#ifdef MODULE
-int eata_release(struct Scsi_Host *);
-#else
-#define eata_release NULL  
-#endif
-
-#include <scsi/scsicam.h>
-
-#define EATA_DMA {                                      \
-        .proc_info         = eata_proc_info,     /* procinfo       */ \
-        .name              = "EATA (Extended Attachment) HBA driver", \
-        .detect            = eata_detect,                 \
-        .release           = eata_release,                \
-	.queuecommand      = eata_queue,                  \
-	.abort             = eata_abort,                  \
-	.reset             = eata_reset,                  \
-	.unchecked_isa_dma = 1,      /* True if ISA  */   \
-	.use_clustering    = ENABLE_CLUSTERING }
-
-
-#endif /* _EATA_DMA_H */
-
-/*
- * Overrides for Emacs so that we almost follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-indent-level: 4
- * c-brace-imaginary-offset: 0
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * c-continued-statement-offset: 4
- * c-continued-brace-offset: 0
- * indent-tabs-mode: nil
- * tab-width: 8
- * End:
- */
diff -Nru a/drivers/scsi/eata_dma_proc.c b/drivers/scsi/eata_dma_proc.c
--- a/drivers/scsi/eata_dma_proc.c	Sun Feb 23 22:25:25 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,478 +0,0 @@
-void swap_statistics(u8 *p)
-{
-    u32 y;
-    u32 *lp, h_lp;
-    u16 *sp, h_sp;
-    u8 *bp;
-    
-    lp = (u32 *)p;
-    sp = ((short *)lp) + 1;	    /* Convert Header */
-    h_sp = *sp = ntohs(*sp);
-    lp++;
-
-    do {
-	sp = (u16 *)lp;		  /* Convert SubHeader */
-	*sp = ntohs(*sp);
-	bp = (u8 *) lp;
-	y = *(bp + 3);
-	lp++;
-	for (h_lp = (u32)lp; (u32)lp < h_lp + ((u32)*(bp + 3)); lp++)
-	    *lp = ntohl(*lp);
-    }while ((u32)lp < ((u32)p) + 4 + h_sp);
-
-}
-
-/*
- * eata_set_info
- * buffer : pointer to the data that has been written to the hostfile
- * length : number of bytes written to the hostfile
- * HBA_ptr: pointer to the Scsi_Host struct
- */
-int eata_set_info(char *buffer, int length, struct Scsi_Host *HBA_ptr)
-{
-    int orig_length = length;
-
-    if (length >= 8 && strncmp(buffer, "eata_dma", 8) == 0) {
-	buffer += 9;
-	length -= 9;
-	if(length >= 8 && strncmp(buffer, "latency", 7) == 0) {
-	    SD(HBA_ptr)->do_latency = TRUE;
-	    return(orig_length);
-	} 
-	
-	if(length >=10 && strncmp(buffer, "nolatency", 9) == 0) {
-	    SD(HBA_ptr)->do_latency = FALSE;
-	    return(orig_length);
-	} 
-	
-	printk("Unknown command:%s length: %d\n", buffer, length);
-    } else 
-	printk("Wrong Signature:%10s\n", buffer);
-    
-    return(-EINVAL);
-}
-
-/*
- * eata_proc_info
- * inout : decides on the direction of the dataflow and the meaning of the 
- *	   variables
- * buffer: If inout==FALSE data is being written to it else read from it
- * *start: If inout==FALSE start of the valid data in the buffer
- * offset: If inout==FALSE offset from the beginning of the imaginary file 
- *	   from which we start writing into the buffer
- * length: If inout==FALSE max number of bytes to be written into the buffer 
- *	   else number of bytes in the buffer
- */
-int eata_proc_info(char *buffer, char **start, off_t offset, int length, 
-		   int hostno, int inout)
-{
-
-    Scsi_Device *scd, *SDev;
-    struct Scsi_Host *HBA_ptr;
-    Scsi_Request  * scmd;
-    char cmnd[MAX_COMMAND_SIZE];
-    static u8 buff[512];
-    static u8 buff2[512];
-    hst_cmd_stat *rhcs, *whcs;
-    coco	 *cc;
-    scsitrans	 *st;
-    scsimod	 *sm;
-    hobu	 *hb;
-    scbu	 *sb;
-    boty	 *bt;
-    memco	 *mc;
-    firm	 *fm;
-    subinf	 *si; 
-    pcinf	 *pi;
-    arrlim	 *al;
-    int i, x; 
-    int	  size, len = 0;
-    off_t begin = 0;
-    off_t pos = 0;
-    scd = NULL;
-
-    HBA_ptr = first_HBA;
-    for (i = 1; i <= registered_HBAs; i++) {
-	if (HBA_ptr->host_no == hostno)
-	    break;
-	HBA_ptr = SD(HBA_ptr)->next;
-    }	     
-
-    if(inout == TRUE) /* Has data been written to the file ? */ 
-	return(eata_set_info(buffer, length, HBA_ptr));
-
-    if (offset == 0)
-	memset(buff, 0, sizeof(buff));
-
-    cc = (coco *)     (buff + 0x148);
-    st = (scsitrans *)(buff + 0x164); 
-    sm = (scsimod *)  (buff + 0x16c);
-    hb = (hobu *)     (buff + 0x172);
-    sb = (scbu *)     (buff + 0x178);
-    bt = (boty *)     (buff + 0x17e);
-    mc = (memco *)    (buff + 0x186);
-    fm = (firm *)     (buff + 0x18e);
-    si = (subinf *)   (buff + 0x196); 
-    pi = (pcinf *)    (buff + 0x19c);
-    al = (arrlim *)   (buff + 0x1a2);
-
-    size = sprintf(buffer+len, "EATA (Extended Attachment) driver version: "
-		   "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB);
-    len += size; pos = begin + len;
-    size = sprintf(buffer + len, "queued commands:     %10ld\n"
-		   "processed interrupts:%10ld\n", queue_counter, int_counter);
-    len += size; pos = begin + len;
-
-    size = sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n",
-		   HBA_ptr->host_no, SD(HBA_ptr)->name);
-    len += size; 
-    pos = begin + len;
-    size = sprintf(buffer + len, "Firmware revision: v%s\n", 
-		   SD(HBA_ptr)->revision);
-    len += size;
-    pos = begin + len;
-    size = sprintf(buffer + len, "Hardware Configuration:\n");
-    len += size; 
-    pos = begin + len;
-    
-    if(SD(HBA_ptr)->broken_INQUIRY == TRUE) {
-	if (HBA_ptr->dma_channel == BUSMASTER)
-	    size = sprintf(buffer + len, "DMA: BUSMASTER\n");
-	else
-	    size = sprintf(buffer + len, "DMA: %d\n", HBA_ptr->dma_channel);
-	len += size; 
-	pos = begin + len;
-
-	size = sprintf(buffer + len, "Base IO : %#.4x\n", (u32) HBA_ptr->base);
-	len += size; 
-	pos = begin + len;
-
-	size = sprintf(buffer + len, "Host Bus: EISA\n"); 
-	len += size; 
-	pos = begin + len;
-
-    } else {
-        SDev = scsi_get_host_dev(HBA_ptr);
-        
-        if(SDev == NULL)
-            return -ENOMEM;
-        	
-	scmd  = scsi_allocate_request(SDev);
-	
-	if(scmd == NULL)
-	{
-	    scsi_free_host_dev(SDev);
-	    return -ENOMEM;
-	}
-	
-
-	cmnd[0] = LOG_SENSE;
-	cmnd[1] = 0;
-	cmnd[2] = 0x33 + (3<<6);
-	cmnd[3] = 0;
-	cmnd[4] = 0;
-	cmnd[5] = 0;
-        cmnd[6] = 0;
-	cmnd[7] = 0x00;
-	cmnd[8] = 0x66;
-	cmnd[9] = 0;
-
-	scmd->sr_cmd_len = 10;
-	scmd->sr_data_direction = SCSI_DATA_READ;
-	
-	/*
-	 * Do the command and wait for it to finish.
-	 */	
-	scsi_wait_req (scmd, cmnd, buff + 0x144, 0x66,  
-		       1 * HZ, 1);
-
-	size = sprintf(buffer + len, "IRQ: %2d, %s triggered\n", cc->interrupt,
-		       (cc->intt == TRUE)?"level":"edge");
-	len += size; 
-	pos = begin + len;
-	if (HBA_ptr->dma_channel == 0xff)
-	    size = sprintf(buffer + len, "DMA: BUSMASTER\n");
-	else
-	    size = sprintf(buffer + len, "DMA: %d\n", HBA_ptr->dma_channel);
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "CPU: MC680%02d %dMHz\n", bt->cpu_type,
-		       bt->cpu_speed);
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "Base IO : %#.4x\n", (u32) HBA_ptr->base);
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "Host Bus: %s\n", 
-		       (SD(HBA_ptr)->bustype == IS_PCI)?"PCI ":
-		       (SD(HBA_ptr)->bustype == IS_EISA)?"EISA":"ISA ");
-	
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "SCSI Bus:%s%s Speed: %sMB/sec. %s\n",
-		       (sb->wide == TRUE)?" WIDE":"", 
-		       (sb->dif == TRUE)?" DIFFERENTIAL":"",
-		       (sb->speed == 0)?"5":(sb->speed == 1)?"10":"20",
-		       (sb->ext == TRUE)?"With external cable detection":"");
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "SCSI channel expansion Module: %s present\n",
-		       (bt->sx1 == TRUE)?"SX1 (one channel)":
-		       ((bt->sx2 == TRUE)?"SX2 (two channels)":"not"));
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "SmartRAID hardware: %spresent.\n",
-		       (cc->srs == TRUE)?"":"not ");
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "    Type: %s\n",
-		       ((cc->key == TRUE)?((bt->dmi == TRUE)?"integrated"
-					   :((bt->dm4 == TRUE)?"DM401X"
-					   :(bt->dm4k == TRUE)?"DM4000"
-					   :"-"))
-					   :"-"));
-	len += size; 
-	pos = begin + len;
-	
-	size = sprintf(buffer + len, "    Max array groups:              %d\n",
-		       (al->code == 0x0e)?al->max_groups:7);
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "    Max drives per RAID 0 array:   %d\n",
-		       (al->code == 0x0e)?al->raid0_drv:7);
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "    Max drives per RAID 3/5 array: %d\n",
-		       (al->code == 0x0e)?al->raid35_drv:7);
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "Cache Module: %spresent.\n",
-		       (cc->csh)?"":"not ");
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "    Type: %s\n",
-		       ((cc->csh == TRUE)?((bt->cmi == TRUE)?"integrated"
-					 :((bt->cm4 == TRUE)?"CM401X"
-					 :((bt->cm4k == TRUE)?"CM4000"
-					 :"-")))
-					 :"-"));
-	len += size; 
-	pos = begin + len;
-	for (x = 0; x <= 3; x++) {
-	    size = sprintf(buffer + len, "    Bank%d: %dMB with%s ECC\n",x,
-			   mc->banksize[x] & 0x7f, 
-			   (mc->banksize[x] & 0x80)?"":"out");
-	    len += size; 
-	    pos = begin + len;	    
-	}   
-	size = sprintf(buffer + len, "Timer Mod.: %spresent\n",
-		       (cc->tmr == TRUE)?"":"not ");
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "NVRAM     : %spresent\n",
-		       (cc->nvr == TRUE)?"":"not ");
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "SmartROM  : %sabled\n",
-		       (bt->srom == TRUE)?"dis":"en");
-	len += size; 
-	pos = begin + len;
-	size = sprintf(buffer + len, "Alarm     : %s\n",
-		       (bt->alrm == TRUE)?"on":"off");
-	len += size; 
-	pos = begin + len;
-	
-	if (pos < offset) {
-	    len = 0;
-	    begin = pos;
-	}
-	if (pos > offset + length)
-	    goto stop_output; 
-
-	if(SD(HBA_ptr)->do_latency == FALSE) { 
-
-	    cmnd[0] = LOG_SENSE;
-	    cmnd[1] = 0;
-	    cmnd[2] = 0x32 + (3<<6); 
-	    cmnd[3] = 0;
-	    cmnd[4] = 0;
-	    cmnd[5] = 0;
-	    cmnd[6] = 0;
-	    cmnd[7] = 0x01;
-	    cmnd[8] = 0x44;
-	    cmnd[9] = 0;
-	    
-	    scmd->sr_cmd_len = 10;
-	    scmd->sr_data_direction = SCSI_DATA_READ;
-
-	    /*
-	     * Do the command and wait for it to finish.
-	     */	
-	    scsi_wait_req (scmd, cmnd, buff2, 0x144,
-			   1 * HZ, 1);
-
-	    swap_statistics(buff2);
-	    rhcs = (hst_cmd_stat *)(buff2 + 0x2c); 
-	    whcs = (hst_cmd_stat *)(buff2 + 0x8c);		 
-	    
-	    for (x = 0; x <= 11; x++) {
-	        SD(HBA_ptr)->reads[x] += rhcs->sizes[x];
-		SD(HBA_ptr)->writes[x] += whcs->sizes[x];
-		SD(HBA_ptr)->reads[12] += rhcs->sizes[x];
-		SD(HBA_ptr)->writes[12] += whcs->sizes[x];
-	    }
-	    size = sprintf(buffer + len, "Host<->Disk command statistics:\n"
-			   "         Reads:	     Writes:\n");
-	    len += size; 
-	    pos = begin + len;
-	    for (x = 0; x <= 10; x++) {
-	        size = sprintf(buffer+len,"%5dk:%12u %12u\n", 1 << x,
-			       SD(HBA_ptr)->reads[x], 
-			       SD(HBA_ptr)->writes[x]);
-		len += size; 
-		pos = begin + len;
-	    }
-	    size = sprintf(buffer+len,">1024k:%12u %12u\n",
-			   SD(HBA_ptr)->reads[11], 
-			   SD(HBA_ptr)->writes[11]);
-	    len += size; 
-	    pos = begin + len;
-	    size = sprintf(buffer+len,"Sum   :%12u %12u\n",
-			   SD(HBA_ptr)->reads[12], 
-			   SD(HBA_ptr)->writes[12]);
-	    len += size; 
-	    pos = begin + len;
-	}
-
-	scsi_release_request(scmd);
-	scsi_free_host_dev(SDev);
-    }
-    
-    if (pos < offset) {
-	len = 0;
-	begin = pos;
-    }
-    if (pos > offset + length)
-	goto stop_output;
-
-    if(SD(HBA_ptr)->do_latency == TRUE) {
-        int factor = 1024/HZ;
-	size = sprintf(buffer + len, "Host Latency Command Statistics:\n"
-		       "Current timer resolution: %2dms\n"
-		       "         Reads:	      Min:(ms)     Max:(ms)     Ave:(ms)\n",
-		       factor);
-	len += size; 
-	pos = begin + len;
-	for (x = 0; x <= 10; x++) {
-	    size = sprintf(buffer+len,"%5dk:%12u %12u %12u %12u\n", 
-			   1 << x,
-			   SD(HBA_ptr)->reads_lat[x][0], 
-			   (SD(HBA_ptr)->reads_lat[x][1] == 0xffffffff) 
-			   ? 0:(SD(HBA_ptr)->reads_lat[x][1] * factor), 
-			   SD(HBA_ptr)->reads_lat[x][2] * factor, 
-			   SD(HBA_ptr)->reads_lat[x][3] * factor /
-			   ((SD(HBA_ptr)->reads_lat[x][0])
-			    ? SD(HBA_ptr)->reads_lat[x][0]:1));
-	    len += size; 
-	    pos = begin + len;
-	}
-	size = sprintf(buffer+len,">1024k:%12u %12u %12u %12u\n",
-			   SD(HBA_ptr)->reads_lat[11][0], 
-			   (SD(HBA_ptr)->reads_lat[11][1] == 0xffffffff)
-			   ? 0:(SD(HBA_ptr)->reads_lat[11][1] * factor), 
-			   SD(HBA_ptr)->reads_lat[11][2] * factor, 
-			   SD(HBA_ptr)->reads_lat[11][3] * factor /
-			   ((SD(HBA_ptr)->reads_lat[x][0])
-			    ? SD(HBA_ptr)->reads_lat[x][0]:1));
-	len += size; 
-	pos = begin + len;
-
-	if (pos < offset) {
-	    len = 0;
-	    begin = pos;
-	}
-	if (pos > offset + length)
-	    goto stop_output;
-
-	size = sprintf(buffer + len,
-		       "         Writes:      Min:(ms)     Max:(ms)     Ave:(ms)\n");
-	len += size; 
-	pos = begin + len;
-	for (x = 0; x <= 10; x++) {
-	    size = sprintf(buffer+len,"%5dk:%12u %12u %12u %12u\n", 
-			   1 << x,
-			   SD(HBA_ptr)->writes_lat[x][0], 
-			   (SD(HBA_ptr)->writes_lat[x][1] == 0xffffffff)
-			   ? 0:(SD(HBA_ptr)->writes_lat[x][1] * factor), 
-			   SD(HBA_ptr)->writes_lat[x][2] * factor, 
-			   SD(HBA_ptr)->writes_lat[x][3] * factor /
-			   ((SD(HBA_ptr)->writes_lat[x][0])
-			    ? SD(HBA_ptr)->writes_lat[x][0]:1));
-	    len += size; 
-	    pos = begin + len;
-	}
-	size = sprintf(buffer+len,">1024k:%12u %12u %12u %12u\n",
-			   SD(HBA_ptr)->writes_lat[11][0], 
-			   (SD(HBA_ptr)->writes_lat[11][1] == 0xffffffff)
-			   ? 0:(SD(HBA_ptr)->writes_lat[x][1] * factor), 
-			   SD(HBA_ptr)->writes_lat[11][2] * factor, 
-			   SD(HBA_ptr)->writes_lat[11][3] * factor /
-			   ((SD(HBA_ptr)->writes_lat[x][0])
-			    ? SD(HBA_ptr)->writes_lat[x][0]:1));
-	len += size; 
-	pos = begin + len;
-
-	if (pos < offset) {
-	    len = 0;
-	    begin = pos;
-	}
-	if (pos > offset + length)
-	    goto stop_output;
-    }
-
-    size = sprintf(buffer+len,"Attached devices: %s\n", 
-		   (!list_empty(&HBA_ptr->my_devices))?"":"none");
-    len += size; 
-    pos = begin + len;
-    
-    list_for_each_entry(scd, &HBA_ptr->my_devices, siblings) {
-	    proc_print_scsidevice(scd, buffer, &size, len);
-	    len += size; 
-	    pos = begin + len;
-	    
-	    if (pos < offset) {
-		len = 0;
-		begin = pos;
-	    }
-	    if (pos > offset + length)
-		goto stop_output;
-    }
-    
- stop_output:
-    DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, len));
-    *start=buffer+(offset-begin);   /* Start of wanted data */
-    len-=(offset-begin);	    /* Start slop */
-    if(len>length)
-	len = length;		    /* Ending slop */
-    DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, len));
-    
-    return (len);     
-}
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-indent-level: 4
- * c-brace-imaginary-offset: 0
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * c-continued-statement-offset: 4
- * c-continued-brace-offset: 0
- * tab-width: 8
- * End:
- */
diff -Nru a/drivers/scsi/eata_dma_proc.h b/drivers/scsi/eata_dma_proc.h
--- a/drivers/scsi/eata_dma_proc.h	Sun Feb 23 22:25:23 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,260 +0,0 @@
-
-struct lun_map {
-    __u8   id:5,
-     chan:3;
-    __u8 lun;
-};
-
-typedef struct emul_pp {
-    __u8 p_code:6,
-       null:1,
-     p_save:1;
-    __u8 p_length;
-    __u16 cylinder;
-    __u8 heads;
-    __u8 sectors;
-    __u8 null2;
-    __u8 s_lunmap:4,
-	  ems:1;
-    __u16 drive_type;	/* In Little Endian ! */
-    struct lun_map lunmap[4];
-}emulpp;
-
-
-/* Log Sense pages */
-
-typedef struct log_sheader {
-    __u8 page_code,
-     reserved;
-    __u16 length;
-}logsh;
-
-
-/* Log Sense Statistics */
-
-typedef struct read_command_statistics {
-    __u16 code;	       /* 0x01 */
-    __u8  flags;
-    __u8  length;      /* 0x24 */
-    __u32 h_commands,
-      uncached,
-      la_cmds,
-      la_blks,
-      la_hits,
-      missed,
-      hits,
-      seq_la_blks,
-      seq_la_hits;
-}r_cmd_stat;
-
-typedef struct write_command_statistics {
-    __u16 code;	       /* 0x03 */
-    __u8  flags;
-    __u8  length;      /* 0x28 */
-    __u32 h_commands,
-      uncached,
-      thru,
-      bypass,
-      soft_err,
-      hits,
-      b_idle,
-      b_activ,
-      b_blks,
-      b_blks_clean;
-}w_cmd_stat;
-
-typedef struct host_command_statistics {
-    __u16 code;		 /* 0x02, 0x04 */
-    __u8  flags;
-    __u8  length;	 /* 0x30 */
-    __u32 sizes[12];
-}hst_cmd_stat;
-
-typedef struct physical_command_statistics {
-    __u16 code;		 /* 0x06, 0x07 */ 
-    __u8  flags;
-    __u8  length;	 /* 0x34 */
-    __u32 sizes[13]; 
-}phy_cmd_stat;
-
-typedef struct misc_device_statistics {
-    __u16 code;		  /* 0x05 */
-    __u8  flags;
-    __u8  length;	  /* 0x10 */
-    __u32 disconnect,
-      pass_thru,
-      sg_commands,
-      stripe_boundary_crosses;
-}msc_stats;
- 
-/* Configuration Pages */
-
-typedef struct controller_configuration {
-    __u16 code;		  /* 0x01 */
-    __u8  flags;
-    __u8  length;	  /* 0x02 */
-    __u8  intt:1,
-       sec:1,
-       csh:1,
-       key:1,
-       tmr:1,
-       srs:1,
-       nvr:1;
-    __u8  interrupt;
-}coco;
-
-typedef struct controller_hardware_errors {
-    __u16 code;		  /* 0x02 */
-    __u8  flags;
-    __u8  length;	  /* 0x02 */
-    __u8  unused:1,
-	 per:1;
-    __u8  interrupt;
-}coher;
-
-typedef struct memory_map {
-    __u16 code;		  /* 0x03, 0x04 */
-    __u8  flags;
-    __u8  length;	  /* 0x04 */
-    __u32 memory_map;
-}mema;
-
-typedef struct scsi_transfer {
-    __u16 code;		  /* 0x05 */
-    __u8  flags;
-    __u8  length;	  /* 0x04 */
-    __u8  offset,
-      period;
-    __u16 speed;
-}scsitrans;
-
-typedef struct scsi_modes {
-    __u16 code;		  /* 0x06 */
-    __u8  flags;
-    __u8  length;	  /* 0x02 */
-    __u8  que:1,
-     cdis:1,
-     wtru:1,
-     dasd:1,
-      ncr:1,
-     awre:1;
-    __u8  reserved;
-}scsimod;
-
-typedef struct host_bus {
-    __u16 code;		  /* 0x07 */
-    __u8  flags;
-    __u8  length;	  /* 0x02 */
-    __u8  speed:6,
-	pci:1,
-       eisa:1;
-    __u8  reserved;
-}hobu;
-
-typedef struct scsi_bus {
-    __u16 code;		  /* 0x08 */
-    __u8  flags;
-    __u8  length;	  /* 0x02 */
-    __u8  speed:4,
-	res:1,
-	ext:1,
-       wide:1,
-	dif:1;
-    __u8 busnum;
-}scbu;
-
-typedef struct board_type {
-    __u16 code;		  /* 0x09 */
-    __u8  flags;
-    __u8  length;	  /* 0x04 */
-    __u8  unused:1,
-	 cmi:1,
-	 dmi:1,
-	cm4k:1,
-	 cm4:1,
-	dm4k:1,
-	 dm4:1,
-	 hba:1;
-    __u8  cpu_type,
-      cpu_speed;
-    __u8    sx1:1,
-	sx2:1,
-    unused2:4,
-       alrm:1,
-       srom:1;
-}boty;
-
-typedef struct memory_config {
-    __u16 code;		  /* 0x0a */
-    __u8  flags;
-    __u8  length;	  /* 0x04 */
-    __u8  banksize[4];
-}memco;
-
-typedef struct firmware_info {
-    __u16 code;		  /* 0x0b */
-    __u8  flags;
-    __u8  length;	  /* 0x04 */
-    __u8  dnld:1,
-     bs528:1,
-       fmt:1,
-     fw528:1;
-    __u8  unused1,
-      fw_type,
-      unused;
-}firm;
-
-typedef struct subsystem_info {
-    __u16 code;		  /* 0x0c */
-    __u8  flags;
-    __u8  length;	  /* 0x02 */
-    __u8  shlf:1,
-      swap:1,
-      noss:1;
-    __u8  reserved;
-}subinf;
-
-typedef struct per_channel_info {
-    __u16 code;		  /* 0x0d */
-    __u8  flags;
-    __u8  length;	  /* 0x02 */
-    __u8  channel;
-    __u8  shlf:1,
-      swap:1,
-      noss:1,
-       srs:1,
-       que:1,
-       ext:1,
-      wide:1,
-      diff:1;
-}pcinf;
-
-typedef struct array_limits {
-    __u16 code;		  /* 0x0e */
-    __u8  flags;
-    __u8  length;	  /* 0x04 */
-    __u8  max_groups,
-      raid0_drv,
-      raid35_drv,
-      unused;
-}arrlim;
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-indent-level: 4
- * c-brace-imaginary-offset: 0
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * c-continued-statement-offset: 4
- * c-continued-brace-offset: 0
- * indent-tabs-mode: nil
- * tab-width: 8
- * End:
- */
-
diff -Nru a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
--- a/drivers/scsi/eata_pio.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/scsi/eata_pio.c	Sun Feb 23 22:25:25 2003
@@ -46,10 +46,7 @@
  *  last change: 2002/11/02               OS: Linux 2.5.45  *
  ************************************************************/
 
-/* Look in eata_pio.h for configuration information */
-
 #include <linux/module.h>
-
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/string.h>
@@ -59,15 +56,19 @@
 #include <linux/pci.h>
 #include <linux/proc_fs.h>
 #include <linux/interrupt.h>
-#include <asm/io.h>
-#include "eata_pio.h"
-#include "eata_dma_proc.h"
-#include "scsi.h"
-
 #include <linux/stat.h>
-#include <linux/config.h>	/* for CONFIG_PCI */
+#include <linux/config.h>
 #include <linux/blk.h>
 #include <linux/spinlock.h>
+#include <asm/io.h>
+
+#include "scsi.h"
+#include "hosts.h"
+#include <scsi/scsicam.h>
+
+#include "eata_generic.h"
+#include "eata_pio.h"
+
 
 static uint ISAbases[MAXISA] =	{
 	 0x1F0, 0x170, 0x330, 0x230
@@ -82,16 +83,106 @@
 	1, 1, 1, 1, 1, 1, 1, 1 
 };
 
-static uint registered_HBAs = 0;
+static uint registered_HBAs;
 static struct Scsi_Host *last_HBA;
 static struct Scsi_Host *first_HBA;
-static unsigned char reg_IRQ[];
-static unsigned char reg_IRQL[];
+static unsigned char reg_IRQ[16];
+static unsigned char reg_IRQL[16];
+static unsigned long int_counter;
+static unsigned long queue_counter;
 
-static unsigned long int_counter = 0;
-static unsigned long queue_counter = 0;
+/*
+ * eata_proc_info
+ * inout : decides on the direction of the dataflow and the meaning of the 
+ *         variables
+ * buffer: If inout==FALSE data is being written to it else read from it
+ * *start: If inout==FALSE start of the valid data in the buffer
+ * offset: If inout==FALSE offset from the beginning of the imaginary file 
+ *         from which we start writing into the buffer
+ * length: If inout==FALSE max number of bytes to be written into the buffer 
+ *         else number of bytes in the buffer
+ */
+static int eata_pio_proc_info(char *buffer, char **start, off_t offset,
+			      int length, int hostno, int rw)
+{
+    struct Scsi_Host *shost;
+    struct scsi_device *sdev;
+    static u8 buff[512];
+    int size, len = 0;
+    off_t begin = 0, pos = 0;
+
+    if (rw)
+    	return -ENOSYS;
+    shost = scsi_host_hn_get(hostno);
+    if (!shost)
+    	return -EINVAL;
 
-#include "eata_pio_proc.c"
+    if (offset == 0)
+	memset(buff, 0, sizeof(buff));
+
+    size = sprintf(buffer+len, "EATA (Extended Attachment) PIO driver version: "
+		   "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB);
+    len += size; pos = begin + len;
+    size = sprintf(buffer + len, "queued commands:     %10ld\n"
+		   "processed interrupts:%10ld\n", queue_counter, int_counter);
+    len += size; pos = begin + len;
+    
+    size = sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n",
+		   shost->host_no, SD(shost)->name);
+    len += size; 
+    pos = begin + len;
+    size = sprintf(buffer + len, "Firmware revision: v%s\n", 
+		   SD(shost)->revision);
+    len += size;
+    pos = begin + len;
+    size = sprintf(buffer + len, "IO: PIO\n");
+    len += size; 
+    pos = begin + len;
+    size = sprintf(buffer + len, "Base IO : %#.4x\n", (u32) shost->base);
+    len += size; 
+    pos = begin + len;
+    size = sprintf(buffer + len, "Host Bus: %s\n", 
+		   (SD(shost)->bustype == 'P')?"PCI ":
+		   (SD(shost)->bustype == 'E')?"EISA":"ISA ");
+    
+    len += size; 
+    pos = begin + len;
+    
+    if (pos < offset) {
+	len = 0;
+	begin = pos;
+    }
+    if (pos > offset + length)
+	goto stop_output;
+    
+    size = sprintf(buffer+len,"Attached devices: %s\n", 
+		   (!list_empty(&shost->my_devices))?"":"none");
+    len += size; 
+    pos = begin + len;
+    
+    list_for_each_entry(sdev, &shost->my_devices, siblings) {
+	    proc_print_scsidevice(sdev, buffer, &size, len);
+	    len += size; 
+	    pos = begin + len;
+	    
+	    if (pos < offset) {
+		len = 0;
+		begin = pos;
+	    }
+	    if (pos > offset + length)
+		goto stop_output;
+    }
+    
+ stop_output:
+    DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, len));
+    *start=buffer+(offset-begin);   /* Start of wanted data */
+    len-=(offset-begin);            /* Start slop */
+    if(len>length)
+	len = length;               /* Ending slop */
+    DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, len));
+    
+    return (len);     
+}
 
 static int eata_pio_release(struct Scsi_Host *sh)
 {
@@ -895,27 +986,19 @@
 	return (registered_HBAs);
 }
 
-/* Eventually this will go into an include file, but this will be later */
-static Scsi_Host_Template driver_template = EATA_PIO;
+static Scsi_Host_Template driver_template = {
+	.proc_info         	= eata_pio_proc_info,
+	.name              	= "EATA (Extended Attachment) PIO driver",
+	.detect            	= eata_pio_detect,
+	.release           	= eata_pio_release,
+	.queuecommand      	= eata_pio_queue,
+	.eh_abort_handler  	= eata_pio_abort,
+	.eh_host_reset_handler	= eata_pio_host_reset,
+	.use_clustering    	= ENABLE_CLUSTERING,
+};
 
-#include "scsi_module.c"
+MODULE_AUTHOR("Michael Neuffer, Alfred Arnold");
+MODULE_DESCRIPTION("EATA SCSI PIO driver");
 MODULE_LICENSE("GPL");
 
-/*
- * Overrides for Emacs so that we almost follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-indent-level: 4
- * c-brace-imaginary-offset: 0
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * c-continued-statement-offset: 4
- * c-continued-brace-offset: 0
- * indent-tabs-mode: nil
- * tab-width: 8
- * End:
- */
+#include "scsi_module.c"
diff -Nru a/drivers/scsi/eata_pio.h b/drivers/scsi/eata_pio.h
--- a/drivers/scsi/eata_pio.h	Sun Feb 23 22:25:27 2003
+++ b/drivers/scsi/eata_pio.h	Sun Feb 23 22:25:27 2003
@@ -9,13 +9,6 @@
 #ifndef _EATA_PIO_H
 #define _EATA_PIO_H
 
-#include <linux/blk.h>
-#include "scsi.h"
-#include "hosts.h"
-#include <scsi/scsicam.h>
-
-#include "eata_generic.h"
-
 #define VER_MAJOR 0
 #define VER_MINOR 0
 #define VER_SUB	  "1b"
@@ -56,23 +49,5 @@
 #else
 #define DBG(x, y)
 #endif
-
-static int eata_pio_detect(Scsi_Host_Template *);
-static int eata_pio_queue(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
-static int eata_pio_abort(Scsi_Cmnd *);
-static int eata_pio_host_reset(Scsi_Cmnd *);
-static int eata_pio_proc_info(char *, char **, off_t, int, int, int);
-static int eata_pio_release(struct Scsi_Host *);
-
-#define EATA_PIO {							\
-	.proc_info         	= eata_pio_proc_info, /* procinfo	  */	\
-	.name              	= "EATA (Extended Attachment) PIO driver",\
-	.detect            	= eata_pio_detect,			\
-	.release           	= eata_pio_release,			\
-	.queuecommand      	= eata_pio_queue,				\
-	.eh_abort_handler  	= eata_pio_abort,				\
-	.eh_host_reset_handler	= eata_pio_host_reset,			\
-	.use_clustering    	= ENABLE_CLUSTERING 			\
-}
 
 #endif				/* _EATA_PIO_H */
diff -Nru a/drivers/scsi/eata_pio_proc.c b/drivers/scsi/eata_pio_proc.c
--- a/drivers/scsi/eata_pio_proc.c	Sun Feb 23 22:25:25 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,128 +0,0 @@
-/*
- * eata_set_info
- * buffer : pointer to the data that has been written to the hostfile
- * length : number of bytes written to the hostfile
- * HBA_ptr: pointer to the Scsi_Host struct
- */
-int eata_pio_set_info(char *buffer, int length, struct Scsi_Host *HBA_ptr)
-{
-    DBG(DBG_PROC_WRITE, printk("%s\n", buffer));
-    return(-ENOSYS);  /* Currently this is a no-op */
-}
-
-/*
- * eata_proc_info
- * inout : decides on the direction of the dataflow and the meaning of the 
- *         variables
- * buffer: If inout==FALSE data is being written to it else read from it
- * *start: If inout==FALSE start of the valid data in the buffer
- * offset: If inout==FALSE offset from the beginning of the imaginary file 
- *         from which we start writing into the buffer
- * length: If inout==FALSE max number of bytes to be written into the buffer 
- *         else number of bytes in the buffer
- */
-int eata_pio_proc_info(char *buffer, char **start, off_t offset, int length, 
-		       int hostno, int inout)
-{
-    Scsi_Device *scd;
-    struct Scsi_Host *HBA_ptr;
-    static u8 buff[512];
-    int i; 
-    int   size, len = 0;
-    off_t begin = 0;
-    off_t pos = 0;
-
-    HBA_ptr = first_HBA;
-    for (i = 1; i <= registered_HBAs; i++) {
-	if (HBA_ptr->host_no == hostno)
-	    break;
-	HBA_ptr = SD(HBA_ptr)->next;
-    }        
-
-    if(inout == TRUE) /* Has data been written to the file ? */ 
-	return(eata_pio_set_info(buffer, length, HBA_ptr));
-
-    if (offset == 0)
-	memset(buff, 0, sizeof(buff));
-
-    size = sprintf(buffer+len, "EATA (Extended Attachment) PIO driver version: "
-		   "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB);
-    len += size; pos = begin + len;
-    size = sprintf(buffer + len, "queued commands:     %10ld\n"
-		   "processed interrupts:%10ld\n", queue_counter, int_counter);
-    len += size; pos = begin + len;
-    
-    size = sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n",
-		   HBA_ptr->host_no, SD(HBA_ptr)->name);
-    len += size; 
-    pos = begin + len;
-    size = sprintf(buffer + len, "Firmware revision: v%s\n", 
-		   SD(HBA_ptr)->revision);
-    len += size;
-    pos = begin + len;
-    size = sprintf(buffer + len, "IO: PIO\n");
-    len += size; 
-    pos = begin + len;
-    size = sprintf(buffer + len, "Base IO : %#.4x\n", (u32) HBA_ptr->base);
-    len += size; 
-    pos = begin + len;
-    size = sprintf(buffer + len, "Host Bus: %s\n", 
-		   (SD(HBA_ptr)->bustype == 'P')?"PCI ":
-		   (SD(HBA_ptr)->bustype == 'E')?"EISA":"ISA ");
-    
-    len += size; 
-    pos = begin + len;
-    
-    if (pos < offset) {
-	len = 0;
-	begin = pos;
-    }
-    if (pos > offset + length)
-	goto stop_output;
-    
-    size = sprintf(buffer+len,"Attached devices: %s\n", 
-		   (!list_empty(&HBA_ptr->my_devices))?"":"none");
-    len += size; 
-    pos = begin + len;
-    
-    list_for_each_entry(scd, &HBA_ptr->my_devices, siblings) {
-	    proc_print_scsidevice(scd, buffer, &size, len);
-	    len += size; 
-	    pos = begin + len;
-	    
-	    if (pos < offset) {
-		len = 0;
-		begin = pos;
-	    }
-	    if (pos > offset + length)
-		goto stop_output;
-    }
-    
- stop_output:
-    DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, len));
-    *start=buffer+(offset-begin);   /* Start of wanted data */
-    len-=(offset-begin);            /* Start slop */
-    if(len>length)
-	len = length;               /* Ending slop */
-    DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, len));
-    
-    return (len);     
-}
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-indent-level: 4
- * c-brace-imaginary-offset: 0
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * c-continued-statement-offset: 4
- * c-continued-brace-offset: 0
- * tab-width: 8
- * End:
- */
diff -Nru a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
--- a/drivers/scsi/fdomain.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/scsi/fdomain.c	Sun Feb 23 22:25:25 2003
@@ -960,7 +960,7 @@
    	return 0;
    shpnt->irq = interrupt_level;
    shpnt->io_port = port_base;
-   scsi_set_pci_device(shpnt, pdev);
+   scsi_set_device(shpnt, &pdev->dev);
    shpnt->n_io_port = 0x10;
    print_banner( shpnt );
 
diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
--- a/drivers/scsi/hosts.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/scsi/hosts.c	Sun Feb 23 22:25:21 2003
@@ -397,6 +397,7 @@
 	spin_lock_init(&shost->default_lock);
 	scsi_assign_lock(shost, &shost->default_lock);
 	INIT_LIST_HEAD(&shost->my_devices);
+	INIT_LIST_HEAD(&shost->eh_cmd_q);
 
 	init_waitqueue_head(&shost->host_wait);
 	shost->dma_channel = 0xff;
@@ -634,22 +635,9 @@
 	spin_lock_irqsave(shost->host_lock, flags);
 	shost->host_busy--;
 	sdev->device_busy--;
-	if (shost->in_recovery && (shost->host_busy == shost->host_failed)) {
-		up(shost->eh_wait);
-		SCSI_LOG_ERROR_RECOVERY(5, printk("Waking error handler"
-					  " thread\n"));
-	}
-	spin_unlock_irqrestore(shost->host_lock, flags);
-}
-
-void scsi_host_failed_inc_and_test(struct Scsi_Host *shost)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(shost->host_lock, flags);
-	shost->in_recovery = 1;
-	shost->host_failed++;
-	if (shost->host_busy == shost->host_failed) {
+	if (shost->in_recovery && shost->host_failed &&
+	    (shost->host_busy == shost->host_failed))
+	{
 		up(shost->eh_wait);
 		SCSI_LOG_ERROR_RECOVERY(5, printk("Waking error handler"
 					  " thread\n"));
diff -Nru a/drivers/scsi/hosts.h b/drivers/scsi/hosts.h
--- a/drivers/scsi/hosts.h	Sun Feb 23 22:25:23 2003
+++ b/drivers/scsi/hosts.h	Sun Feb 23 22:25:23 2003
@@ -27,7 +27,6 @@
 #include <linux/config.h>
 #include <linux/proc_fs.h>
 #include <linux/types.h>
-#include <linux/pci.h>
 
 struct scsi_host_cmd_pool;
 
@@ -385,6 +384,7 @@
     spinlock_t		  default_lock;
     spinlock_t		  *host_lock;
 
+    struct list_head	eh_cmd_q;
     struct task_struct    * ehandler;  /* Error recovery thread. */
     struct semaphore      * eh_wait;   /* The error recovery thread waits on
                                           this. */
@@ -515,8 +515,6 @@
 extern void scsi_unblock_requests(struct Scsi_Host *);
 extern void scsi_block_requests(struct Scsi_Host *);
 extern void scsi_report_bus_reset(struct Scsi_Host *, int);
-extern void scsi_register_blocked_host(struct Scsi_Host *);
-extern void scsi_deregister_blocked_host(struct Scsi_Host *);
 
 static inline void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock)
 {
@@ -534,13 +532,6 @@
         return shost->host_gendev;
 }
 
-static inline void scsi_set_pci_device(struct Scsi_Host *shost,
-                                       struct pci_dev *pdev)
-{
-        scsi_set_device(shost, &pdev->dev);
-}
-
-
 /*
  * Prototypes for functions/data in scsi_scan.c
  */
@@ -595,7 +586,6 @@
  */
 extern void scsi_host_busy_inc(struct Scsi_Host *, Scsi_Device *);
 extern void scsi_host_busy_dec_and_test(struct Scsi_Host *, Scsi_Device *);
-extern void scsi_host_failed_inc_and_test(struct Scsi_Host *);
 
 /**
  * scsi_find_device - find a device given the host
diff -Nru a/drivers/scsi/ips.c b/drivers/scsi/ips.c
--- a/drivers/scsi/ips.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/scsi/ips.c	Sun Feb 23 22:25:21 2003
@@ -6744,7 +6744,7 @@
 	kfree(oldha);
 	ips_sh[index] = sh;
 	ips_ha[index] = ha;
-	scsi_set_pci_device(sh, ha->pcidev);
+	scsi_set_device(sh, &ha->pcidev->dev);
 
 	/* Store away needed values for later use */
 	sh->io_port = ha->io_addr;
diff -Nru a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
--- a/drivers/scsi/megaraid.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/scsi/megaraid.c	Sun Feb 23 22:25:21 2003
@@ -2963,7 +2963,7 @@
 		 */
 		host->max_sectors = 1024;
 
-		scsi_set_pci_device(host, pdev);
+		scsi_set_device(host, &pdev->dev);
 		megaCfg = (mega_host_config *) host->hostdata;
 		memset (megaCfg, 0, sizeof (mega_host_config));
 
diff -Nru a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
--- a/drivers/scsi/nsp32.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/scsi/nsp32.c	Sun Feb 23 22:25:23 2003
@@ -1661,7 +1661,7 @@
 	host->unique_id	  = data->BaseAddress;
 	host->n_io_port	  = data->NumAddress;
 	host->base        = data->MmioAddress;
-	scsi_set_pci_device(host, data->Pci);
+	scsi_set_device(host, &data->Pci->dev);
 
 	data->Host        = host;
 	spin_lock_init(&(data->Lock));
diff -Nru a/drivers/scsi/pci2000.c b/drivers/scsi/pci2000.c
--- a/drivers/scsi/pci2000.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/scsi/pci2000.c	Sun Feb 23 22:25:25 2003
@@ -707,7 +707,7 @@
 			goto unregister;
 			}
 		
-		scsi_set_pci_device(pshost, pdev);
+		scsi_set_device(pshost, &pdev->dev);
 		pshost->irq = pdev->irq;
 		setirq = 1;
 		padapter->irqOwned = 0;
diff -Nru a/drivers/scsi/pci2220i.c b/drivers/scsi/pci2220i.c
--- a/drivers/scsi/pci2220i.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/scsi/pci2220i.c	Sun Feb 23 22:25:21 2003
@@ -1439,14 +1439,14 @@
 				break;
 				}
 
-	        // test LBA and multiper sector transfer compatability
+	        // test LBA and multiper sector transfer compatibility
 			if (!pid->SupportLBA || (pid->NumSectorsPerInt < SECTORSXFER) || !pid->Valid_64_70 )
 				{
 				DEB (printk ("\npci2220i: sub 3"));
 				break;
 				}
 
-	        // test PIO/bus matering mode compatability
+	        // test PIO/bus matering mode compatibility
 			if ( (pid->MinPIOCycleWithoutFlow > 240) && !pid->SupportIORDYDisable && !padapter->timingPIO )
 				{
 				DEB (printk ("\npci2220i: sub 4"));
@@ -2389,7 +2389,7 @@
 	padapter->regRemap		= zr + RTR_LOCAL_REMAP;					// 32 bit local space remap
 	padapter->regDesc		= zr + RTR_REGIONS;	  					// 32 bit local region descriptor
 	padapter->regRange		= zr + RTR_LOCAL_RANGE;					// 32 bit local range
-	padapter->regIrqControl	= zr + RTR_INT_CONTROL_STATUS;			// 16 bit interupt control and status
+	padapter->regIrqControl	= zr + RTR_INT_CONTROL_STATUS;			// 16 bit interrupt control and status
 	padapter->regScratchPad	= zr + RTR_MAILBOX;	  					// 16 byte scratchpad I/O base address
 
 	padapter->regBase		= zl;
@@ -2549,7 +2549,7 @@
 		if ( GetRegs (pshost, FALSE, pcidev) )
 			goto unregister;
 
-		scsi_set_pci_device(pshost, pcidev);
+		scsi_set_device(pshost, &pcidev->dev);
 		pshost->max_id = padapter->numberOfDrives;
 		for ( z = 0;  z < padapter->numberOfDrives;  z++ )
 			{
diff -Nru a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
--- a/drivers/scsi/pcmcia/aha152x_stub.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/scsi/pcmcia/aha152x_stub.c	Sun Feb 23 22:25:26 2003
@@ -408,7 +408,7 @@
 	if (link->state & DEV_CONFIG) {
 	    Scsi_Cmnd tmp;
 	    CardServices(RequestConfiguration, link->handle, &link->conf);
-	    tmp.host = info->host;
+	    tmp.device->host = info->host;
 	    aha152x_host_reset(&tmp);
 	}
 	break;
diff -Nru a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
--- a/drivers/scsi/pcmcia/nsp_cs.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/scsi/pcmcia/nsp_cs.c	Sun Feb 23 22:25:27 2003
@@ -325,9 +325,9 @@
 static unsigned int nsphw_start_selection(Scsi_Cmnd   *SCpnt,
 					  nsp_hw_data *data)
 {
-	unsigned int  host_id	 = SCpnt->host->this_id;
-	unsigned int  base	 = SCpnt->host->io_port;
-	unsigned char target	 = SCpnt->target;
+	unsigned int  host_id	 = SCpnt->device->host->this_id;
+	unsigned int  base	 = SCpnt->device->host->io_port;
+	unsigned char target	 = SCpnt->device->id;
 	int	      time_out;
 	unsigned char phase, arbit;
 
@@ -405,7 +405,7 @@
  */
 static int nsp_msg(Scsi_Cmnd *SCpnt, nsp_hw_data *data)
 {
-	unsigned char	       target = SCpnt->target;
+	unsigned char	       target = SCpnt->device->id;
 //	unsigned char	       lun    = SCpnt->lun;
 	sync_data	      *sync   = &(data->Sync[target]);
 	struct nsp_sync_table *sync_table;
@@ -462,7 +462,7 @@
  */
 static void nsp_start_timer(Scsi_Cmnd *SCpnt, nsp_hw_data *data, int time)
 {
-	unsigned int base = SCpnt->host->io_port;
+	unsigned int base = SCpnt->device->host->io_port;
 
 	//DEBUG(0, "%s: in SCpnt=0x%p, time=%d\n", __FUNCTION__, SCpnt, time);
 	data->TimerCount = time;
@@ -474,7 +474,7 @@
  */
 static int nsp_negate_signal(Scsi_Cmnd *SCpnt, unsigned char mask, char *str)
 {
-	unsigned int  base = SCpnt->host->io_port;
+	unsigned int  base = SCpnt->device->host->io_port;
 	unsigned char reg;
 	int	      time_out;
 
@@ -503,7 +503,7 @@
 			     unsigned char  current_phase,
 			     unsigned char  mask)
 {
-	unsigned int  base	 = SCpnt->host->io_port;
+	unsigned int  base	 = SCpnt->device->host->io_port;
 	int	      time_out;
 	unsigned char phase, i_src;
 
@@ -536,7 +536,7 @@
  */
 static int nsp_xfer(Scsi_Cmnd *SCpnt, nsp_hw_data *data, int phase)
 {
-	unsigned int  base = SCpnt->host->io_port;
+	unsigned int  base = SCpnt->device->host->io_port;
 	char	     *buf  = data->MsgBuffer;
 	int	      len  = MIN(MSGBUF_SIZE, data->MsgLen);
 	int	      ptr;
@@ -606,7 +606,7 @@
  */
 static int nsp_reselected(Scsi_Cmnd *SCpnt, nsp_hw_data *data)
 {
-	unsigned int  base = SCpnt->host->io_port;
+	unsigned int  base = SCpnt->device->host->io_port;
 	unsigned char reg;
 
 	//DEBUG(0, "%s:\n", __FUNCTION__);
@@ -626,7 +626,7 @@
  */
 static int nsp_fifo_count(Scsi_Cmnd *SCpnt)
 {
-	unsigned int base = SCpnt->host->io_port;
+	unsigned int base = SCpnt->device->host->io_port;
 	unsigned int count;
 	unsigned int l, m, h, dummy;
 
@@ -653,8 +653,8 @@
  */
 static void nsp_pio_read(Scsi_Cmnd *SCpnt, nsp_hw_data *data)
 {
-	unsigned int  base      = SCpnt->host->io_port;
-	unsigned long mmio_base = SCpnt->host->base;
+	unsigned int  base      = SCpnt->device->host->io_port;
+	unsigned long mmio_base = SCpnt->device->host->base;
 	long	      time_out;
 	int	      ocount, res;
 	unsigned char stat, fifo_stat;
@@ -746,8 +746,8 @@
  */
 static void nsp_pio_write(Scsi_Cmnd *SCpnt, nsp_hw_data *data)
 {
-	unsigned int  base     = SCpnt->host->io_port;
-	unsigned long mmio_base = SCpnt->host->base;
+	unsigned int  base     = SCpnt->device->host->io_port;
+	unsigned long mmio_base = SCpnt->device->host->base;
 	int	      time_out;
 	int           ocount, res;
 	unsigned char stat;
@@ -838,8 +838,8 @@
  */
 static int nsp_nexus(Scsi_Cmnd *SCpnt, nsp_hw_data *data)
 {
-	unsigned int   base   = SCpnt->host->io_port;
-	unsigned char  target = SCpnt->target;
+	unsigned int   base   = SCpnt->device->host->io_port;
+	unsigned char  target = SCpnt->device->id;
 //	unsigned char  lun    = SCpnt->lun;
 	sync_data     *sync   = &(data->Sync[target]);
 
@@ -944,8 +944,8 @@
 		return;
 	} else {
 		tmpSC    = data->CurrentSC;
-		target   = tmpSC->target;
-		lun      = tmpSC->lun;
+		target   = tmpSC->device->id;
+		lun      = tmpSC->device->lun;
 		sync_neg = &(data->Sync[target].SyncNegotiation);
 	}
 
@@ -1425,7 +1425,7 @@
 static int nsp_eh_bus_reset(Scsi_Cmnd *SCpnt)
 {
 	nsp_hw_data *data = &nsp_data;
-	unsigned int base = SCpnt->host->io_port;
+	unsigned int base = SCpnt->device->host->io_port;
 	int	     i;
 
 	DEBUG(0, "%s: SCpnt=0x%p base=0x%x\n", __FUNCTION__, SCpnt, base);
@@ -1960,7 +1960,7 @@
 		}
 		info->stop = 0;
 
-		tmp.host = info->host;
+		tmp.device->host = info->host;
 		nsp_eh_host_reset(&tmp);
 		nsp_eh_bus_reset(&tmp);
 
diff -Nru a/drivers/scsi/pcmcia/nsp_message.c b/drivers/scsi/pcmcia/nsp_message.c
--- a/drivers/scsi/pcmcia/nsp_message.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/scsi/pcmcia/nsp_message.c	Sun Feb 23 22:25:23 2003
@@ -10,7 +10,7 @@
 
 static void nsp_message_in(Scsi_Cmnd *SCpnt, nsp_hw_data *data)
 {
-	unsigned int  base = SCpnt->host->io_port;
+	unsigned int  base = SCpnt->device->host->io_port;
 	unsigned char data_reg, control_reg;
 	int           ret, len;
 
diff -Nru a/drivers/scsi/pluto.c b/drivers/scsi/pluto.c
--- a/drivers/scsi/pluto.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/scsi/pluto.c	Sun Feb 23 22:25:23 2003
@@ -287,7 +287,7 @@
 	struct pluto *pluto = (struct pluto *)host->hostdata;
 	fc_channel *fc = pluto->fc;
 
-	if (fc->module) __MOD_DEC_USE_COUNT(fc->module);
+	module_put(fc->module);
 	
 	fc->fcp_register(fc, TYPE_SCSI_FCP, 1);
 	PLND((" releasing pluto.\n"));
diff -Nru a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
--- a/drivers/scsi/ppa.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/scsi/ppa.c	Sun Feb 23 22:25:25 2003
@@ -106,7 +106,7 @@
 
 int ppa_detect(Scsi_Host_Template * host)
 {
-    struct Scsi_Host *hreg;
+    struct Scsi_Host *hreg = NULL;
     int ports;
     int i, nhosts, try_again;
     struct parport *pb;
diff -Nru a/drivers/scsi/psi_chip.h b/drivers/scsi/psi_chip.h
--- a/drivers/scsi/psi_chip.h	Sun Feb 23 22:25:21 2003
+++ b/drivers/scsi/psi_chip.h	Sun Feb 23 22:25:21 2003
@@ -108,7 +108,7 @@
 typedef struct
 	{
 	UCHAR		irq;			// interrupt request channel number
-	UCHAR		numDrives;		// Number of accessable drives
+	UCHAR		numDrives;		// Number of accessible drives
 	UCHAR		fastFormat;	 	// Boolean for fast format enable
 	}	CHIP_CONFIG_N;
 
diff -Nru a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
--- a/drivers/scsi/qla1280.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/scsi/qla1280.c	Sun Feb 23 22:25:27 2003
@@ -814,7 +814,7 @@
 		goto error;
 	}
 
-	scsi_set_pci_device(host, pdev);
+	scsi_set_device(host, &pdev->dev);
 	ha = (struct scsi_qla_host *)host->hostdata;
 	/* Clear our data area */
 	memset(ha, 0, sizeof(struct scsi_qla_host));
diff -Nru a/drivers/scsi/qlogicfc.c b/drivers/scsi/qlogicfc.c
--- a/drivers/scsi/qlogicfc.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/scsi/qlogicfc.c	Sun Feb 23 22:25:25 2003
@@ -731,7 +731,7 @@
 			        printk("qlogicfc%d : could not register host.\n", hosts);
 				continue;
 			}
- 			scsi_set_pci_device(host, pdev);
+ 			scsi_set_device(host, &pdev->dev);
 			host->max_id = QLOGICFC_MAX_ID + 1;
 			host->max_lun = QLOGICFC_MAX_LUN;
 			hostdata = (struct isp2x00_hostdata *) host->hostdata;
diff -Nru a/drivers/scsi/qlogicisp.c b/drivers/scsi/qlogicisp.c
--- a/drivers/scsi/qlogicisp.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/scsi/qlogicisp.c	Sun Feb 23 22:25:27 2003
@@ -685,7 +685,7 @@
 		memset(hostdata, 0, sizeof(struct isp1020_hostdata));
 
 		hostdata->pci_dev = pdev;
-		scsi_set_pci_device(host, pdev);
+		scsi_set_device(host, &pdev->dev);
 
 		if (isp1020_init(host))
 			goto fail_and_unregister;
diff -Nru a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
--- a/drivers/scsi/scsi.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/scsi/scsi.c	Sun Feb 23 22:25:24 2003
@@ -36,9 +36,6 @@
  *  out_of_space hacks, D. Gilbert (dpg) 990608
  */
 
-#define REVISION	"Revision: 1.00"
-#define VERSION		"Id: scsi.c 1.00 2000/09/26"
-
 #include <linux/config.h>
 #include <linux/module.h>
 
@@ -171,30 +168,6 @@
 #endif
 
 /*
- *	Issue a command and wait for it to complete
- */
- 
-static void scsi_wait_done(Scsi_Cmnd * SCpnt)
-{
-	struct request *req = SCpnt->request;
-        struct request_queue *q = SCpnt->device->request_queue;
-        unsigned long flags;
-
-        ASSERT_LOCK(q->queue_lock, 0);
-	req->rq_status = RQ_SCSI_DONE;	/* Busy, but indicate request done */
-
-        spin_lock_irqsave(q->queue_lock, flags);
-
-        if(blk_rq_tagged(req))
-                blk_queue_end_tag(q, req);
-
-        spin_unlock_irqrestore(q->queue_lock, flags);
-
-	if (req->waiting)
-		complete(req->waiting);
-}
-
-/*
  * Function:    scsi_allocate_request
  *
  * Purpose:     Allocate a request descriptor.
@@ -263,87 +236,6 @@
 	kfree(req);
 }
 
-/*
- * Function:    scsi_mlqueue_insert()
- *
- * Purpose:     Insert a command in the midlevel queue.
- *
- * Arguments:   cmd    - command that we are adding to queue.
- *              reason - why we are inserting command to queue.
- *
- * Lock status: Assumed that lock is not held upon entry.
- *
- * Returns:     Nothing.
- *
- * Notes:       We do this for one of two cases.  Either the host is busy
- *              and it cannot accept any more commands for the time being,
- *              or the device returned QUEUE_FULL and can accept no more
- *              commands.
- * Notes:       This could be called either from an interrupt context or a
- *              normal process context.
- */
-static int scsi_mlqueue_insert(Scsi_Cmnd * cmd, int reason)
-{
-	struct Scsi_Host *host = cmd->device->host;
-	struct scsi_device *device = cmd->device;
-
-	SCSI_LOG_MLQUEUE(1,
-		 printk("Inserting command %p into mlqueue\n", cmd));
-
-	/*
-	 * We are inserting the command into the ml queue.  First, we
-	 * cancel the timer, so it doesn't time out.
-	 */
-	scsi_delete_timer(cmd);
-
-	/*
-	 * Next, set the appropriate busy bit for the device/host.
-	 *
-	 * If the host/device isn't busy, assume that something actually
-	 * completed, and that we should be able to queue a command now.
-	 *
-	 * Note that the prior mid-layer assumption that any host could
-	 * always queue at least one command is now broken.  The mid-layer
-	 * will implement a user specifiable stall (see
-	 * scsi_host.max_host_blocked and scsi_device.max_device_blocked)
-	 * if a command is requeued with no other commands outstanding
-	 * either for the device or for the host.
-	 */
-	if (reason == SCSI_MLQUEUE_HOST_BUSY) {
-		host->host_blocked = host->max_host_blocked;
-	} else {
-		device->device_blocked = device->max_device_blocked;
-	}
-
-	/*
-	 * Register the fact that we own the thing for now.
-	 */
-	cmd->state = SCSI_STATE_MLQUEUE;
-	cmd->owner = SCSI_OWNER_MIDLEVEL;
-	cmd->bh_next = NULL;
-
-	/*
-	 * Decrement the counters, since these commands are no longer
-	 * active on the host/device.
-	 */
-	scsi_host_busy_dec_and_test(host, device);
-
-	/*
-	 * Insert this command at the head of the queue for it's device.
-	 * It will go before all other commands that are already in the queue.
-	 *
-	 * NOTE: there is magic here about the way the queue is
-	 * plugged if we have no outstanding commands.
-	 * scsi_insert_special_cmd eventually calls
-	 * blk_queue_insert().  Although this *doesn't* plug the
-	 * queue, it does call the request function.  The SCSI request
-	 * function detects the blocked condition and plugs the queue
-	 * appropriately.
-	 */
-	scsi_insert_special_cmd(cmd, 1);
-	return 0;
-}
-
 struct scsi_host_cmd_pool {
 	kmem_cache_t	*slab;
 	unsigned int	users;
@@ -621,7 +513,7 @@
 			rtn = host->hostt->queuecommand(SCpnt, scsi_done);
 			spin_unlock_irqrestore(host->host_lock, flags);
 			if (rtn != 0) {
-				scsi_mlqueue_insert(SCpnt, rtn == SCSI_MLQUEUE_DEVICE_BUSY ? rtn : SCSI_MLQUEUE_HOST_BUSY);
+				scsi_queue_insert(SCpnt, rtn == SCSI_MLQUEUE_DEVICE_BUSY ? rtn : SCSI_MLQUEUE_HOST_BUSY);
 				SCSI_LOG_MLQUEUE(3,
 				   printk("queuecommand : request rejected\n"));                                
 			}
@@ -659,128 +551,6 @@
 	return rtn;
 }
 
-void scsi_wait_req (Scsi_Request * SRpnt, const void *cmnd ,
- 		  void *buffer, unsigned bufflen, 
- 		  int timeout, int retries)
-{
-	DECLARE_COMPLETION(wait);
-	
-	SRpnt->sr_request->waiting = &wait;
-	SRpnt->sr_request->rq_status = RQ_SCSI_BUSY;
-	scsi_do_req (SRpnt, (void *) cmnd,
-		buffer, bufflen, scsi_wait_done, timeout, retries);
-	generic_unplug_device(SRpnt->sr_device->request_queue);
-	wait_for_completion(&wait);
-	SRpnt->sr_request->waiting = NULL;
-	if( SRpnt->sr_command != NULL )
-	{
-		scsi_put_command(SRpnt->sr_command);
-		SRpnt->sr_command = NULL;
-	}
-
-}
- 
-/*
- * Function:    scsi_do_req
- *
- * Purpose:     Queue a SCSI request
- *
- * Arguments:   SRpnt     - command descriptor.
- *              cmnd      - actual SCSI command to be performed.
- *              buffer    - data buffer.
- *              bufflen   - size of data buffer.
- *              done      - completion function to be run.
- *              timeout   - how long to let it run before timeout.
- *              retries   - number of retries we allow.
- *
- * Lock status: With the new queueing code, this is SMP-safe, and no locks
- *              need be held upon entry.   The old queueing code the lock was
- *              assumed to be held upon entry.
- *
- * Returns:     Nothing.
- *
- * Notes:       Prior to the new queue code, this function was not SMP-safe.
- *              Also, this function is now only used for queueing requests
- *              for things like ioctls and character device requests - this
- *              is because we essentially just inject a request into the
- *              queue for the device. Normal block device handling manipulates
- *              the queue directly.
- */
-void scsi_do_req(Scsi_Request * SRpnt, const void *cmnd,
-	      void *buffer, unsigned bufflen, void (*done) (Scsi_Cmnd *),
-		 int timeout, int retries)
-{
-	Scsi_Device * SDpnt = SRpnt->sr_device;
-	struct Scsi_Host *host = SDpnt->host;
-
-	ASSERT_LOCK(host->host_lock, 0);
-
-	SCSI_LOG_MLQUEUE(4,
-			 {
-			 int i;
-			 int size = COMMAND_SIZE(((const unsigned char *)cmnd)[0]);
-			 printk("scsi_do_req (host = %d, channel = %d target = %d, "
-		    "buffer =%p, bufflen = %d, done = %p, timeout = %d, "
-				"retries = %d)\n"
-				"command : ", host->host_no, SDpnt->channel, SDpnt->id, buffer,
-				bufflen, done, timeout, retries);
-			 for (i	 = 0; i < size; ++i)
-			 	printk("%02x  ", ((unsigned char *) cmnd)[i]);
-			 	printk("\n");
-			 });
-
-	if (!host) {
-		panic("Invalid or not present host.\n");
-	}
-
-	/*
-	 * If the upper level driver is reusing these things, then
-	 * we should release the low-level block now.  Another one will
-	 * be allocated later when this request is getting queued.
-	 */
-	if( SRpnt->sr_command != NULL )
-	{
-		scsi_put_command(SRpnt->sr_command);
-		SRpnt->sr_command = NULL;
-	}
-
-	/*
-	 * We must prevent reentrancy to the lowlevel host driver.  This prevents
-	 * it - we enter a loop until the host we want to talk to is not busy.
-	 * Race conditions are prevented, as interrupts are disabled in between the
-	 * time we check for the host being not busy, and the time we mark it busy
-	 * ourselves.
-	 */
-
-
-	/*
-	 * Our own function scsi_done (which marks the host as not busy, disables
-	 * the timeout counter, etc) will be called by us or by the
-	 * scsi_hosts[host].queuecommand() function needs to also call
-	 * the completion function for the high level driver.
-	 */
-
-	memcpy((void *) SRpnt->sr_cmnd, (const void *) cmnd, 
-	       sizeof(SRpnt->sr_cmnd));
-	SRpnt->sr_bufflen = bufflen;
-	SRpnt->sr_buffer = buffer;
-	SRpnt->sr_allowed = retries;
-	SRpnt->sr_done = done;
-	SRpnt->sr_timeout_per_command = timeout;
-
-	if (SRpnt->sr_cmd_len == 0)
-		SRpnt->sr_cmd_len = COMMAND_SIZE(SRpnt->sr_cmnd[0]);
-
-	/*
-	 * At this point, we merely set up the command, stick it in the normal
-	 * request queue, and return.  Eventually that request will come to the
-	 * top of the list, and will be dispatched.
-	 */
-	scsi_insert_special_req(SRpnt, 0);
-
-	SCSI_LOG_MLQUEUE(3, printk("Leaving scsi_do_req()\n"));
-}
- 
 /*
  * Function:    scsi_init_cmd_from_req
  *
@@ -998,7 +768,7 @@
 				 */
 				SCSI_LOG_MLCOMPLETE(3, printk("Command rejected as device queue full, put on ml queue %p\n",
                                                               SCpnt));
-				scsi_mlqueue_insert(SCpnt, SCSI_MLQUEUE_DEVICE_BUSY);
+				scsi_queue_insert(SCpnt, SCSI_MLQUEUE_DEVICE_BUSY);
 				break;
 			default:
 				/*
@@ -1017,13 +787,9 @@
 				if ((status_byte(SCpnt->result) & CHECK_CONDITION) != 0) {
 					SCSI_LOG_MLCOMPLETE(3, print_sense("bh", SCpnt));
 				}
-				if (SCpnt->device->host->eh_wait != NULL) {
-					scsi_eh_eflags_set(SCpnt, SCSI_EH_CMD_FAILED | SCSI_EH_CMD_ERR);
-					SCpnt->owner = SCSI_OWNER_ERROR_HANDLER;
-					SCpnt->state = SCSI_STATE_FAILED;
 
-					scsi_host_failed_inc_and_test(SCpnt->device->host);
-				} else {
+				if (!scsi_eh_scmd_add(SCpnt, 0))
+				{
 					/*
 					 * We only get here if the error
 					 * recovery thread has died.
@@ -1375,29 +1141,6 @@
 }
 
 /**
- * scsi_dev_list_init: set up the dynamic device list.
- * @dev_list:	string of device flags to add
- *
- * Description:
- * 	Add command line @dev_list entries, then add
- * 	scsi_static_device_list entries to the scsi device info list.
- **/
-static void scsi_dev_info_list_init (char *dev_list)
-{
-	int i;
-
-	if (scsi_dev_info_list_add_str(dev_list) == -ENOMEM)
-		return;
-	for (i = 0; scsi_static_device_list[i].vendor != NULL; i++)
-		if (scsi_dev_info_list_add(1 /* compatibile */,
-			   scsi_static_device_list[i].vendor,
-			   scsi_static_device_list[i].model,
-			   NULL,
-			   scsi_static_device_list[i].flags) == -ENOMEM)
-			return;
-}
-
-/**
  * scsi_dev_info_list_delete: called from scsi.c:exit_scsi to remove
  * 	the scsi_dev_info_list.
  **/
@@ -1414,6 +1157,37 @@
 }
 
 /**
+ * scsi_dev_list_init: set up the dynamic device list.
+ * @dev_list:	string of device flags to add
+ *
+ * Description:
+ * 	Add command line @dev_list entries, then add
+ * 	scsi_static_device_list entries to the scsi device info list.
+ **/
+static int scsi_dev_info_list_init (char *dev_list)
+{
+	int error, i;
+
+	error = scsi_dev_info_list_add_str(dev_list);
+	if (error)
+		return error;
+
+	for (i = 0; scsi_static_device_list[i].vendor != NULL; i++) {
+		error = scsi_dev_info_list_add(1 /* compatibile */,
+				scsi_static_device_list[i].vendor,
+				scsi_static_device_list[i].model,
+				NULL,
+				scsi_static_device_list[i].flags);
+		if (error)
+			break;
+	}
+
+	if (error)
+		scsi_dev_info_list_delete();
+	return error;
+}
+
+/**
  * get_device_flags - get device specific flags from the dynamic device
  * list. Called during scan time.
  * @vendor:	vendor name
@@ -1525,6 +1299,44 @@
 	module_put(sdev->host->hostt->module);
 }
 
+/**
+ * scsi_set_device_offline - set scsi_device offline
+ * @sdev:	pointer to struct scsi_device to offline. 
+ *
+ * Locks:	host_lock held on entry.
+ **/
+void scsi_set_device_offline(struct scsi_device *sdev)
+{
+	struct scsi_cmnd *scmd;
+	int	cmds_active = 0;
+	unsigned long flags;
+
+	sdev->online = FALSE;
+
+	spin_lock_irqsave(&sdev->list_lock, flags);
+	list_for_each_entry(scmd, &sdev->cmd_list, list) {
+		if (scmd->request && scmd->request->rq_status != RQ_INACTIVE) {
+			/*
+			 * If we are unable to remove the timer, it means
+			 * that the command has already timed out or
+			 * finished.
+			 */
+			if (!scsi_delete_timer(scmd)) {
+				continue;
+			}
+
+			++cmds_active;
+
+			scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD);
+		}
+	}
+	spin_unlock_irqrestore(&sdev->list_lock, flags);
+
+	if (!cmds_active) {
+		/* FIXME: Send online state change hotplug event */
+	}
+}
+
 /*
  * Function:	scsi_slave_attach()
  *
@@ -1664,17 +1476,38 @@
 
 #endif
 
-/* FIXME(hch): add proper error handling */
 static int __init init_scsi(void)
 {
-	scsi_init_queue();
-	scsi_init_procfs();
-	devfs_mk_dir(NULL, "scsi", NULL);
+	int error;
+
+	error = scsi_init_queue();
+	if (error)
+		return error;
+	error = scsi_init_procfs();
+	if (error)
+		goto cleanup_queue;
+	error = scsi_dev_info_list_init(scsi_dev_flags);
+	if (error)
+		goto cleanup_procfs;
+	error = scsi_sysfs_register();
+	if (error)
+		goto cleanup_devlist;
+
 	scsi_host_init();
-	scsi_dev_info_list_init(scsi_dev_flags);
-	scsi_sysfs_register();
+	devfs_mk_dir(NULL, "scsi", NULL);
 	open_softirq(SCSI_SOFTIRQ, scsi_softirq, NULL);
+	printk(KERN_NOTICE "SCSI subsystem initialized\n");
 	return 0;
+
+cleanup_devlist:
+	scsi_dev_info_list_delete();
+cleanup_procfs:
+	scsi_exit_procfs();
+cleanup_queue:
+	scsi_exit_queue();
+	printk(KERN_ERR "SCSI subsystem failed to initialize, error = %d\n",
+	       -error);
+	return error;
 }
 
 static void __exit exit_scsi(void)
diff -Nru a/drivers/scsi/scsi.h b/drivers/scsi/scsi.h
--- a/drivers/scsi/scsi.h	Sun Feb 23 22:25:22 2003
+++ b/drivers/scsi/scsi.h	Sun Feb 23 22:25:22 2003
@@ -433,12 +433,11 @@
  */
 extern int scsi_maybe_unblock_host(Scsi_Device * SDpnt);
 extern void scsi_setup_cmd_retry(Scsi_Cmnd *SCpnt);
-extern int scsi_insert_special_cmd(Scsi_Cmnd * SCpnt, int);
 extern void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
 			       int block_sectors);
-extern void scsi_queue_next_request(request_queue_t * q, Scsi_Cmnd * SCpnt);
-extern int scsi_prep_fn(struct request_queue *q, struct request *req);
-extern void scsi_request_fn(request_queue_t * q);
+extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
+extern request_queue_t *scsi_alloc_queue(struct Scsi_Host *shost);
+extern void scsi_free_queue(request_queue_t *q);
 extern int scsi_init_queue(void);
 extern void scsi_exit_queue(void);
 
@@ -456,6 +455,7 @@
 extern void scsi_slave_detach(struct scsi_device *);
 extern int scsi_device_get(struct scsi_device *);
 extern void scsi_device_put(struct scsi_device *);
+extern void scsi_set_device_offline(struct scsi_device *);
 extern void scsi_done(Scsi_Cmnd * SCpnt);
 extern void scsi_finish_command(Scsi_Cmnd *);
 extern int scsi_retry_command(Scsi_Cmnd *);
@@ -727,6 +727,7 @@
 
 	struct list_head list;  /* scsi_cmnd participates in queue lists */
 
+	struct list_head eh_entry; /* entry for the host eh_cmd_q */
 	int eh_state;		/* Used for state tracking in error handlr */
 	int eh_eflags;		/* Used by error handlr */
 	void (*done) (struct scsi_cmnd *);	/* Mid-level done function */
@@ -851,6 +852,7 @@
  */
 #define SCSI_MLQUEUE_HOST_BUSY   0x1055
 #define SCSI_MLQUEUE_DEVICE_BUSY 0x1056
+#define SCSI_MLQUEUE_EH_RETRY    0x1057
 
 /*
  * old style reset request from external source
@@ -961,12 +963,12 @@
 /*
  * Scsi Error Handler Flags
  */
-#define SCSI_EH_CMD_ERR	0x0001	/* Orig cmd error'd */
-#define SCSI_EH_CMD_FAILED	0x0002	/* Orig cmd error type failed */
-#define SCSI_EH_CMD_TIMEOUT	0x0004	/* Orig cmd error type timeout */
-#define SCSI_EH_REC_TIMEOUT	0x0008	/* Recovery cmd timeout */
+#define SCSI_EH_CANCEL_CMD	0x0001	/* Cancel this cmd */
+#define SCSI_EH_REC_TIMEOUT	0x0002	/* EH retry timed out */
 
 #define SCSI_SENSE_VALID(scmd) ((scmd->sense_buffer[0] & 0x70) == 0x70)
+
+extern int scsi_eh_scmd_add(struct scsi_cmnd *, int);
 
 int scsi_set_medium_removal(Scsi_Device *dev, char state);
 
diff -Nru a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
--- a/drivers/scsi/scsi_error.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/scsi/scsi_error.c	Sun Feb 23 22:25:21 2003
@@ -15,33 +15,19 @@
  */
 
 #include <linux/module.h>
-
 #include <linux/sched.h>
 #include <linux/timer.h>
 #include <linux/string.h>
 #include <linux/slab.h>
-#include <linux/ioport.h>
 #include <linux/kernel.h>
-#include <linux/stat.h>
-#include <linux/blk.h>
 #include <linux/interrupt.h>
-#include <linux/delay.h>
+#include <linux/blkdev.h>
 #include <linux/smp_lock.h>
-#include <linux/completion.h>
-
-#define __KERNEL_SYSCALLS__
-
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/irq.h>
-#include <asm/dma.h>
+#include <scsi/scsi_ioctl.h>
 
 #include "scsi.h"
 #include "hosts.h"
 
-#include <scsi/scsi_ioctl.h> /* grr */
-
 #ifdef DEBUG
 #define SENSE_TIMEOUT SCSI_TIMEOUT
 #else
@@ -56,6 +42,49 @@
 #define HOST_RESET_SETTLE_TIME  10*HZ
 
 /**
+ * scsi_eh_scmd_add - add scsi cmd to error handling.
+ * @scmd:	scmd to run eh on.
+ * @eh_flag:	optional SCSI_EH flag.
+ *
+ * Return value:
+ *	0 on failure.
+ **/
+int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag)
+{
+	struct Scsi_Host *shost = scmd->device->host;
+	unsigned long flags;
+
+	if (shost->eh_wait == NULL)
+		return 0;
+
+	spin_lock_irqsave(shost->host_lock, flags);
+
+	scsi_eh_eflags_set(scmd, eh_flag);
+	/*
+	 * FIXME: Can we stop setting owner and state.
+	 */
+	scmd->owner = SCSI_OWNER_ERROR_HANDLER;
+	scmd->state = SCSI_STATE_FAILED;
+	/*
+	 * Set the serial_number_at_timeout to the current
+	 * serial_number
+	 */
+	scmd->serial_number_at_timeout = scmd->serial_number;
+	list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q);
+	shost->in_recovery = 1;
+	shost->host_failed++;
+	if (shost->host_busy == shost->host_failed) {
+		up(shost->eh_wait);
+		SCSI_LOG_ERROR_RECOVERY(5, printk("Waking error handler"
+					  " thread\n"));
+	}
+
+	spin_unlock_irqrestore(shost->host_lock, flags);
+
+	return 1;
+}
+
+/**
  * scsi_add_timer - Start timeout timer for a single scsi command.
  * @scmd:	scsi command that is about to start running.
  * @timeout:	amount of time to allow this command to run.
@@ -68,8 +97,8 @@
  *    simple, really, especially compared to the old way of handling this
  *    crap.
  **/
-void scsi_add_timer(Scsi_Cmnd *scmd, int timeout, void (*complete)
-		    (Scsi_Cmnd *))
+void scsi_add_timer(struct scsi_cmnd *scmd, int timeout,
+		    void (*complete)(struct scsi_cmnd *))
 {
 
 	/*
@@ -77,10 +106,10 @@
 	 * first delete the timer.  The timer handling code gets rather
 	 * confused if we don't do this.
 	 */
-	if (scmd->eh_timeout.function != NULL) {
+	if (scmd->eh_timeout.function)
 		del_timer(&scmd->eh_timeout);
-	}
-	scmd->eh_timeout.data = (unsigned long) scmd;
+
+	scmd->eh_timeout.data = (unsigned long)scmd;
 	scmd->eh_timeout.expires = jiffies + timeout;
 	scmd->eh_timeout.function = (void (*)(unsigned long)) complete;
 
@@ -89,7 +118,6 @@
 					  scmd, timeout, complete));
 
 	add_timer(&scmd->eh_timeout);
-
 }
 
 /**
@@ -103,7 +131,7 @@
  *     1 if we were able to detach the timer.  0 if we blew it, and the
  *     timer function has already started to run.
  **/
-int scsi_delete_timer(Scsi_Cmnd *scmd)
+int scsi_delete_timer(struct scsi_cmnd *scmd)
 {
 	int rtn;
 
@@ -113,7 +141,7 @@
 					 " rtn: %d\n", __FUNCTION__,
 					 scmd, rtn));
 
-	scmd->eh_timeout.data = (unsigned long) NULL;
+	scmd->eh_timeout.data = (unsigned long)NULL;
 	scmd->eh_timeout.function = NULL;
 
 	return rtn;
@@ -129,24 +157,16 @@
  *     normal completion function determines that the timer has already
  *     fired, then it mustn't do anything.
  **/
-void scsi_times_out(Scsi_Cmnd *scmd)
+void scsi_times_out(struct scsi_cmnd *scmd)
 {
-	struct Scsi_Host *shost = scmd->device->host;
-
-	/* Set the serial_number_at_timeout to the current serial_number */
-	scmd->serial_number_at_timeout = scmd->serial_number;
-
-	scsi_eh_eflags_set(scmd, SCSI_EH_CMD_TIMEOUT | SCSI_EH_CMD_ERR);
-
-	if (unlikely(shost->eh_wait == NULL)) {
+	if (unlikely(!scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD))) {
 		panic("Error handler thread not present at %p %p %s %d",
-		      scmd, shost, __FILE__, __LINE__);
+		      scmd, scmd->device->host, __FILE__, __LINE__);
 	}
 
-	scsi_host_failed_inc_and_test(shost);
-
 	SCSI_LOG_TIMEOUT(3, printk("Command timed out busy=%d failed=%d\n",
-				   shost->host_busy, shost->host_failed));
+				   scmd->device->host->host_busy,
+				   scmd->device->host->host_failed));
 }
 
 /**
@@ -160,7 +180,7 @@
  * Return value:
  *     0 when dev was taken offline by error recovery. 1 OK to proceed.
  **/
-int scsi_block_when_processing_errors(Scsi_Device *sdev)
+int scsi_block_when_processing_errors(struct scsi_device *sdev)
 {
 	wait_event(sdev->host->host_wait, (sdev->host->in_recovery == 0));
 
@@ -173,39 +193,40 @@
 #if CONFIG_SCSI_LOGGING
 /**
  * scsi_eh_prt_fail_stats - Log info on failures.
- * @sc_list:	List for failed cmds.
  * @shost:	scsi host being recovered.
+ * @work_q:	Queue of scsi cmds to process.
  **/
-static void scsi_eh_prt_fail_stats(Scsi_Cmnd *sc_list, struct Scsi_Host *shost)
+static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost,
+					  struct list_head *work_q)
 {
-	Scsi_Cmnd *scmd;
-	Scsi_Device *sdev;
+	struct scsi_cmnd *scmd;
+	struct scsi_device *sdev;
 	int total_failures = 0;
 	int cmd_failed = 0;
-	int cmd_timed_out = 0;
+	int cmd_cancel = 0;
 	int devices_failed = 0;
 
 
 	list_for_each_entry(sdev, &shost->my_devices, siblings) {
-		for (scmd = sc_list; scmd; scmd = scmd->bh_next) {
+		list_for_each_entry(scmd, work_q, eh_entry) {
 			if (scmd->device == sdev) {
 				++total_failures;
 				if (scsi_eh_eflags_chk(scmd,
-						       SCSI_EH_CMD_TIMEOUT))
-					++cmd_timed_out;
-				else
+						       SCSI_EH_CANCEL_CMD))
+					++cmd_cancel;
+				else 
 					++cmd_failed;
 			}
 		}
 
-		if (cmd_timed_out || cmd_failed) {
+		if (cmd_cancel || cmd_failed) {
 			SCSI_LOG_ERROR_RECOVERY(3,
 				printk("%s: %d:%d:%d:%d cmds failed: %d,"
-				       " timedout: %d\n",
+				       " cancel: %d\n",
 				       __FUNCTION__, shost->host_no,
 				       sdev->channel, sdev->id, sdev->lun,
-				       cmd_failed, cmd_timed_out));
-			cmd_timed_out = 0;
+				       cmd_failed, cmd_cancel));
+			cmd_cancel = 0;
 			cmd_failed = 0;
 			++devices_failed;
 		}
@@ -218,79 +239,16 @@
 #endif
 
 /**
- * scsi_eh_get_failed - Gather failed cmds.
- * @sc_list:	A pointer to a list for failed cmds.
- * @shost:	Scsi host being recovered.
- *
- * XXX Add opaque interator for device / shost. Investigate direct
- * addition to per eh list on error allowing skipping of this step.
- **/
-static void scsi_eh_get_failed(Scsi_Cmnd **sc_list, struct Scsi_Host *shost)
-{
-	int found;
-	Scsi_Device *sdev;
-	Scsi_Cmnd *scmd;
-
-	found = 0;
-	list_for_each_entry(sdev, &shost->my_devices, siblings) {
-		unsigned long flags;
-
-		spin_lock_irqsave(&sdev->list_lock, flags);
-		list_for_each_entry(scmd, &sdev->cmd_list, list) {
-			if (scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_ERR)) {
-				scmd->bh_next = *sc_list;
-				*sc_list = scmd;
-				found++;
-			} else {
-				/*
-				 * FIXME Verify how this can happen and if
-				 * this is still needed??
-				 */
-			    if (scmd->state != SCSI_STATE_INITIALIZING
-			    && scmd->state != SCSI_STATE_UNUSED) {
-				/*
-				 * Rats.  Something is still floating
-				 * around out there This could be the
-				 * result of the fact that the upper level
-				 * drivers are still frobbing commands
-				 * that might have succeeded.  There are
-				 * two outcomes. One is that the command
-				 * block will eventually be freed, and the
-				 * other one is that the command will be
-				 * queued and will be finished along the
-				 * way.
-				 */
-				SCSI_LOG_ERROR_RECOVERY(1, printk("Error hdlr"
-							  " prematurely woken"
-							  " cmds still active"
-							  " (%p %x %d)\n",
-					       scmd, scmd->state,
-					       scmd->device->id));
-				}
-			}
-		}
-		spin_unlock_irqrestore(&sdev->list_lock, flags);
-	}
-
-	SCSI_LOG_ERROR_RECOVERY(1, scsi_eh_prt_fail_stats(*sc_list, shost));
-
-	if (shost->host_failed != found)
-		printk(KERN_ERR "%s: host_failed: %d != found: %d\n", 
-		       __FUNCTION__, shost->host_failed, found);
-}
-
-/**
  * scsi_check_sense - Examine scsi cmd sense
  * @scmd:	Cmd to have sense checked.
  *
  * Return value:
  * 	SUCCESS or FAILED or NEEDS_RETRY
  **/
-static int scsi_check_sense(Scsi_Cmnd *scmd)
+static int scsi_check_sense(struct scsi_cmnd *scmd)
 {
-	if (!SCSI_SENSE_VALID(scmd)) {
+	if (!SCSI_SENSE_VALID(scmd))
 		return FAILED;
-	}
 	if (scmd->sense_buffer[2] & 0xe0)
 		return SUCCESS;
 
@@ -352,9 +310,8 @@
  *    don't allow for the possibility of retries here, and we are a lot
  *    more restrictive about what we consider acceptable.
  **/
-static int scsi_eh_completed_normally(Scsi_Cmnd *scmd)
+static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
 {
-
 	/*
 	 * first check the host byte, to see if there is anything in there
 	 * that would indicate what we need to do.
@@ -379,15 +336,15 @@
 		 */
 		return scsi_check_sense(scmd);
 	}
-	if (host_byte(scmd->result) != DID_OK) {
+	if (host_byte(scmd->result) != DID_OK)
 		return FAILED;
-	}
+
 	/*
 	 * next, check the message byte.
 	 */
-	if (msg_byte(scmd->result) != COMMAND_COMPLETE) {
+	if (msg_byte(scmd->result) != COMMAND_COMPLETE)
 		return FAILED;
-	}
+
 	/*
 	 * now, check the status byte to see if this indicates
 	 * anything special.
@@ -423,46 +380,38 @@
  *    for some action to complete on the device.  our only job is to
  *    record that it timed out, and to wake up the thread.
  **/
-static void scsi_eh_times_out(Scsi_Cmnd *scmd)
+static void scsi_eh_times_out(struct scsi_cmnd *scmd)
 {
 	scsi_eh_eflags_set(scmd, SCSI_EH_REC_TIMEOUT);
 	SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd:%p\n", __FUNCTION__,
 					  scmd));
 
-	if (scmd->device->host->eh_action != NULL)
+	if (scmd->device->host->eh_action)
 		up(scmd->device->host->eh_action);
-	else
-		printk("%s: eh_action NULL\n", __FUNCTION__);
 }
 
 /**
  * scsi_eh_done - Completion function for error handling.
  * @scmd:	Cmd that is done.
  **/
-static void scsi_eh_done(Scsi_Cmnd *scmd)
+static void scsi_eh_done(struct scsi_cmnd *scmd)
 {
-	int     rtn;
-
 	/*
 	 * if the timeout handler is already running, then just set the
 	 * flag which says we finished late, and return.  we have no
 	 * way of stopping the timeout handler from running, so we must
 	 * always defer to it.
 	 */
-	rtn = del_timer(&scmd->eh_timeout);
-	if (!rtn) {
-		return;
-	}
-
-	scmd->request->rq_status = RQ_SCSI_DONE;
-
-	scmd->owner = SCSI_OWNER_ERROR_HANDLER;
+	if (del_timer(&scmd->eh_timeout)) {
+		scmd->request->rq_status = RQ_SCSI_DONE;
+		scmd->owner = SCSI_OWNER_ERROR_HANDLER;
 
-	SCSI_LOG_ERROR_RECOVERY(3, printk("%s scmd: %p result: %x\n",
-					  __FUNCTION__, scmd, scmd->result));
+		SCSI_LOG_ERROR_RECOVERY(3, printk("%s scmd: %p result: %x\n",
+					   __FUNCTION__, scmd, scmd->result));
 
-	if (scmd->device->host->eh_action != NULL)
-		up(scmd->device->host->eh_action);
+		if (scmd->device->host->eh_action)
+			up(scmd->device->host->eh_action);
+	}
 }
 
 /**
@@ -477,10 +426,10 @@
  * Return value:
  *    SUCCESS or FAILED or NEEDS_RETRY
  **/
-static int scsi_send_eh_cmnd(Scsi_Cmnd *scmd, int timeout)
+static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout)
 {
-	unsigned long flags;
 	struct Scsi_Host *host = scmd->device->host;
+	unsigned long flags;
 	int rtn = SUCCESS;
 
 	ASSERT_LOCK(host->host_lock, 0);
@@ -535,7 +484,8 @@
 			spin_lock_irqsave(scmd->device->host->host_lock, flags);
 			if (scmd->device->host->hostt->eh_abort_handler)
 				scmd->device->host->hostt->eh_abort_handler(scmd);
-			spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
+			spin_unlock_irqrestore(scmd->device->host->host_lock,
+					       flags);
 			
 			scmd->request->rq_status = RQ_SCSI_DONE;
 			scmd->owner = SCSI_OWNER_ERROR_HANDLER;
@@ -592,32 +542,33 @@
  *    that we obtain it on our own. This function will *not* return until
  *    the command either times out, or it completes.
  **/
-static int scsi_request_sense(Scsi_Cmnd *scmd)
+static int scsi_request_sense(struct scsi_cmnd *scmd)
 {
 	static unsigned char generic_sense[6] =
 	{REQUEST_SENSE, 0, 0, 0, 255, 0};
-	unsigned char scsi_result0[256], *scsi_result = NULL;
+	unsigned char scsi_result0[256], *scsi_result = &scsi_result0[0];
 	int saved_result;
 	int rtn;
 
-	memcpy((void *) scmd->cmnd, (void *) generic_sense,
-	       sizeof(generic_sense));
+	memcpy(scmd->cmnd, generic_sense, sizeof(generic_sense));
 
-	scsi_result = (!scmd->device->host->hostt->unchecked_isa_dma)
-	    ? &scsi_result0[0] : kmalloc(512, GFP_ATOMIC | GFP_DMA);
-
-	if (scsi_result == NULL) {
-		printk("%s: cannot allocate scsi_result.\n", __FUNCTION__);
-		return FAILED;
+	if (scmd->device->host->hostt->unchecked_isa_dma) {
+		scsi_result = kmalloc(512, GFP_ATOMIC | __GFP_DMA);
+		if (unlikely(!scsi_result)) {
+			printk(KERN_ERR "%s: cannot allocate scsi_result.\n",
+					__FUNCTION__);
+			return FAILED;
+		}
 	}
+
 	/*
 	 * zero the sense buffer.  some host adapters automatically always
 	 * request sense, so it is not a good idea that
 	 * scmd->request_buffer and scmd->sense_buffer point to the same
 	 * address (db).  0 is not a valid sense code. 
 	 */
-	memset((void *) scmd->sense_buffer, 0, sizeof(scmd->sense_buffer));
-	memset((void *) scsi_result, 0, 256);
+	memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer));
+	memset(scsi_result, 0, 256);
 
 	saved_result = scmd->result;
 	scmd->request_buffer = scsi_result;
@@ -630,12 +581,12 @@
 	rtn = scsi_send_eh_cmnd(scmd, SENSE_TIMEOUT);
 
 	/* last chance to have valid sense data */
-	if (!SCSI_SENSE_VALID(scmd))
-		memcpy((void *) scmd->sense_buffer,
-		       scmd->request_buffer,
-		       sizeof(scmd->sense_buffer));
+	if (!SCSI_SENSE_VALID(scmd)) {
+		memcpy(scmd->sense_buffer, scmd->request_buffer,
+				sizeof(scmd->sense_buffer));
+	}
 
-	if (scsi_result != &scsi_result0[0] && scsi_result != NULL)
+	if (scsi_result != &scsi_result0[0])
 		kfree(scsi_result);
 
 	/*
@@ -644,10 +595,6 @@
 	 */
 	scsi_setup_cmd_retry(scmd);
 	scmd->result = saved_result;
-
-	/*
-	 * hey, we are done.  let's look to see what happened.
-	 */
 	return rtn;
 }
 
@@ -659,7 +606,7 @@
  *    This function will *not* return until the command either times out,
  *    or it completes.
  **/
-static int scsi_eh_retry_cmd(Scsi_Cmnd *scmd)
+static int scsi_eh_retry_cmd(struct scsi_cmnd *scmd)
 {
 	int rtn = SUCCESS;
 
@@ -676,7 +623,7 @@
 /**
  * scsi_eh_finish_cmd - Handle a cmd that eh is finished with.
  * @scmd:	Original SCSI cmd that eh has finished.
- * @shost:	SCSI host that cmd originally failed on.
+ * @done_q:	Queue for processed commands.
  *
  * Notes:
  *    We don't want to use the normal command completion while we are are
@@ -685,10 +632,12 @@
  *    keep a list of pending commands for final completion, and once we
  *    are ready to leave error handling we handle completion for real.
  **/
-static void scsi_eh_finish_cmd(Scsi_Cmnd *scmd, struct Scsi_Host *shost)
+static void scsi_eh_finish_cmd(struct scsi_cmnd *scmd,
+			       struct list_head *done_q)
 {
-	shost->host_failed--;
+	scmd->device->host->host_failed--;
 	scmd->state = SCSI_STATE_BHQUEUE;
+
 	scsi_eh_eflags_clr_all(scmd);
 
 	/*
@@ -696,18 +645,18 @@
 	 * things.
 	 */
 	scsi_setup_cmd_retry(scmd);
+	list_move_tail(&scmd->eh_entry, done_q);
 }
 
 /**
  * scsi_eh_get_sense - Get device sense data.
- * @sc_todo:	list of cmds that have failed.
- * @shost:	scsi host being recovered.
+ * @work_q:	Queue of commands to process.
+ * @done_q:	Queue of proccessed commands..
  *
  * Description:
  *    See if we need to request sense information.  if so, then get it
  *    now, so we have a better idea of what to do.  
  *
- *
  * Notes:
  *    This has the unfortunate side effect that if a shost adapter does
  *    not automatically request sense information, that we end up shutting
@@ -718,24 +667,26 @@
  *    this.
  *
  *    In 2.5 this capability will be going away.
+ *
+ *    Really?  --hch
  **/
-static int scsi_eh_get_sense(Scsi_Cmnd *sc_todo, struct Scsi_Host *shost)
+static int scsi_eh_get_sense(struct list_head *work_q,
+			     struct list_head *done_q)
 {
+	struct list_head *lh, *lh_sf;
+	struct scsi_cmnd *scmd;
 	int rtn;
-	Scsi_Cmnd *scmd;
-
-	SCSI_LOG_ERROR_RECOVERY(3, printk("%s: checking to see if we need"
-					  " to request sense\n",
-					  __FUNCTION__));
 
-	for (scmd = sc_todo; scmd; scmd = scmd->bh_next) {
-		if (!scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_FAILED) ||
+	list_for_each_safe(lh, lh_sf, work_q) {
+		scmd = list_entry(lh, struct scsi_cmnd, eh_entry);
+		if (scsi_eh_eflags_chk(scmd, SCSI_EH_CANCEL_CMD) ||
 		    SCSI_SENSE_VALID(scmd))
 			continue;
 
 		SCSI_LOG_ERROR_RECOVERY(2, printk("%s: requesting sense"
-						  " for tgt: %d\n",
-						  __FUNCTION__, scmd->device->id));
+						  " for id: %d\n",
+						  current->comm,
+						  scmd->device->id));
 		rtn = scsi_request_sense(scmd);
 		if (rtn != SUCCESS)
 			continue;
@@ -752,7 +703,7 @@
 		 * upper level.
 		 */
 		if (rtn == SUCCESS)
-			scsi_eh_finish_cmd(scmd, shost);
+			scsi_eh_finish_cmd(scmd, done_q);
 		if (rtn != NEEDS_RETRY)
 			continue;
 
@@ -771,10 +722,10 @@
 		/*
 		 * we eventually hand this one back to the top level.
 		 */
-		scsi_eh_finish_cmd(scmd, shost);
+		scsi_eh_finish_cmd(scmd, done_q);
 	}
 
-	return shost->host_failed;
+	return list_empty(work_q);
 }
 
 /**
@@ -788,14 +739,14 @@
  *    they can provide this facility themselves.  helper functions in
  *    scsi_error.c can be supplied to make this easier to do.
  **/
-static int scsi_try_to_abort_cmd(Scsi_Cmnd *scmd)
+static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd)
 {
-	int rtn = FAILED;
 	unsigned long flags;
+	int rtn = FAILED;
 
-	if (scmd->device->host->hostt->eh_abort_handler == NULL) {
+	if (!scmd->device->host->hostt->eh_abort_handler)
 		return rtn;
-	}
+
 	/*
 	 * scsi_done was called just after the command timed out and before
 	 * we had a chance to process it. (db)
@@ -808,6 +759,7 @@
 	spin_lock_irqsave(scmd->device->host->host_lock, flags);
 	rtn = scmd->device->host->hostt->eh_abort_handler(scmd);
 	spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
+
 	return rtn;
 }
 
@@ -818,22 +770,19 @@
  * Return value:
  *    0 - Device is ready. 1 - Device NOT ready.
  **/
-static int scsi_eh_tur(Scsi_Cmnd *scmd)
+static int scsi_eh_tur(struct scsi_cmnd *scmd)
 {
-	static unsigned char tur_command[6] =
-	{TEST_UNIT_READY, 0, 0, 0, 0, 0};
-	int rtn;
-	int retry_cnt = 1;
+	static unsigned char tur_command[6] = {TEST_UNIT_READY, 0, 0, 0, 0, 0};
+	int retry_cnt = 1, rtn;
 
 retry_tur:
-	memcpy((void *) scmd->cmnd, (void *) tur_command,
-	       sizeof(tur_command));
+	memcpy(scmd->cmnd, tur_command, sizeof(tur_command));
 
 	/*
 	 * zero the sense buffer.  the scsi spec mandates that any
 	 * untransferred sense data should be interpreted as being zero.
 	 */
-	memset((void *) scmd->sense_buffer, 0, sizeof(scmd->sense_buffer));
+	memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer));
 
 	scmd->request_buffer = NULL;
 	scmd->request_bufflen = 0;
@@ -864,9 +813,9 @@
 }
 
 /**
- * scsi_eh_abort_cmd - abort a timed-out cmd.
- * @sc_todo:	A list of cmds that have failed.
+ * scsi_eh_abort_cmds - abort canceled commands.
  * @shost:	scsi host being recovered.
+ * @eh_done_q:	list_head for processed commands.
  *
  * Decription:
  *    Try and see whether or not it makes sense to try and abort the
@@ -875,29 +824,36 @@
  *    no sense to try and abort the command, since as far as the shost
  *    adapter is concerned, it isn't running.
  **/
-static int scsi_eh_abort_cmd(Scsi_Cmnd *sc_todo, struct Scsi_Host *shost)
+static int scsi_eh_abort_cmds(struct list_head *work_q,
+			      struct list_head *done_q)
 {
-
+	struct list_head *lh, *lh_sf;
+	struct scsi_cmnd *scmd;
 	int rtn;
-	Scsi_Cmnd *scmd;
 
-	SCSI_LOG_ERROR_RECOVERY(3, printk("%s: checking to see if we need"
-					  " to abort cmd\n", __FUNCTION__));
-
-	for (scmd = sc_todo; scmd; scmd = scmd->bh_next) {
-		if (!scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_TIMEOUT))
+	list_for_each_safe(lh, lh_sf, work_q) {
+		scmd = list_entry(lh, struct scsi_cmnd, eh_entry);
+		if (!scsi_eh_eflags_chk(scmd, SCSI_EH_CANCEL_CMD))
 			continue;
-
+		SCSI_LOG_ERROR_RECOVERY(3, printk("%s: aborting cmd:"
+						  "0x%p\n", current->comm,
+						  scmd));
 		rtn = scsi_try_to_abort_cmd(scmd);
 		if (rtn == SUCCESS) {
-			if (!scsi_eh_tur(scmd)) {
-				rtn = scsi_eh_retry_cmd(scmd);
-				if (rtn == SUCCESS)
-					scsi_eh_finish_cmd(scmd, shost);
+			scsi_eh_eflags_clr(scmd,  SCSI_EH_CANCEL_CMD);
+			if (!scmd->device->online || !scsi_eh_tur(scmd)) {
+				scsi_eh_finish_cmd(scmd, done_q);
 			}
-		}
+				
+		} else
+			SCSI_LOG_ERROR_RECOVERY(3, printk("%s: aborting"
+							  " cmd failed:"
+							  "0x%p\n",
+							  current->comm,
+							  scmd));
 	}
-	return shost->host_failed;
+
+	return list_empty(work_q);
 }
 
 /**
@@ -910,14 +866,14 @@
  *    timer on it, and set the host back to a consistent state prior to
  *    returning.
  **/
-static int scsi_try_bus_device_reset(Scsi_Cmnd *scmd)
+static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
 {
 	unsigned long flags;
 	int rtn = FAILED;
 
-	if (scmd->device->host->hostt->eh_device_reset_handler == NULL) {
+	if (!scmd->device->host->hostt->eh_device_reset_handler)
 		return rtn;
-	}
+
 	scmd->owner = SCSI_OWNER_LOWLEVEL;
 
 	spin_lock_irqsave(scmd->device->host->host_lock, flags);
@@ -933,9 +889,9 @@
 }
 
 /**
- * scsi_eh_bus_device_reset - send bdr is needed
- * @sc_todo:	a list of cmds that have failed.
+ * scsi_eh_bus_device_reset - send bdr if needed
  * @shost:	scsi host being recovered.
+ * @eh_done_q:	list_head for processed commands.
  *
  * Notes:
  *    Try a bus device reset.  still, look to see whether we have multiple
@@ -943,57 +899,70 @@
  *    makes no sense to try bus_device_reset - we really would need to try
  *    a bus_reset instead. 
  **/
-static int scsi_eh_bus_device_reset(Scsi_Cmnd *sc_todo, struct Scsi_Host *shost)
-{
+static int scsi_eh_bus_device_reset(struct Scsi_Host *shost,
+				    struct list_head *work_q,
+				    struct list_head *done_q)
+{
+	struct list_head *lh, *lh_sf;
+	struct scsi_cmnd *scmd, *bdr_scmd;
+	struct scsi_device *sdev;
 	int rtn;
-	Scsi_Cmnd *scmd;
-	Scsi_Device *sdev;
-
-	SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Trying BDR\n", __FUNCTION__));
 
 	list_for_each_entry(sdev, &shost->my_devices, siblings) {
-		for (scmd = sc_todo; scmd; scmd = scmd->bh_next)
-			if ((scmd->device == sdev) &&
-			    scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_ERR))
+		bdr_scmd = NULL;
+		list_for_each_entry(scmd, work_q, eh_entry)
+			if (scmd->device == sdev) {
+				bdr_scmd = scmd;
 				break;
+			}
 
-		if (!scmd)
+		if (!bdr_scmd)
 			continue;
 
-		/*
-		 * ok, we have a device that is having problems.  try and send
-		 * a bus device reset to it.
-		 */
-		rtn = scsi_try_bus_device_reset(scmd);
-		if ((rtn == SUCCESS) && (!scsi_eh_tur(scmd)))
-				for (scmd = sc_todo; scmd; scmd = scmd->bh_next)
-					if ((scmd->device == sdev) &&
-					    scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_ERR)) {
-						rtn = scsi_eh_retry_cmd(scmd);
-						if (rtn == SUCCESS)
-							scsi_eh_finish_cmd(scmd, shost);
-					}
+		SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Sending BDR sdev:"
+						  " 0x%p\n", current->comm,
+						  sdev));
+		rtn = scsi_try_bus_device_reset(bdr_scmd);
+		if (rtn == SUCCESS) {
+			if (!sdev->online || !scsi_eh_tur(bdr_scmd)) {
+				list_for_each_safe(lh, lh_sf,
+						   work_q) {
+					scmd = list_entry(lh, struct
+							  scsi_cmnd,
+							  eh_entry);
+					if (scmd->device == sdev)
+						scsi_eh_finish_cmd(scmd,
+								   done_q);
+				}
+			}
+		} else {
+			SCSI_LOG_ERROR_RECOVERY(3, printk("%s: BDR"
+							  " failed sdev:"
+							  "0x%p\n",
+							  current->comm,
+							   sdev));
+		}
 	}
 
-	return shost->host_failed;
+	return list_empty(work_q);
 }
 
 /**
  * scsi_try_bus_reset - ask host to perform a bus reset
  * @scmd:	SCSI cmd to send bus reset.
  **/
-static int scsi_try_bus_reset(Scsi_Cmnd *scmd)
+static int scsi_try_bus_reset(struct scsi_cmnd *scmd)
 {
+	struct scsi_device *sdev;
 	unsigned long flags;
 	int rtn;
-	Scsi_Device *sdev;
 
 	SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Bus RST\n",
 					  __FUNCTION__));
 	scmd->owner = SCSI_OWNER_LOWLEVEL;
 	scmd->serial_number_at_timeout = scmd->serial_number;
 
-	if (scmd->device->host->hostt->eh_bus_reset_handler == NULL)
+	if (!scmd->device->host->hostt->eh_bus_reset_handler)
 		return FAILED;
 
 	spin_lock_irqsave(scmd->device->host->host_lock, flags);
@@ -1005,7 +974,8 @@
 		/*
 		 * Mark all affected devices to expect a unit attention.
 		 */
-		list_for_each_entry(sdev, &scmd->device->host->my_devices, siblings)
+		list_for_each_entry(sdev, &scmd->device->host->my_devices,
+				    siblings)
 			if (scmd->device->channel == sdev->channel) {
 				sdev->was_reset = 1;
 				sdev->expecting_cc_ua = 1;
@@ -1018,18 +988,18 @@
  * scsi_try_host_reset - ask host adapter to reset itself
  * @scmd:	SCSI cmd to send hsot reset.
  **/
-static int scsi_try_host_reset(Scsi_Cmnd *scmd)
+static int scsi_try_host_reset(struct scsi_cmnd *scmd)
 {
+	struct scsi_device *sdev;
 	unsigned long flags;
 	int rtn;
-	 Scsi_Device *sdev;
 
 	SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Host RST\n",
 					  __FUNCTION__));
 	scmd->owner = SCSI_OWNER_LOWLEVEL;
 	scmd->serial_number_at_timeout = scmd->serial_number;
 
-	if (scmd->device->host->hostt->eh_host_reset_handler == NULL)
+	if (!scmd->device->host->hostt->eh_host_reset_handler)
 		return FAILED;
 
 	spin_lock_irqsave(scmd->device->host->host_lock, flags);
@@ -1041,7 +1011,8 @@
 		/*
 		 * Mark all affected devices to expect a unit attention.
 		 */
-		list_for_each_entry(sdev, &scmd->device->host->my_devices, siblings)
+		list_for_each_entry(sdev, &scmd->device->host->my_devices,
+				    siblings)
 			if (scmd->device->channel == sdev->channel) {
 				sdev->was_reset = 1;
 				sdev->expecting_cc_ua = 1;
@@ -1051,26 +1022,21 @@
 }
 
 /**
- * scsi_eh_bus_host_reset - send a bus reset and on failure try host reset
- * @sc_todo:	a list of cmds that have failed.
+ * scsi_eh_bus_reset - send a bus reset 
  * @shost:	scsi host being recovered.
+ * @eh_done_q:	list_head for processed commands.
  **/
-static int scsi_eh_bus_host_reset(Scsi_Cmnd *sc_todo, struct Scsi_Host *shost)
-{
-	int rtn;
-	Scsi_Cmnd *scmd;
-	Scsi_Cmnd *chan_scmd;
+static int scsi_eh_bus_reset(struct Scsi_Host *shost,
+			     struct list_head *work_q,
+			     struct list_head *done_q)
+{
+	struct list_head *lh, *lh_sf;
+	struct scsi_cmnd *scmd;
+	struct scsi_cmnd *chan_scmd;
 	unsigned int channel;
+	int rtn;
 
 	/*
-	 * if we ended up here, we have serious problems.  the only thing left
-	 * to try is a full bus reset.  if someone has grabbed the bus and isn't
-	 * letting go, then perhaps this will help.
-	 */
-	SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Try Bus/Host RST\n",
-					  __FUNCTION__));
-
-	/* 
 	 * we really want to loop over the various channels, and do this on
 	 * a channel by channel basis.  we should also check to see if any
 	 * of the failed commands are on soft_reset devices, and if so, skip
@@ -1078,9 +1044,8 @@
 	 */
 
 	for (channel = 0; channel <= shost->max_channel; channel++) {
-		for (scmd = sc_todo; scmd; scmd = scmd->bh_next) {
-			if (!scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_ERR))
-				continue;
+		chan_scmd = NULL;
+		list_for_each_entry(scmd, work_q, eh_entry) {
 			if (channel == scmd->device->channel) {
 				chan_scmd = scmd;
 				break;
@@ -1091,63 +1056,95 @@
 			}
 		}
 
-		if (!scmd)
+		if (!chan_scmd)
 			continue;
+		SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Sending BRST chan:"
+						  " %d\n", current->comm,
+						  channel));
+		rtn = scsi_try_bus_reset(chan_scmd);
+		if (rtn == SUCCESS) {
+			list_for_each_safe(lh, lh_sf, work_q) {
+				scmd = list_entry(lh, struct scsi_cmnd,
+						  eh_entry);
+				if (channel == scmd->device->channel)
+					if (!scmd->device->online ||
+					    !scsi_eh_tur(scmd))
+						scsi_eh_finish_cmd(scmd,
+								   done_q);
+			}
+		} else {
+			SCSI_LOG_ERROR_RECOVERY(3, printk("%s: BRST"
+							  " failed chan: %d\n",
+							  current->comm,
+							  channel));
+		}
+	}
+	return list_empty(work_q);
+}
 
-		/*
-		 * we now know that we are able to perform a reset for the
-		 * channel that scmd points to.
-		 */
-		rtn = scsi_try_bus_reset(scmd);
-		if (rtn != SUCCESS)
-			rtn = scsi_try_host_reset(scmd);
+/**
+ * scsi_eh_host_reset - send a host reset 
+ * @work_q:	list_head for processed commands.
+ * @done_q:	list_head for processed commands.
+ **/
+static int scsi_eh_host_reset(struct list_head *work_q,
+			      struct list_head *done_q)
+{
+	int rtn;
+	struct list_head *lh, *lh_sf;
+	struct scsi_cmnd *scmd;
 
-		if (rtn == SUCCESS) {
-			for (scmd = sc_todo; scmd; scmd = scmd->bh_next) {
-				if (!scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_ERR)
-				    || channel != scmd->device->channel)
-					continue;
-				if (!scsi_eh_tur(scmd)) {
-					rtn = scsi_eh_retry_cmd(scmd);
+	if (!list_empty(work_q)) {
+		scmd = list_entry(work_q->next,
+				  struct scsi_cmnd, eh_entry);
 
-					if (rtn == SUCCESS)
-						scsi_eh_finish_cmd(scmd, shost);
-				}
+		SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Sending HRST\n"
+						  , current->comm));
+
+		rtn = scsi_try_host_reset(scmd);
+		if (rtn == SUCCESS) {
+			list_for_each_safe(lh, lh_sf, work_q) {
+				scmd = list_entry(lh, struct scsi_cmnd, eh_entry);
+				if (!scmd->device->online || !scsi_eh_tur(scmd)) 
+					scsi_eh_finish_cmd(scmd, done_q);
 			}
+		} else {
+			SCSI_LOG_ERROR_RECOVERY(3, printk("%s: HRST"
+							  " failed\n",
+							  current->comm));
 		}
-
 	}
-	return shost->host_failed;
+	return list_empty(work_q);
 }
 
 /**
  * scsi_eh_offline_sdevs - offline scsi devices that fail to recover
- * @sc_todo:	a list of cmds that have failed.
- * @shost:	scsi host being recovered.
+ * @work_q:	list_head for processed commands.
+ * @done_q:	list_head for processed commands.
  *
  **/
-static void scsi_eh_offline_sdevs(Scsi_Cmnd *sc_todo, struct Scsi_Host *shost)
+static void scsi_eh_offline_sdevs(struct list_head *work_q,
+				  struct list_head *done_q)
 {
-	Scsi_Cmnd *scmd;
-
-	for (scmd = sc_todo; scmd; scmd = scmd->bh_next) {
-		if (!scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_ERR))
-			continue;
+	struct list_head *lh, *lh_sf;
+	struct scsi_cmnd *scmd;
 
+	list_for_each_safe(lh, lh_sf, work_q) {
+		scmd = list_entry(lh, struct scsi_cmnd, eh_entry);
 		printk(KERN_INFO "scsi: Device offlined - not"
-				" ready or command retry failed"
-				" after error recovery: host"
+		       		" ready after error recovery: host"
 				" %d channel %d id %d lun %d\n",
-				shost->host_no,
+				scmd->device->host->host_no,
 				scmd->device->channel,
 				scmd->device->id,
 				scmd->device->lun);
-
-		if (scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_TIMEOUT))
-			scmd->result |= (DRIVER_TIMEOUT << 24);
-
-		scmd->device->online = 0;
-		scsi_eh_finish_cmd(scmd, shost);
+		scmd->device->online = FALSE;
+		if (scsi_eh_eflags_chk(scmd, SCSI_EH_CANCEL_CMD)) {
+			/*
+			 * FIXME: Handle lost cmds.
+			 */
+		}
+		scsi_eh_finish_cmd(scmd, done_q);
 	}
 	return;
 }
@@ -1157,12 +1154,12 @@
  * @sem:	semphore to signal
  *
  **/
-static
-void scsi_sleep_done(struct semaphore *sem)
+static void scsi_sleep_done(unsigned long data)
 {
-	if (sem != NULL) {
+	struct semaphore *sem = (struct semaphore *)data;
+
+	if (sem)
 		up(sem);
-	}
 }
 
 /**
@@ -1176,9 +1173,9 @@
 	struct timer_list timer;
 
 	init_timer(&timer);
-	timer.data = (unsigned long) &sem;
+	timer.data = (unsigned long)&sem;
 	timer.expires = jiffies + timeout;
-	timer.function = (void (*)(unsigned long)) scsi_sleep_done;
+	timer.function = (void (*)(unsigned long))scsi_sleep_done;
 
 	SCSI_LOG_ERROR_RECOVERY(5, printk("sleeping for timer tics %d\n",
 					  timeout));
@@ -1203,7 +1200,7 @@
  *    doesn't require the error handler read (i.e. we don't need to
  *    abort/reset), then this function should return SUCCESS.
  **/
-int scsi_decide_disposition(Scsi_Cmnd *scmd)
+int scsi_decide_disposition(struct scsi_cmnd *scmd)
 {
 	int rtn;
 
@@ -1403,7 +1400,7 @@
 {
 	struct scsi_request *sreq = scsi_allocate_request(sdev);
 
-	if (sreq == NULL) {
+	if (unlikely(!sreq)) {
 		printk(KERN_ERR "%s: request allocate failed,"
 		       "prevent media removal cmd not sent", __FUNCTION__);
 		return;
@@ -1437,7 +1434,7 @@
  **/
 static void scsi_restart_operations(struct Scsi_Host *shost)
 {
-	Scsi_Device *sdev;
+	struct scsi_device *sdev;
 	unsigned long flags;
 
 	ASSERT_LOCK(shost->host_lock, 0);
@@ -1459,6 +1456,8 @@
 	SCSI_LOG_ERROR_RECOVERY(3, printk("%s: waking up host to restart\n",
 					  __FUNCTION__));
 
+	shost->in_recovery = 0;
+
 	wake_up(&shost->host_wait);
 
 	/*
@@ -1482,6 +1481,55 @@
 }
 
 /**
+ * scsi_eh_ready_devs - check device ready state and recover if not.
+ * @shost: 	host to be recovered.
+ * @eh_done_q:	list_head for processed commands.
+ *
+ **/
+static void scsi_eh_ready_devs(struct Scsi_Host *shost,
+			       struct list_head *work_q,
+			       struct list_head *done_q)
+{
+	if (scsi_eh_bus_device_reset(shost, work_q, done_q))
+		if (scsi_eh_bus_reset(shost, work_q, done_q))
+			if (scsi_eh_host_reset(work_q, done_q))
+				scsi_eh_offline_sdevs(work_q, done_q);
+}
+
+/**
+ * scsi_eh_flush_done_q - finish processed commands or retry them.
+ * @done_q:	list_head of processed commands.
+ *
+ **/
+static void scsi_eh_flush_done_q(struct list_head *done_q)
+{
+	struct list_head *lh, *lh_sf;
+	struct scsi_cmnd *scmd;
+
+	list_for_each_safe(lh, lh_sf, done_q) {
+		scmd = list_entry(lh, struct scsi_cmnd, eh_entry);
+		list_del_init(lh);
+		if (!scmd->device->online) {
+			 scmd->result |= (DRIVER_TIMEOUT << 24);
+		} else {
+			if (++scmd->retries < scmd->allowed) {
+				SCSI_LOG_ERROR_RECOVERY(3,
+					printk("%s: flush retry"
+					       " cmd: %p\n",
+						  current->comm,
+						  scmd));
+				scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY);
+				continue;
+			}
+		}
+		SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush finish"
+				       " cmd: %p\n",
+					  current->comm, scmd));
+		scsi_finish_command(scmd);
+	}
+}
+
+/**
  * scsi_unjam_host - Attempt to fix a host which has a cmd that failed.
  * @shost:	Host to unjam.
  *
@@ -1506,60 +1554,21 @@
  **/
 static void scsi_unjam_host(struct Scsi_Host *shost)
 {
-	Scsi_Cmnd *sc_todo = NULL;
-	Scsi_Cmnd *scmd;
-
-	/*
-	 * Is this assert really ok anymore (andmike). Should we at least
-	 * be using spin_lock_unlocked.
-	 */
-	ASSERT_LOCK(shost->host_lock, 0);
-
-	scsi_eh_get_failed(&sc_todo, shost);
-
-	if (scsi_eh_get_sense(sc_todo, shost))
-		if (scsi_eh_abort_cmd(sc_todo, shost))
-			if (scsi_eh_bus_device_reset(sc_todo, shost))
-				if (scsi_eh_bus_host_reset(sc_todo, shost))
-					scsi_eh_offline_sdevs(sc_todo, shost);
-
-	BUG_ON(shost->host_failed);
+	unsigned long flags;
+	LIST_HEAD(eh_work_q);
+	LIST_HEAD(eh_done_q);
 
+	spin_lock_irqsave(shost->host_lock, flags);
+	list_splice_init(&shost->eh_cmd_q, &eh_work_q);
+	spin_unlock_irqrestore(shost->host_lock, flags);
 
-	/*
-	 * We are currently holding these things in a linked list - we
-	 * didn't put them in the bottom half queue because we wanted to
-	 * keep things quiet while we were working on recovery, and
-	 * passing them up to the top level could easily cause the top
-	 * level to try and queue something else again.
-	 *
-	 * start by marking that the host is no longer in error recovery.
-	 */
-	shost->in_recovery = 0;
+	SCSI_LOG_ERROR_RECOVERY(1, scsi_eh_prt_fail_stats(shost, &eh_work_q));
 
-	/*
-	 * take the list of commands, and stick them in the bottom half queue.
-	 * the current implementation of scsi_done will do this for us - if need
-	 * be we can create a special version of this function to do the
-	 * same job for us.
-	 */
-	for (scmd = sc_todo; scmd; scmd = sc_todo) {
-		sc_todo = scmd->bh_next;
-		scmd->bh_next = NULL;
-		/*
-		 * Oh, this is a vile hack.  scsi_done() expects a timer
-		 * to be running on the command.  If there isn't, it assumes
-		 * that the command has actually timed out, and a timer
-		 * handler is running.  That may well be how we got into
-		 * this fix, but right now things are stable.  We add
-		 * a timer back again so that we can report completion.
-		 * scsi_done() will immediately remove said timer from
-		 * the command, and then process it.
-		 */
-		scsi_add_timer(scmd, 100, scsi_eh_times_out);
-		scsi_done(scmd);
-	}
+	if (!scsi_eh_get_sense(&eh_work_q, &eh_done_q))
+		if (!scsi_eh_abort_cmds(&eh_work_q, &eh_done_q))
+			scsi_eh_ready_devs(shost, &eh_work_q, &eh_done_q);
 
+	scsi_eh_flush_done_q(&eh_done_q);
 }
 
 /**
@@ -1597,7 +1606,8 @@
 	/*
 	 * Wake up the thread that created us.
 	 */
-	SCSI_LOG_ERROR_RECOVERY(3, printk("Wake up parent of scsi_eh_%d\n",shost->host_no));
+	SCSI_LOG_ERROR_RECOVERY(3, printk("Wake up parent of"
+					  " scsi_eh_%d\n",shost->host_no));
 
 	complete(shost->eh_notify);
 
@@ -1607,7 +1617,9 @@
 		 * away and die.  This typically happens if the user is
 		 * trying to unload a module.
 		 */
-		SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler scsi_eh_%d sleeping\n",shost->host_no));
+		SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler"
+						  " scsi_eh_%d"
+						  " sleeping\n",shost->host_no));
 
 		/*
 		 * Note - we always use down_interruptible with the semaphore
@@ -1622,7 +1634,9 @@
 		if (shost->eh_kill)
 			break;
 
-		SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler scsi_eh_%d waking up\n",shost->host_no));
+		SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler"
+						  " scsi_eh_%d waking"
+						  " up\n",shost->host_no));
 
 		shost->eh_active = 1;
 
@@ -1631,11 +1645,10 @@
 		 * what we need to do to get it up and online again (if we can).
 		 * If we fail, we end up taking the thing offline.
 		 */
-		if (shost->hostt->eh_strategy_handler != NULL) {
+		if (shost->hostt->eh_strategy_handler) 
 			rtn = shost->hostt->eh_strategy_handler(shost);
-		} else {
+		else
 			scsi_unjam_host(shost);
-		}
 
 		shost->eh_active = 0;
 
@@ -1650,7 +1663,8 @@
 
 	}
 
-	SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler scsi_eh_%d exiting\n",shost->host_no));
+	SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler scsi_eh_%d"
+					  " exiting\n",shost->host_no));
 
 	/*
 	 * Make sure that nobody tries to wake us up again.
@@ -1675,45 +1689,8 @@
 	complete_and_exit(shost->eh_notify, 0);
 }
 
-/**
- * scsi_new_reset - Send reset to a bus or device at any phase.
- * @scmd:	Cmd to send reset with (usually a dummy)
- * @flag:	Reset type.
- *
- * Description:
- *    This is used by the SCSI Generic driver to provide Bus/Device reset
- *    capability.
- *
- * Return value:
- *    SUCCESS/FAILED.
- **/
-static int scsi_new_reset(Scsi_Cmnd *scmd, int flag)
-{
-	int rtn;
-
-	switch(flag) {
-	case SCSI_TRY_RESET_DEVICE:
-		rtn = scsi_try_bus_device_reset(scmd);
-		if (rtn == SUCCESS)
-			break;
-		/* FALLTHROUGH */
-	case SCSI_TRY_RESET_BUS:
-		rtn = scsi_try_bus_reset(scmd);
-		if (rtn == SUCCESS)
-			break;
-		/* FALLTHROUGH */
-	case SCSI_TRY_RESET_HOST:
-		rtn = scsi_try_host_reset(scmd);
-		break;
-	default:
-		rtn = FAILED;
-	}
-
-	return rtn;
-}
-
 static void
-scsi_reset_provider_done_command(Scsi_Cmnd *SCpnt)
+scsi_reset_provider_done_command(struct scsi_cmnd *scmd)
 {
 }
 
@@ -1731,47 +1708,65 @@
  *		Bus/Device reset capability.
  */
 int
-scsi_reset_provider(Scsi_Device *dev, int flag)
+scsi_reset_provider(struct scsi_device *dev, int flag)
 {
-	struct scsi_cmnd *SCpnt = scsi_get_command(dev, GFP_KERNEL);
+	struct scsi_cmnd *scmd = scsi_get_command(dev, GFP_KERNEL);
 	struct request req;
 	int rtn;
 
-	SCpnt->request = &req;
-	memset(&SCpnt->eh_timeout, 0, sizeof(SCpnt->eh_timeout));
-	SCpnt->request->rq_status      	= RQ_SCSI_BUSY;
-	SCpnt->state                   	= SCSI_STATE_INITIALIZING;
-	SCpnt->owner	     		= SCSI_OWNER_MIDLEVEL;
+	scmd->request = &req;
+	memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout));
+	scmd->request->rq_status      	= RQ_SCSI_BUSY;
+	scmd->state                   	= SCSI_STATE_INITIALIZING;
+	scmd->owner	     		= SCSI_OWNER_MIDLEVEL;
     
-	memset(&SCpnt->cmnd, '\0', sizeof(SCpnt->cmnd));
+	memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd));
     
-	SCpnt->scsi_done		= scsi_reset_provider_done_command;
-	SCpnt->done			= NULL;
-	SCpnt->reset_chain		= NULL;
+	scmd->scsi_done		= scsi_reset_provider_done_command;
+	scmd->done			= NULL;
+	scmd->reset_chain		= NULL;
         
-	SCpnt->buffer			= NULL;
-	SCpnt->bufflen			= 0;
-	SCpnt->request_buffer		= NULL;
-	SCpnt->request_bufflen		= 0;
-
-	SCpnt->internal_timeout		= NORMAL_TIMEOUT;
-	SCpnt->abort_reason		= DID_ABORT;
-
-	SCpnt->cmd_len			= 0;
-
-	SCpnt->sc_data_direction	= SCSI_DATA_UNKNOWN;
-	SCpnt->sc_request		= NULL;
-	SCpnt->sc_magic			= SCSI_CMND_MAGIC;
+	scmd->buffer			= NULL;
+	scmd->bufflen			= 0;
+	scmd->request_buffer		= NULL;
+	scmd->request_bufflen		= 0;
+
+	scmd->internal_timeout		= NORMAL_TIMEOUT;
+	scmd->abort_reason		= DID_ABORT;
+
+	scmd->cmd_len			= 0;
+
+	scmd->sc_data_direction	= SCSI_DATA_UNKNOWN;
+	scmd->sc_request		= NULL;
+	scmd->sc_magic			= SCSI_CMND_MAGIC;
+
+	init_timer(&scmd->eh_timeout);
 
 	/*
 	 * Sometimes the command can get back into the timer chain,
 	 * so use the pid as an identifier.
 	 */
-	SCpnt->pid			= 0;
+	scmd->pid			= 0;
 
-	rtn = scsi_new_reset(SCpnt, flag);
+	switch (flag) {
+	case SCSI_TRY_RESET_DEVICE:
+		rtn = scsi_try_bus_device_reset(scmd);
+		if (rtn == SUCCESS)
+			break;
+		/* FALLTHROUGH */
+	case SCSI_TRY_RESET_BUS:
+		rtn = scsi_try_bus_reset(scmd);
+		if (rtn == SUCCESS)
+			break;
+		/* FALLTHROUGH */
+	case SCSI_TRY_RESET_HOST:
+		rtn = scsi_try_host_reset(scmd);
+		break;
+	default:
+		rtn = FAILED;
+	}
 
-	scsi_delete_timer(SCpnt);
-	scsi_put_command(SCpnt);
+	scsi_delete_timer(scmd);
+	scsi_put_command(scmd);
 	return rtn;
 }
diff -Nru a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/scsi/scsi_lib.c	Sun Feb 23 22:25:24 2003
@@ -14,6 +14,7 @@
 #include <linux/mempool.h>
 #include <linux/slab.h>
 #include <linux/init.h>
+#include <linux/pci.h>
 
 #include "scsi.h"
 #include "hosts.h"
@@ -37,11 +38,11 @@
 
 
 /*
- * Function:    scsi_insert_special_cmd()
+ * Function:    scsi_insert_special_req()
  *
- * Purpose:     Insert pre-formed command into request queue.
+ * Purpose:     Insert pre-formed request into request queue.
  *
- * Arguments:   cmd	- command that is ready to be queued.
+ * Arguments:   sreq	- request that is ready to be queued.
  *              at_head	- boolean.  True if we should insert at head
  *                        of queue, false if we should insert at tail.
  *
@@ -56,46 +57,195 @@
  *              for now), and then call the queue request function to actually
  *              process it.
  */
-int scsi_insert_special_cmd(struct scsi_cmnd *cmd, int at_head)
+int scsi_insert_special_req(struct scsi_request *sreq, int at_head)
 {
-	blk_insert_request(cmd->device->request_queue, cmd->request,
-		       	   at_head, cmd);
+	/*
+	 * Because users of this function are apt to reuse requests with no
+	 * modification, we have to sanitise the request flags here
+	 */
+	sreq->sr_request->flags &= ~REQ_DONTPREP;
+	blk_insert_request(sreq->sr_device->request_queue, sreq->sr_request,
+		       	   at_head, sreq);
 	return 0;
 }
 
 /*
- * Function:    scsi_insert_special_req()
+ * Function:    scsi_queue_insert()
  *
- * Purpose:     Insert pre-formed request into request queue.
+ * Purpose:     Insert a command in the midlevel queue.
  *
- * Arguments:   sreq	- request that is ready to be queued.
- *              at_head	- boolean.  True if we should insert at head
- *                        of queue, false if we should insert at tail.
+ * Arguments:   cmd    - command that we are adding to queue.
+ *              reason - why we are inserting command to queue.
  *
  * Lock status: Assumed that lock is not held upon entry.
  *
- * Returns:     Nothing
+ * Returns:     Nothing.
  *
- * Notes:       This function is called from character device and from
- *              ioctl types of functions where the caller knows exactly
- *              what SCSI command needs to be issued.   The idea is that
- *              we merely inject the command into the queue (at the head
- *              for now), and then call the queue request function to actually
- *              process it.
+ * Notes:       We do this for one of two cases.  Either the host is busy
+ *              and it cannot accept any more commands for the time being,
+ *              or the device returned QUEUE_FULL and can accept no more
+ *              commands.
+ * Notes:       This could be called either from an interrupt context or a
+ *              normal process context.
  */
-int scsi_insert_special_req(struct scsi_request *sreq, int at_head)
+int scsi_queue_insert(struct scsi_cmnd *cmd, int reason)
 {
+	struct Scsi_Host *host = cmd->device->host;
+	struct scsi_device *device = cmd->device;
+
+	SCSI_LOG_MLQUEUE(1,
+		 printk("Inserting command %p into mlqueue\n", cmd));
+
 	/*
-	 * Because users of this function are apt to reuse requests with no
-	 * modification, we have to sanitise the request flags here
+	 * We are inserting the command into the ml queue.  First, we
+	 * cancel the timer, so it doesn't time out.
 	 */
-	sreq->sr_request->flags &= ~REQ_DONTPREP;
-	blk_insert_request(sreq->sr_device->request_queue, sreq->sr_request,
-		       	   at_head, sreq);
+	scsi_delete_timer(cmd);
+
+	/*
+	 * Next, set the appropriate busy bit for the device/host.
+	 *
+	 * If the host/device isn't busy, assume that something actually
+	 * completed, and that we should be able to queue a command now.
+	 *
+	 * Note that the prior mid-layer assumption that any host could
+	 * always queue at least one command is now broken.  The mid-layer
+	 * will implement a user specifiable stall (see
+	 * scsi_host.max_host_blocked and scsi_device.max_device_blocked)
+	 * if a command is requeued with no other commands outstanding
+	 * either for the device or for the host.
+	 */
+	if (reason == SCSI_MLQUEUE_HOST_BUSY)
+		host->host_blocked = host->max_host_blocked;
+	else if (reason == SCSI_MLQUEUE_DEVICE_BUSY)
+		device->device_blocked = device->max_device_blocked;
+
+	/*
+	 * Register the fact that we own the thing for now.
+	 */
+	cmd->state = SCSI_STATE_MLQUEUE;
+	cmd->owner = SCSI_OWNER_MIDLEVEL;
+	cmd->bh_next = NULL;
+
+	/*
+	 * Decrement the counters, since these commands are no longer
+	 * active on the host/device.
+	 */
+	scsi_host_busy_dec_and_test(host, device);
+
+	/*
+	 * Insert this command at the head of the queue for it's device.
+	 * It will go before all other commands that are already in the queue.
+	 *
+	 * NOTE: there is magic here about the way the queue is plugged if
+	 * we have no outstanding commands.
+	 * 
+	 * Although this *doesn't* plug the queue, it does call the request
+	 * function.  The SCSI request function detects the blocked condition
+	 * and plugs the queue appropriately.
+	 */
+	blk_insert_request(device->request_queue, cmd->request, 1, cmd);
 	return 0;
 }
 
 /*
+ * Function:    scsi_do_req
+ *
+ * Purpose:     Queue a SCSI request
+ *
+ * Arguments:   sreq	  - command descriptor.
+ *              cmnd      - actual SCSI command to be performed.
+ *              buffer    - data buffer.
+ *              bufflen   - size of data buffer.
+ *              done      - completion function to be run.
+ *              timeout   - how long to let it run before timeout.
+ *              retries   - number of retries we allow.
+ *
+ * Lock status: No locks held upon entry.
+ *
+ * Returns:     Nothing.
+ *
+ * Notes:	This function is only used for queueing requests for things
+ *		like ioctls and character device requests - this is because
+ *		we essentially just inject a request into the queue for the
+ *		device.
+ */
+void scsi_do_req(struct scsi_request *sreq, const void *cmnd,
+		 void *buffer, unsigned bufflen,
+		 void (*done)(struct scsi_cmnd *),
+		 int timeout, int retries)
+{
+	/*
+	 * If the upper level driver is reusing these things, then
+	 * we should release the low-level block now.  Another one will
+	 * be allocated later when this request is getting queued.
+	 */
+	if (sreq->sr_command) {
+		scsi_put_command(sreq->sr_command);
+		sreq->sr_command = NULL;
+	}
+
+	/*
+	 * Our own function scsi_done (which marks the host as not busy,
+	 * disables the timeout counter, etc) will be called by us or by the
+	 * scsi_hosts[host].queuecommand() function needs to also call
+	 * the completion function for the high level driver.
+	 */
+	memcpy(sreq->sr_cmnd, cmnd, sizeof(sreq->sr_cmnd));
+	sreq->sr_bufflen = bufflen;
+	sreq->sr_buffer = buffer;
+	sreq->sr_allowed = retries;
+	sreq->sr_done = done;
+	sreq->sr_timeout_per_command = timeout;
+
+	if (sreq->sr_cmd_len == 0)
+		sreq->sr_cmd_len = COMMAND_SIZE(sreq->sr_cmnd[0]);
+
+	/*
+	 * At this point, we merely set up the command, stick it in the normal
+	 * request queue, and return.  Eventually that request will come to the
+	 * top of the list, and will be dispatched.
+	 */
+	scsi_insert_special_req(sreq, 0);
+}
+ 
+static void scsi_wait_done(struct scsi_cmnd *cmd)
+{
+	struct request *req = cmd->request;
+	struct request_queue *q = cmd->device->request_queue;
+	unsigned long flags;
+
+	req->rq_status = RQ_SCSI_DONE;	/* Busy, but indicate request done */
+
+	spin_lock_irqsave(q->queue_lock, flags);
+	if (blk_rq_tagged(req))
+		blk_queue_end_tag(q, req);
+	spin_unlock_irqrestore(q->queue_lock, flags);
+
+	if (req->waiting)
+		complete(req->waiting);
+}
+
+void scsi_wait_req(struct scsi_request *sreq, const void *cmnd, void *buffer,
+		   unsigned bufflen, int timeout, int retries)
+{
+	DECLARE_COMPLETION(wait);
+	
+	sreq->sr_request->waiting = &wait;
+	sreq->sr_request->rq_status = RQ_SCSI_BUSY;
+	scsi_do_req(sreq, cmnd, buffer, bufflen, scsi_wait_done,
+			timeout, retries);
+	generic_unplug_device(sreq->sr_device->request_queue);
+	wait_for_completion(&wait);
+	sreq->sr_request->waiting = NULL;
+
+	if (sreq->sr_command) {
+		scsi_put_command(sreq->sr_command);
+		sreq->sr_command = NULL;
+	}
+}
+
+/*
  * Function:    scsi_init_cmd_errh()
  *
  * Purpose:     Initialize cmd fields related to error handling.
@@ -203,7 +353,7 @@
  *		permutations grows as 2**N, and if too many more special cases
  *		get added, we start to get screwed.
  */
-void scsi_queue_next_request(request_queue_t *q, struct scsi_cmnd *cmd)
+static void scsi_queue_next_request(request_queue_t *q, struct scsi_cmnd *cmd)
 {
 	struct scsi_device *sdev, *sdev2;
 	struct Scsi_Host *shost;
@@ -791,7 +941,7 @@
 	return 0;
 }
 
-int scsi_prep_fn(struct request_queue *q, struct request *req)
+static int scsi_prep_fn(struct request_queue *q, struct request *req)
 {
 	struct Scsi_Device_Template *sdt;
 	struct scsi_device *sdev = q->queuedata;
@@ -902,7 +1052,7 @@
  *
  * Lock status: IO request lock assumed to be held when called.
  */
-void scsi_request_fn(request_queue_t *q)
+static void scsi_request_fn(request_queue_t *q)
 {
 	struct scsi_device *sdev = q->queuedata;
 	struct Scsi_Host *shost = sdev->host;
@@ -1047,6 +1197,62 @@
 	}
 }
 
+u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost)
+{
+	if (shost->highmem_io) {
+		struct device *host_dev = scsi_get_device(shost);
+
+		if (PCI_DMA_BUS_IS_PHYS && host_dev && host_dev->dma_mask)
+			return *host_dev->dma_mask;
+
+		/*
+		 * Platforms with virtual-DMA translation
+ 		 * hardware have no practical limit.
+		 */
+		return BLK_BOUNCE_ANY;
+	} else if (shost->unchecked_isa_dma)
+		return BLK_BOUNCE_ISA;
+
+	return BLK_BOUNCE_HIGH;
+}
+
+request_queue_t *scsi_alloc_queue(struct Scsi_Host *shost)
+{
+	request_queue_t *q;
+
+	q = kmalloc(sizeof(*q), GFP_ATOMIC);
+	if (!q)
+		return NULL;
+	memset(q, 0, sizeof(*q));
+
+	if (!shost->max_sectors) {
+		/*
+		 * Driver imposes no hard sector transfer limit.
+		 * start at machine infinity initially.
+		 */
+		shost->max_sectors = SCSI_DEFAULT_MAX_SECTORS;
+	}
+
+	blk_init_queue(q, scsi_request_fn, shost->host_lock);
+	blk_queue_prep_rq(q, scsi_prep_fn);
+
+	blk_queue_max_hw_segments(q, shost->sg_tablesize);
+	blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
+	blk_queue_max_sectors(q, shost->max_sectors);
+	blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost));
+
+	if (!shost->use_clustering)
+		clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
+
+	return q;
+}
+
+void scsi_free_queue(request_queue_t *q)
+{
+	blk_cleanup_queue(q);
+	kfree(q);
+}
+
 /*
  * Function:    scsi_block_requests()
  *
@@ -1134,23 +1340,6 @@
 	}
 }
 
-/*
- * FIXME(eric) - these are empty stubs for the moment.  I need to re-implement
- * host blocking from scratch. The theory is that hosts that wish to block
- * will register/deregister using these functions instead of the old way
- * of setting the wish_block flag.
- *
- * The details of the implementation remain to be settled, however the
- * stubs are here now so that the actual drivers will properly compile.
- */
-void scsi_register_blocked_host(struct Scsi_Host * shost)
-{
-}
-
-void scsi_deregister_blocked_host(struct Scsi_Host * shost)
-{
-}
-
 int __init scsi_init_queue(void)
 {
 	int i;
@@ -1178,7 +1367,7 @@
 	return 0;
 }
 
-void __exit scsi_exit_queue(void)
+void scsi_exit_queue(void)
 {
 	int i;
 
diff -Nru a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
--- a/drivers/scsi/scsi_proc.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/scsi/scsi_proc.c	Sun Feb 23 22:25:21 2003
@@ -586,7 +586,7 @@
 	return -ENOMEM;
 }
 
-void __exit scsi_exit_procfs(void)
+void scsi_exit_procfs(void)
 {
 	remove_proc_entry("scsi/device_info", 0);
 	remove_proc_entry("scsi/scsi", 0);
diff -Nru a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
--- a/drivers/scsi/scsi_scan.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/scsi/scsi_scan.c	Sun Feb 23 22:25:26 2003
@@ -84,6 +84,7 @@
 	{"NEC", "CD-ROM DRIVE:841", "1.0", BLIST_NOLUN},/* locks up */
 	{"PHILIPS", "PCA80SC", "V4-2", BLIST_NOLUN},	/* responds to all lun */
 	{"RODIME", "RO3000S", "2.33", BLIST_NOLUN},	/* locks up */
+	{"SUN", "SENA", NULL, BLIST_NOLUN},		/* responds to all luns */
 	/*
 	 * The following causes a failed REQUEST SENSE on lun 1 for
 	 * aha152x controller, which causes SCSI code to reset bus.
@@ -128,6 +129,7 @@
 	{"MITSUMI", "CD-R CR-2201CS", "6119", BLIST_NOLUN},	/* locks up */
 	{"RELISYS", "Scorpio", NULL, BLIST_NOLUN},	/* responds to all lun */
 	{"MICROTEK", "ScanMaker II", "5.61", BLIST_NOLUN},	/* responds to all lun */
+	{"NEC", "D3856", "0009", BLIST_NOLUN},
 
 	/*
 	 * Other types of devices that have special flags.
@@ -362,62 +364,6 @@
 		printk(" CCS\n");
 	else
 		printk("\n");
-}
-
-u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost)
-{
-	if (shost->highmem_io) {
-		struct device *host_dev = scsi_get_device(shost);
-
-		if (PCI_DMA_BUS_IS_PHYS && host_dev && host_dev->dma_mask)
-			return *host_dev->dma_mask;
-
-		/*
-		 * Platforms with virtual-DMA translation
- 		 * hardware have no practical limit.
-		 */
-		return BLK_BOUNCE_ANY;
-	} else if (shost->unchecked_isa_dma)
-		return BLK_BOUNCE_ISA;
-
-	return BLK_BOUNCE_HIGH;
-}
-
-static request_queue_t *scsi_alloc_queue(struct Scsi_Host *shost)
-{
-	request_queue_t *q;
-
-	q = kmalloc(sizeof(*q), GFP_ATOMIC);
-	if (!q)
-		return NULL;
-	memset(q, 0, sizeof(*q));
-
-	if (!shost->max_sectors) {
-		/*
-		 * Driver imposes no hard sector transfer limit.
-		 * start at machine infinity initially.
-		 */
-		shost->max_sectors = SCSI_DEFAULT_MAX_SECTORS;
-	}
-
-	blk_init_queue(q, scsi_request_fn, shost->host_lock);
-	blk_queue_prep_rq(q, scsi_prep_fn);
-
-	blk_queue_max_hw_segments(q, shost->sg_tablesize);
-	blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
-	blk_queue_max_sectors(q, shost->max_sectors);
-	blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost));
-
-	if (!shost->use_clustering)
-		clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
-
-	return q;
-}
-
-static void scsi_free_queue(request_queue_t *q)
-{
-	blk_cleanup_queue(q);
-	kfree(q);
 }
 
 /**
diff -Nru a/drivers/scsi/scsi_syms.c b/drivers/scsi/scsi_syms.c
--- a/drivers/scsi/scsi_syms.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/scsi/scsi_syms.c	Sun Feb 23 22:25:24 2003
@@ -74,12 +74,11 @@
 
 EXPORT_SYMBOL(scsi_io_completion);
 
-EXPORT_SYMBOL(scsi_register_blocked_host);
-EXPORT_SYMBOL(scsi_deregister_blocked_host);
 EXPORT_SYMBOL(scsi_slave_attach);
 EXPORT_SYMBOL(scsi_slave_detach);
 EXPORT_SYMBOL(scsi_device_get);
 EXPORT_SYMBOL(scsi_device_put);
+EXPORT_SYMBOL(scsi_set_device_offline);
 
 /*
  * This symbol is for the highlevel drivers (e.g. sg) only.
diff -Nru a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
--- a/drivers/scsi/scsi_sysfs.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/scsi/scsi_sysfs.c	Sun Feb 23 22:25:22 2003
@@ -14,6 +14,44 @@
 #include "scsi.h"
 #include "hosts.h"
 
+
+/*
+ * shost_show_function: macro to create an attr function that can be used to
+ * show a non-bit field.
+ */
+#define shost_show_function(field, format_string)			\
+static ssize_t								\
+show_##field (struct device *dev, char *buf)				\
+{									\
+	struct Scsi_Host *shost = to_scsi_host(dev);			\
+	return snprintf (buf, 20, format_string, shost->field);	\
+}
+
+/*
+ * shost_rd_attr: macro to create a function and attribute variable for a
+ * read only field.
+ */
+#define shost_rd_attr(field, format_string)				\
+	shost_show_function(field, format_string)				\
+static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL)
+
+/*
+ * Create the actual show/store functions and data structures.
+ */
+shost_rd_attr(unique_id, "%u\n");
+shost_rd_attr(host_busy, "%hu\n");
+shost_rd_attr(cmd_per_lun, "%hd\n");
+shost_rd_attr(sg_tablesize, "%hu\n");
+shost_rd_attr(unchecked_isa_dma, "%d\n");
+
+static struct device_attribute *const shost_attrs[] = {
+	&dev_attr_unique_id,
+	&dev_attr_host_busy,
+	&dev_attr_cmd_per_lun,
+	&dev_attr_sg_tablesize,
+	&dev_attr_unchecked_isa_dma,
+};
+
 /**
  * scsi_host_class_name_show - copy out the SCSI host name
  * @dev:		device to check
@@ -39,12 +77,21 @@
 
 static int scsi_host_class_add_dev(struct device * dev)
 {
+	int i;
+
 	device_create_file(dev, &dev_attr_class_name);
+	for (i = 0; i < ARRAY_SIZE(shost_attrs); i++)
+		device_create_file(dev, shost_attrs[i]);
+
 	return 0;
 }
 
 static void scsi_host_class_rm_dev(struct device * dev)
 {
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(shost_attrs); i++)
+		device_remove_file(dev, shost_attrs[i]);
 	device_remove_file(dev, &dev_attr_class_name);
 }
 
@@ -129,10 +176,10 @@
 
 
 /*
- * show_function: macro to create an attr function that can be used to
+ * sdev_show_function: macro to create an attr function that can be used to
  * show a non-bit field.
  */
-#define show_function(field, format_string)				\
+#define sdev_show_function(field, format_string)				\
 static ssize_t								\
 show_##field (struct device *dev, char *buf)				\
 {									\
@@ -146,7 +193,7 @@
  * read only field.
  */
 #define sdev_rd_attr(field, format_string)				\
-	show_function(field, format_string)				\
+	sdev_show_function(field, format_string)				\
 static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL)
 
 
@@ -155,27 +202,27 @@
  * read/write field.
  */
 #define sdev_rw_attr(field, format_string)				\
-	show_function(field, format_string)				\
+	sdev_show_function(field, format_string)				\
 									\
 static ssize_t								\
-store_##field (struct device *dev, const char *buf, size_t count)	\
+sdev_store_##field (struct device *dev, const char *buf, size_t count)	\
 {									\
 	struct scsi_device *sdev;					\
 	sdev = to_scsi_device(dev);					\
 	snscanf (buf, 20, format_string, &sdev->field);			\
 	return count;							\
 }									\
-static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, show_##field, store_##field)
+static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, show_##field, sdev_store_##field)
 
 /*
  * sdev_rd_attr: create a function and attribute variable for a
  * read/write bit field.
  */
 #define sdev_rw_attr_bit(field)						\
-	show_function(field, "%d\n")					\
+	sdev_show_function(field, "%d\n")					\
 									\
 static ssize_t								\
-store_##field (struct device *dev, const char *buf, size_t count)	\
+sdev_store_##field (struct device *dev, const char *buf, size_t count)	\
 {									\
 	int ret;							\
 	struct scsi_device *sdev;					\
@@ -187,7 +234,7 @@
 	}								\
 	return ret;							\
 }									\
-static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, show_##field, store_##field)
+static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, show_##field, sdev_store_##field)
 
 /*
  * scsi_sdev_check_buf_bit: return 0 if buf is "0", return 1 if buf is "1",
diff -Nru a/drivers/scsi/sg.c b/drivers/scsi/sg.c
--- a/drivers/scsi/sg.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/scsi/sg.c	Sun Feb 23 22:25:24 2003
@@ -2689,18 +2689,6 @@
 				int size, int *eof, void *data);
 static int sg_proc_devstrs_info(char *buffer, int *len, off_t * begin,
 				off_t offset, int size);
-static int sg_proc_host_read(char *buffer, char **start, off_t offset,
-			     int size, int *eof, void *data);
-static int sg_proc_host_info(char *buffer, int *len, off_t * begin,
-			     off_t offset, int size);
-static int sg_proc_hosthdr_read(char *buffer, char **start, off_t offset,
-				int size, int *eof, void *data);
-static int sg_proc_hosthdr_info(char *buffer, int *len, off_t * begin,
-				off_t offset, int size);
-static int sg_proc_hoststrs_read(char *buffer, char **start, off_t offset,
-				 int size, int *eof, void *data);
-static int sg_proc_hoststrs_info(char *buffer, int *len, off_t * begin,
-				 off_t offset, int size);
 static int sg_proc_version_read(char *buffer, char **start, off_t offset,
 				int size, int *eof, void *data);
 static int sg_proc_version_info(char *buffer, int *len, off_t * begin,
@@ -2708,7 +2696,6 @@
 static read_proc_t *sg_proc_leaf_reads[] = {
 	sg_proc_adio_read, sg_proc_dressz_read, sg_proc_debug_read,
 	sg_proc_dev_read, sg_proc_devhdr_read, sg_proc_devstrs_read,
-	sg_proc_host_read, sg_proc_hosthdr_read, sg_proc_hoststrs_read,
 	sg_proc_version_read
 };
 static write_proc_t *sg_proc_leaf_writes[] = {
@@ -3029,81 +3016,6 @@
 				   scsidp->vendor, scsidp->model, scsidp->rev);
 		else
 			PRINT_PROC("<no active device>\n");
-	}
-	return 1;
-}
-
-static int
-sg_proc_host_read(char *buffer, char **start, off_t offset,
-		  int size, int *eof, void *data)
-{
-	SG_PROC_READ_FN(sg_proc_host_info);
-}
-
-static int
-sg_proc_host_info(char *buffer, int *len, off_t * begin, off_t offset, int size)
-{
-	struct Scsi_Host *shp;
-	int k;
-
-	for (k = 0, shp = scsi_host_get_next(NULL); shp;
-	     shp = scsi_host_get_next(shp), ++k) {
-		for (; k < shp->host_no; ++k)
-			PRINT_PROC("-1\t-1\t-1\t-1\t-1\t-1\n");
-		PRINT_PROC("%u\t%hu\t%hd\t%hu\t%d\t%d\n",
-			   shp->unique_id, shp->host_busy, shp->cmd_per_lun,
-			   shp->sg_tablesize, (int) shp->unchecked_isa_dma,
-			   (int) shp->hostt->emulated);
-	}
-	return 1;
-}
-
-static int
-sg_proc_hosthdr_read(char *buffer, char **start, off_t offset,
-		     int size, int *eof, void *data)
-{
-	SG_PROC_READ_FN(sg_proc_hosthdr_info);
-}
-
-static int
-sg_proc_hosthdr_info(char *buffer, int *len, off_t * begin,
-		     off_t offset, int size)
-{
-	PRINT_PROC("uid\tbusy\tcpl\tscatg\tisa\temul\n");
-	return 1;
-}
-
-static int
-sg_proc_hoststrs_read(char *buffer, char **start, off_t offset,
-		      int size, int *eof, void *data)
-{
-	SG_PROC_READ_FN(sg_proc_hoststrs_info);
-}
-
-#define SG_MAX_HOST_STR_LEN 256
-
-static int
-sg_proc_hoststrs_info(char *buffer, int *len, off_t * begin,
-		      off_t offset, int size)
-{
-	struct Scsi_Host *shp;
-	int k;
-	char buff[SG_MAX_HOST_STR_LEN];
-	char *cp;
-
-	for (k = 0, shp = scsi_host_get_next(NULL); shp;
-	     shp = scsi_host_get_next(shp), ++k) {
-		for (; k < shp->host_no; ++k)
-			PRINT_PROC("<no active host>\n");
-		strncpy(buff, shp->hostt->info ? shp->hostt->info(shp) :
-			(shp->hostt->name ? shp->hostt->name : "<no name>"),
-			SG_MAX_HOST_STR_LEN);
-		buff[SG_MAX_HOST_STR_LEN - 1] = '\0';
-		for (cp = buff; *cp; ++cp) {
-			if ('\n' == *cp)
-				*cp = ' ';	/* suppress imbedded newlines */
-		}
-		PRINT_PROC("%s\n", buff);
 	}
 	return 1;
 }
diff -Nru a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c
--- a/drivers/scsi/sim710.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/scsi/sim710.c	Sun Feb 23 22:25:26 2003
@@ -32,51 +32,19 @@
 #include <linux/blk.h>
 #include <linux/device.h>
 #include <linux/init.h>
-#ifdef CONFIG_MCA
 #include <linux/mca.h>
-#endif
-#ifdef CONFIG_EISA
 #include <linux/eisa.h>
-#endif
+#include <linux/interrupt.h>
 
 #include "scsi.h"
 #include "hosts.h"
 #include "53c700.h"
 
+
 /* Must be enough for both EISA and MCA */
 #define MAX_SLOTS 8
 static __u8 __initdata id_array[MAX_SLOTS] = { [0 ... MAX_SLOTS-1] = 7 };
 
-/* info is used to communicate global data across the driver register
- * because the struct device_driver doesn't have any info fields.  Sigh */
-struct sim710_info {
-	Scsi_Host_Template *tpnt;
-	int found;
-};
-
-static __initdata struct sim710_info sim710_global_info;
-
-#if defined(CONFIG_MCA)
-
-/* CARD ID 01BB and 01BA use the same pos values */
-
-#define MCA_01BB_IO_PORTS { 0x0000, 0x0000, 0x0800, 0x0C00, 0x1000, 0x1400, \
-			    0x1800, 0x1C00, 0x2000, 0x2400, 0x2800, \
-			    0x2C00, 0x3000, 0x3400, 0x3800, 0x3C00, \
-			    0x4000, 0x4400, 0x4800, 0x4C00, 0x5000  }
-
-#define MCA_01BB_IRQS { 3, 5, 11, 14 }
-
-/* CARD ID 004f */
-
-#define MCA_004F_IO_PORTS { 0x0000, 0x0200, 0x0300, 0x0400, 0x0500,  0x0600 }
-
-#define MCA_004F_IRQS { 5, 9, 14 }
-
-#endif
-
-#ifdef MODULE
-
 char *sim710;		/* command line passed by insmod */
 
 MODULE_AUTHOR("Richard Hirst");
@@ -85,8 +53,6 @@
 
 MODULE_PARM(sim710, "s");
 
-#endif
-
 #ifdef MODULE
 #define ARG_SEP ' '
 #else
@@ -118,12 +84,15 @@
 	}
 	return 1;
 }
-
-#ifndef MODULE
 __setup("sim710=", param_setup);
-#endif
 
-__init int
+static Scsi_Host_Template sim710_driver_template = {
+	.name			= "LSI (Symbios) 710 MCA/EISA",
+	.proc_name		= "sim710",
+	.this_id		= 7,
+};
+
+static __devinit int
 sim710_probe_common(struct device *dev, unsigned long base_addr,
 		    int irq, int clock, int differential, int scsi_id)
 {
@@ -154,7 +123,7 @@
 	hostdata->chip710 = 1;
 
 	/* and register the chip */
-	if((host = NCR_700_detect(sim710_global_info.tpnt, hostdata)) == NULL) {
+	if((host = NCR_700_detect(&sim710_driver_template, hostdata)) == NULL) {
 		printk(KERN_ERR "sim710: No host detected; card configuration problem?\n");
 		goto out_release;
 	}
@@ -168,11 +137,9 @@
 		goto out_unregister;
 	}
 
-	scsi_set_device(host, dev);
+	scsi_add_host(host, dev);
 	hostdata->dev = dev;
 
-	sim710_global_info.found++;
-
 	return 0;
 
  out_unregister:
@@ -185,10 +152,37 @@
 	return -ENODEV;
 }
 
+static __devexit int
+sim710_device_remove(struct device *dev)
+{
+	struct Scsi_Host *host = to_scsi_host(dev);
+	struct NCR_700_Host_Parameters *hostdata =
+		(struct NCR_700_Host_Parameters *)host->hostdata[0];
+
+	scsi_remove_host(host);
+	NCR_700_release(host);
+	kfree(hostdata);
+	free_irq(host->irq, host);
+	return 0;
+}
+
 #ifdef CONFIG_MCA
+
+/* CARD ID 01BB and 01BA use the same pos values */
+#define MCA_01BB_IO_PORTS { 0x0000, 0x0000, 0x0800, 0x0C00, 0x1000, 0x1400, \
+			    0x1800, 0x1C00, 0x2000, 0x2400, 0x2800, \
+			    0x2C00, 0x3000, 0x3400, 0x3800, 0x3C00, \
+			    0x4000, 0x4400, 0x4800, 0x4C00, 0x5000  }
+
+#define MCA_01BB_IRQS { 3, 5, 11, 14 }
+
+/* CARD ID 004f */
+#define MCA_004F_IO_PORTS { 0x0000, 0x0200, 0x0300, 0x0400, 0x0500,  0x0600 }
+#define MCA_004F_IRQS { 5, 9, 14 }
+
 static short sim710_mca_id_table[] = { 0x01bb, 0x01ba, 0x004f, 0};
 
-__init int
+static __init int
 sim710_mca_probe(struct device *dev)
 {
 	struct mca_device *mca_dev = to_mca_device(dev);
@@ -268,26 +262,27 @@
 				   0, id_array[slot]);
 }
 
-struct mca_driver sim710_mca_driver = {
-	.id_table = sim710_mca_id_table,
+static struct mca_driver sim710_mca_driver = {
+	.id_table		= sim710_mca_id_table,
 	.driver = {
-		.name = "sim710",
-		.bus = &mca_bus_type,
-		.probe = sim710_mca_probe,
+		.name		= "sim710",
+		.bus		= &mca_bus_type,
+		.probe		= sim710_mca_probe,
+		.remove		= __devexit_p(sim710_device_remove),
 	},
 };
 
 #endif /* CONFIG_MCA */
 
 #ifdef CONFIG_EISA
-struct eisa_device_id sim710_eisa_ids[] = {
+static struct eisa_device_id sim710_eisa_ids[] = {
 	{ "CPQ4410" },
 	{ "CPQ4411" },
 	{ "HWP0C80" },
 	{ "" }
 };
 
-__init int
+static __init int
 sim710_eisa_probe(struct device *dev)
 {
 	struct eisa_device *edev = to_eisa_device(dev);
@@ -307,7 +302,7 @@
 #endif
 	} else {
 		eisa_irqs = eisa_cpq_irqs;
-		irq_index = inb(io_addr + 0xc88);
+		irq_index = inb(io_addr + 0xc88) & 0x07;
 	}
 
 	if(irq_index >= strlen(eisa_irqs)) {
@@ -322,36 +317,18 @@
 }
 
 struct eisa_driver sim710_eisa_driver = {
-	.id_table = sim710_eisa_ids,
+	.id_table		= sim710_eisa_ids,
 	.driver = {
-		.name =		"sim710",
-		.probe =	sim710_eisa_probe,
-		.remove =	__devexit_p(sim710_device_remove),
+		.name		= "sim710",
+		.probe		= sim710_eisa_probe,
+		.remove		= __devexit_p(sim710_device_remove),
 	},
 };
-
 #endif /* CONFIG_EISA */
 
-
-int
-sim710_release(struct Scsi_Host *host)
-{
-	struct D700_Host_Parameters *hostdata = 
-		(struct D700_Host_Parameters *)host->hostdata[0];
-
-	NCR_700_release(host);
-	kfree(hostdata);
-	free_irq(host->irq, host);
-	/* should do a refcount here and unregister the drivers when
-	 * it reaches zero */
-	return 1;
-}
-
-int __init
-sim710_detect(Scsi_Host_Template *tpnt)
+static int __init sim710_init(void)
 {
-	sim710_global_info.tpnt = tpnt;
-	sim710_global_info.found = 0;
+	int err = -ENODEV;
 
 #ifdef MODULE
 	if (sim710)
@@ -359,22 +336,31 @@
 #endif
 
 #ifdef CONFIG_MCA
-	if(MCA_bus)
-		mca_register_driver(&sim710_mca_driver);
+	err = mca_register_driver(&sim710_mca_driver);
 #endif
 
 #ifdef CONFIG_EISA
-	eisa_driver_register(&sim710_eisa_driver);
+	err = eisa_driver_register(&sim710_eisa_driver);
 #endif
-	return sim710_global_info.found;
+	/* FIXME: what we'd really like to return here is -ENODEV if
+	 * no devices have actually been found.  Instead, the err
+	 * above actually only reports problems with kobject_register,
+	 * so for the moment return success */
+
+	return 0;
 }
 
-static Scsi_Host_Template driver_template = {
-	.name =			"LSI (Symbios) 710 MCA/EISA",
-	.proc_name =		"sim710",
-	.detect =		sim710_detect,
-	.release =		sim710_release,
-	.this_id =		7,
-};
+static void __exit sim710_exit(void)
+{
+#ifdef CONFIG_MCA
+	if (MCA_bus)
+		mca_unregister_driver(&sim710_mca_driver);
+#endif
+
+#ifdef CONFIG_EISA
+	eisa_driver_unregister(&sim710_eisa_driver);
+#endif
+}
 
-#include "scsi_module.c"
+module_init(sim710_init);
+module_exit(sim710_exit);
diff -Nru a/drivers/scsi/sym53c8xx.c b/drivers/scsi/sym53c8xx.c
--- a/drivers/scsi/sym53c8xx.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/scsi/sym53c8xx.c	Sun Feb 23 22:25:25 2003
@@ -5890,7 +5890,7 @@
 	instance->dma_channel	= 0;
 	instance->cmd_per_lun	= MAX_TAGS;
 	instance->can_queue	= (MAX_START-4);
-	scsi_set_pci_device(instance, device->pdev);
+	scsi_set_device(instance, &device->pdev->dev);
 
 	np->check_integrity       = 0;
 
diff -Nru a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c	Sun Feb 23 22:25:27 2003
@@ -1876,7 +1876,7 @@
 					sym_name(np));
 		}
 		else {
-			if (!pci_set_dma_mask(np->s.device, 0xffffffffUL))
+			if (pci_set_dma_mask(np->s.device, 0xffffffffUL))
 				goto out_err32;
 		}
 	}
@@ -2130,7 +2130,7 @@
 
 	SYM_UNLOCK_HCB(np, flags);
 
-	scsi_set_pci_device(instance, dev->pdev);
+	scsi_set_device(instance, &dev->pdev->dev);
 
 	/*
 	 *  Now let the generic SCSI driver
diff -Nru a/drivers/scsi/sym53c8xx_2/sym_glue.h b/drivers/scsi/sym53c8xx_2/sym_glue.h
--- a/drivers/scsi/sym53c8xx_2/sym_glue.h	Sun Feb 23 22:25:27 2003
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.h	Sun Feb 23 22:25:27 2003
@@ -263,7 +263,7 @@
 #endif
 
 /*
- *  If the CPU and the chip use same endian-ness adressing,
+ *  If the CPU and the chip use same endian-ness addressing,
  *  no byte reordering is needed for script patching.
  *  Macro cpu_to_scr() is to be used for script patching.
  *  Macro scr_to_cpu() is to be used for getting a DWORD 
@@ -297,7 +297,7 @@
  *  would have been correctly designed for PCI, this 
  *  option would be useless.
  *
- *  If the CPU and the chip use same endian-ness adressing,
+ *  If the CPU and the chip use same endian-ness addressing,
  *  no byte reordering is needed for accessing chip io 
  *  registers. Functions suffixed by '_raw' are assumed 
  *  to access the chip over the PCI without doing byte 
diff -Nru a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c	Sun Feb 23 22:25:21 2003
@@ -1235,7 +1235,7 @@
  *  	s4:	scntl4 (see the manual)
  *
  *  current script command:
- *  	dsp:	script adress (relative to start of script).
+ *  	dsp:	script address (relative to start of script).
  *  	dbc:	first word of script command.
  *
  *  First 24 register of the chip:
diff -Nru a/drivers/scsi/sym53c8xx_2/sym_malloc.c b/drivers/scsi/sym53c8xx_2/sym_malloc.c
--- a/drivers/scsi/sym53c8xx_2/sym_malloc.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/scsi/sym53c8xx_2/sym_malloc.c	Sun Feb 23 22:25:26 2003
@@ -143,12 +143,15 @@
 	a = (m_addr_t) ptr;
 
 	while (1) {
-#ifdef SYM_MEM_FREE_UNUSED
 		if (s == SYM_MEM_CLUSTER_SIZE) {
+#ifdef SYM_MEM_FREE_UNUSED
 			M_FREE_MEM_CLUSTER(a);
+#else
+			((m_link_p) a)->next = h[i].next;
+			h[i].next = (m_link_p) a;
+#endif
 			break;
 		}
-#endif
 		b = a ^ s;
 		q = &h[i];
 		while (q->next && q->next != (m_link_p) b) {
diff -Nru a/drivers/scsi/sym53c8xx_defs.h b/drivers/scsi/sym53c8xx_defs.h
--- a/drivers/scsi/sym53c8xx_defs.h	Sun Feb 23 22:25:25 2003
+++ b/drivers/scsi/sym53c8xx_defs.h	Sun Feb 23 22:25:25 2003
@@ -487,7 +487,7 @@
 #endif
 
 /*
- *  If the CPU and the NCR use same endian-ness adressing,
+ *  If the CPU and the NCR use same endian-ness addressing,
  *  no byte reordering is needed for script patching.
  *  Macro cpu_to_scr() is to be used for script patching.
  *  Macro scr_to_cpu() is to be used for getting a DWORD 
@@ -521,7 +521,7 @@
  *  would have been correctly designed for PCI, this 
  *  option would be useless.
  *
- *  If the CPU and the NCR use same endian-ness adressing,
+ *  If the CPU and the NCR use same endian-ness addressing,
  *  no byte reordering is needed for accessing chip io 
  *  registers. Functions suffixed by '_raw' are assumed 
  *  to access the chip over the PCI without doing byte 
diff -Nru a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
--- a/drivers/scsi/tmscsim.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/scsi/tmscsim.c	Sun Feb 23 22:25:27 2003
@@ -2206,7 +2206,7 @@
     psh = scsi_register( psht, sizeof(DC390_ACB) );
     if( !psh ) return( -1 );
 	
-    scsi_set_pci_device(psh, pdev);
+    scsi_set_device(psh, &pdev->dev);
     pACB = (PACB) psh->hostdata;
     DC390_LOCKA_INIT;
     DC390_LOCK_ACB;
diff -Nru a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
--- a/drivers/scsi/u14-34f.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/scsi/u14-34f.c	Sun Feb 23 22:25:23 2003
@@ -905,7 +905,6 @@
       }
    else {
       unsigned long flags;
-      scsi_register_blocked_host(sh[j]);
       sh[j]->unchecked_isa_dma = TRUE;
 
       flags=claim_dma_lock();
@@ -1910,8 +1909,6 @@
 
    if (sh[j] == NULL) panic("%s: release, invalid Scsi_Host pointer.\n",
                             driver_name);
-
-   if(sh[j]->unchecked_isa_dma) scsi_deregister_blocked_host(sh[j]);
 
    for (i = 0; i < sh[j]->can_queue; i++)
       if ((&HD(j)->cp[i])->sglist) kfree((&HD(j)->cp[i])->sglist);
diff -Nru a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
--- a/drivers/scsi/wd7000.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/scsi/wd7000.c	Sun Feb 23 22:25:27 2003
@@ -158,6 +158,11 @@
  * Clean up delay to udelay, and yielding sleeps
  * Make host reset actually reset the card
  * Make everything static
+ *
+ * 2003/02/12 - Christoph Hellwig <hch@infradead.org>
+ *
+ * Cleaned up host template defintion
+ * Removed now obsolete wd7000.h
  */
 
 #include <linux/module.h>
@@ -170,8 +175,8 @@
 #include <linux/ioport.h>
 #include <linux/proc_fs.h>
 #include <linux/blk.h>
-#include <linux/version.h>
 #include <linux/init.h>
+#include <linux/stat.h>
 
 #include <asm/system.h>
 #include <asm/dma.h>
@@ -179,9 +184,9 @@
 
 #include "scsi.h"
 #include "hosts.h"
-
 #include <scsi/scsicam.h>
 
+
 #define ANY2SCSI_INLINE		/* undef this to use old macros */
 #undef  WD7000_DEBUG		/* general debug                */
 #ifdef WD7000_DEBUG
@@ -190,9 +195,6 @@
 #define dprintk(format,args...)
 #endif
 
-#include "wd7000.h"
-#include <linux/stat.h>
-
 /*
  *  Mailbox structure sizes.
  *  I prefer to keep the number of ICMBs much larger than the number of
@@ -212,6 +214,21 @@
 #define MAX_SCBS        32
 
 /*
+ *  In this version, sg_tablesize now defaults to WD7000_SG, and will
+ *  be set to SG_NONE for older boards.  This is the reverse of the
+ *  previous default, and was changed so that the driver-level
+ *  Scsi_Host_Template would reflect the driver's support for scatter/
+ *  gather.
+ *
+ *  Also, it has been reported that boards at Revision 6 support scatter/
+ *  gather, so the new definition of an "older" board has been changed
+ *  accordingly.
+ */
+#define WD7000_Q	16
+#define WD7000_SG	16
+
+
+/*
  *  WD7000-specific mailbox structure
  *
  */
@@ -1737,7 +1754,23 @@
 MODULE_DESCRIPTION("Driver for the WD7000 series ISA controllers");
 MODULE_LICENSE("GPL");
 
-/* Eventually this will go into an include file, but this will be later */
-static Scsi_Host_Template driver_template = WD7000;
+static Scsi_Host_Template driver_template = {
+	.proc_name		= "wd7000",
+	.proc_info		= wd7000_proc_info,
+	.name			= "Western Digital WD-7000",
+	.detect			= wd7000_detect,
+	.command		= wd7000_command,
+	.queuecommand		= wd7000_queuecommand,
+	.eh_bus_reset_handler	= wd7000_bus_reset,
+	.eh_device_reset_handler = wd7000_device_reset,
+	.eh_host_reset_handler	= wd7000_host_reset,
+	.bios_param		= wd7000_biosparam,
+	.can_queue		= WD7000_Q,
+	.this_id		= 7,
+	.sg_tablesize		= WD7000_SG,
+	.cmd_per_lun		= 1,
+	.unchecked_isa_dma	= 1,
+	.use_clustering		= ENABLE_CLUSTERING,
+};
 
 #include "scsi_module.c"
diff -Nru a/drivers/scsi/wd7000.h b/drivers/scsi/wd7000.h
--- a/drivers/scsi/wd7000.h	Sun Feb 23 22:25:26 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,64 +0,0 @@
-#ifndef _WD7000_H
-
-/* $Id: $
- *
- * Header file for the WD-7000 driver for Linux
- *
- * John Boyd <boyd@cis.ohio-state.edu>  Jan 1994:
- * This file has been reduced to only the definitions needed for the
- * WD7000 host structure.
- *
- * Revision by Miroslav Zagorac <zaga@fly.cc.fer.hr>  Jun 1997.
- */
-
-#include <linux/types.h>
-
-static int wd7000_set_info(char *buffer, int length, struct Scsi_Host *host);
-static int wd7000_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout);
-static int wd7000_detect(Scsi_Host_Template *);
-static int wd7000_command(Scsi_Cmnd *);
-static int wd7000_queuecommand(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
-static int wd7000_abort(Scsi_Cmnd *);
-static int wd7000_bus_reset(Scsi_Cmnd *);
-static int wd7000_host_reset(Scsi_Cmnd *);
-static int wd7000_device_reset(Scsi_Cmnd *);
-static int wd7000_biosparam(struct scsi_device *, struct block_device *,
-		sector_t, int *);
-
-#ifndef NULL
-#define NULL 0L
-#endif
-
-/*
- *  In this version, sg_tablesize now defaults to WD7000_SG, and will
- *  be set to SG_NONE for older boards.  This is the reverse of the
- *  previous default, and was changed so that the driver-level
- *  Scsi_Host_Template would reflect the driver's support for scatter/
- *  gather.
- *
- *  Also, it has been reported that boards at Revision 6 support scatter/
- *  gather, so the new definition of an "older" board has been changed
- *  accordingly.
- */
-#define WD7000_Q    16
-#define WD7000_SG   16
-
-#define WD7000 {						\
-	.proc_name		= "wd7000",			\
-	.proc_info		= wd7000_proc_info,		\
-	.name			= "Western Digital WD-7000",	\
-	.detect			= wd7000_detect,			\
-	.command		= wd7000_command,			\
-	.queuecommand		= wd7000_queuecommand,		\
-	.eh_bus_reset_handler	= wd7000_bus_reset,		\
-	.eh_device_reset_handler = wd7000_device_reset,		\
-	.eh_host_reset_handler	= wd7000_host_reset,		\
-	.bios_param		= wd7000_biosparam,		\
-	.can_queue		= WD7000_Q,			\
-	.this_id		= 7,				\
-	.sg_tablesize		= WD7000_SG,			\
-	.cmd_per_lun		= 1,				\
-	.unchecked_isa_dma	= 1,				\
-	.use_clustering		= ENABLE_CLUSTERING,		\
-}
-#endif
diff -Nru a/drivers/serial/21285.c b/drivers/serial/21285.c
--- a/drivers/serial/21285.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/serial/21285.c	Sun Feb 23 22:25:25 2003
@@ -545,7 +545,5 @@
 module_init(serial21285_init);
 module_exit(serial21285_exit);
 
-EXPORT_NO_SYMBOLS;
-
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Intel Footbridge (21285) serial driver $Revision: 1.37 $");
diff -Nru a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
--- a/drivers/serial/68360serial.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/serial/68360serial.c	Sun Feb 23 22:25:26 2003
@@ -296,11 +296,11 @@
 		"Warning: null async_struct for (%s) in %s\n";
 
 	if (!info) {
-		printk(badinfo, kdevname(device), routine);
+		printk(badinfo, cdevname(device), routine);
 		return 1;
 	}
 	if (info->magic != SERIAL_MAGIC) {
-		printk(badmagic, kdevname(device), routine);
+		printk(badmagic, cdevname(device), routine);
 		return 1;
 	}
 #endif
diff -Nru a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
--- a/drivers/serial/8250_pci.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/serial/8250_pci.c	Sun Feb 23 22:25:25 2003
@@ -1248,8 +1248,6 @@
 module_init(serial8250_pci_init);
 module_exit(serial8250_pci_exit);
 
-EXPORT_NO_SYMBOLS;
-
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Generic 8250/16x50 PCI serial probe module");
 MODULE_DEVICE_TABLE(pci, serial_pci_tbl);
diff -Nru a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
--- a/drivers/serial/8250_pnp.c	Sun Feb 23 22:25:21 2003
+++ b/drivers/serial/8250_pnp.c	Sun Feb 23 22:25:21 2003
@@ -317,7 +317,7 @@
 {
 	unsigned int map = 0x1FF8;
 	struct pnp_irq *irq;
-	struct pnp_resources *res = dev->res;
+	struct pnp_resources *res = dev->possible;
 
 	serial8250_get_irq_map(&map);
 
@@ -348,7 +348,7 @@
  * Given a complete unknown PnP device, try to use some heuristics to
  * detect modems. Currently use such heuristic set:
  *     - dev->name or dev->bus->name must contain "modem" substring;
- *     - device must have only one IO region (8 byte long) with base adress
+ *     - device must have only one IO region (8 byte long) with base address
  *       0x2e8, 0x3e8, 0x2f8 or 0x3f8.
  *
  * Such detection looks very ugly, but can detect at least some of numerous
@@ -357,10 +357,10 @@
  */
 static int serial_pnp_guess_board(struct pnp_dev *dev, int *flags)
 {
-	struct pnp_resources *res = dev->res;
+	struct pnp_resources *res = dev->possible;
 	struct pnp_resources *resa;
 
-	if (!(check_name(dev->name) || (dev->card && check_name(dev->card->name))))
+	if (!(check_name(dev->dev.name) || (dev->card && check_name(dev->card->dev.name))))
 		return -ENODEV;
 
 	if (!res)
@@ -436,8 +436,6 @@
 
 module_init(serial8250_pnp_init);
 module_exit(serial8250_pnp_exit);
-
-EXPORT_NO_SYMBOLS;
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Generic 8250/16x50 PnP serial driver");
diff -Nru a/drivers/serial/amba.c b/drivers/serial/amba.c
--- a/drivers/serial/amba.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/serial/amba.c	Sun Feb 23 22:25:22 2003
@@ -25,7 +25,7 @@
  *  $Id: amba.c,v 1.41 2002/07/28 10:03:27 rmk Exp $
  *
  * This is a generic driver for ARM AMBA-type serial ports.  They
- * have a lot of 16550-like features, but are not register compatable.
+ * have a lot of 16550-like features, but are not register compatible.
  * Note that although they do have CTS, DCD and DSR inputs, they do
  * not have an RI input, nor do they have DTR or RTS outputs.  If
  * required, these have to be supplied via some other means (eg, GPIO)
@@ -752,8 +752,6 @@
 
 module_init(ambauart_init);
 module_exit(ambauart_exit);
-
-EXPORT_NO_SYMBOLS;
 
 MODULE_AUTHOR("ARM Ltd/Deep Blue Solutions Ltd");
 MODULE_DESCRIPTION("ARM AMBA serial port driver $Revision: 1.41 $");
diff -Nru a/drivers/serial/anakin.c b/drivers/serial/anakin.c
--- a/drivers/serial/anakin.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/serial/anakin.c	Sun Feb 23 22:25:22 2003
@@ -544,5 +544,3 @@
 MODULE_AUTHOR("Tak-Shing Chan <chan@aleph1.co.uk>");
 MODULE_SUPPORTED_DEVICE("ttyAN");
 MODULE_LICENSE("GPL");
-
-EXPORT_NO_SYMBOLS;
diff -Nru a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c
--- a/drivers/serial/clps711x.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/serial/clps711x.c	Sun Feb 23 22:25:23 2003
@@ -615,8 +615,6 @@
 module_init(clps711xuart_init);
 module_exit(clps711xuart_exit);
 
-EXPORT_NO_SYMBOLS;
-
 MODULE_AUTHOR("Deep Blue Solutions Ltd");
 MODULE_DESCRIPTION("CLPS-711x generic serial driver $Revision: 1.42 $");
 MODULE_LICENSE("GPL");
diff -Nru a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c
--- a/drivers/serial/mcfserial.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/serial/mcfserial.c	Sun Feb 23 22:25:24 2003
@@ -1,7 +1,7 @@
 /*
  * mcfserial.c -- serial driver for ColdFire internal UARTS.
  *
- * Copyright (C) 1999-2002 Greg Ungerer <gerg@snapgear.com>
+ * Copyright (C) 1999-2003 Greg Ungerer <gerg@snapgear.com>
  * Copyright (c) 2000-2001 Lineo, Inc. <www.lineo.com> 
  * Copyright (C) 2001-2002 SnapGear Inc. <www.snapgear.com> 
  *
@@ -50,12 +50,6 @@
 #include <asm/uaccess.h>
 #include "mcfserial.h"
 
-/*
- *	the only event we use
- */
-#undef RS_EVENT_WRITE_WAKEUP
-#define RS_EVENT_WRITE_WAKEUP 0
-
 struct timer_list mcfrs_timer_struct;
 
 /*
@@ -443,12 +437,10 @@
 	if (!tty)
 		return;
 
-	if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) {
-		if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
-		    tty->ldisc.write_wakeup)
-			(tty->ldisc.write_wakeup)(tty);
-		wake_up_interruptible(&tty->write_wait);
-	}
+	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
+	    tty->ldisc.write_wakeup)
+		(tty->ldisc.write_wakeup)(tty);
+	wake_up_interruptible(&tty->write_wait);
 }
 
 
diff -Nru a/drivers/serial/nb85e_uart.c b/drivers/serial/nb85e_uart.c
--- a/drivers/serial/nb85e_uart.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/serial/nb85e_uart.c	Sun Feb 23 22:25:26 2003
@@ -472,7 +472,8 @@
 	/* Restrict flags to legal values.  */
 	if ((cflags & CSIZE) != CS7 && (cflags & CSIZE) != CS8)
 		/* The new value of CSIZE is invalid, use the old value.  */
-		cflags = (cflags & ~CSIZE) | (old->c_cflag & CSIZE);
+		cflags = (cflags & ~CSIZE)
+			| (old ? (old->c_cflag & CSIZE) : CS8);
 
 	termios->c_cflag = cflags;
 
@@ -609,8 +610,6 @@
 
 module_init (nb85e_uart_init);
 module_exit (nb85e_uart_exit);
-
-EXPORT_NO_SYMBOLS;
 
 MODULE_AUTHOR ("Miles Bader");
 MODULE_DESCRIPTION ("NEC " NB85E_UART_CHIP_NAME " on-chip UART");
diff -Nru a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
--- a/drivers/serial/sa1100.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/serial/sa1100.c	Sun Feb 23 22:25:22 2003
@@ -885,8 +885,6 @@
 module_init(sa1100_serial_init);
 module_exit(sa1100_serial_exit);
 
-EXPORT_NO_SYMBOLS;
-
 MODULE_AUTHOR("Deep Blue Solutions Ltd");
 MODULE_DESCRIPTION("SA1100 generic serial port driver $Revision: 1.50 $");
 MODULE_LICENSE("GPL");
diff -Nru a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
--- a/drivers/serial/sunsu.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/serial/sunsu.c	Sun Feb 23 22:25:22 2003
@@ -525,7 +525,6 @@
 				up->kbd_id = 0;
 				return;
 			}
-			kbd_pt_regs = regs;
 #ifdef CONFIG_SERIO
 			serio_interrupt(&up->serio, ch, 0, regs);
 #endif
diff -Nru a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
--- a/drivers/serial/sunzilog.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/serial/sunzilog.c	Sun Feb 23 22:25:27 2003
@@ -301,7 +301,6 @@
 			up->kbd_id = 0;
 			return;
 		}
-		kbd_pt_regs = regs;
 #ifdef CONFIG_SERIO
 		serio_interrupt(&up->serio, ch, 0, regs);
 #endif
@@ -1722,8 +1721,6 @@
 
 module_init(sunzilog_init);
 module_exit(sunzilog_exit);
-
-EXPORT_NO_SYMBOLS;
 
 MODULE_AUTHOR("David S. Miller");
 MODULE_DESCRIPTION("Sun Zilog serial port driver");
diff -Nru a/drivers/usb/Makefile.lib b/drivers/usb/Makefile.lib
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/usb/Makefile.lib	Sun Feb 23 22:25:21 2003
@@ -0,0 +1,3 @@
+obj-$(CONFIG_USB_CATC)		+= crc32.o
+obj-$(CONFIG_USB_SPEEDTOUCH)	+= crc32.o
+obj-$(CONFIG_USB_USBNET)	+= crc32.o
diff -Nru a/drivers/usb/class/Makefile.lib b/drivers/usb/class/Makefile.lib
--- a/drivers/usb/class/Makefile.lib	Sun Feb 23 22:25:21 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1 +0,0 @@
-obj-$(CONFIG_USB_CATC)		+= crc32.o
diff -Nru a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
--- a/drivers/usb/class/cdc-acm.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/usb/class/cdc-acm.c	Sun Feb 23 22:25:25 2003
@@ -606,6 +606,7 @@
 		if (!acm->ctrlurb) {
 			err("out of memory");
 			kfree(acm);
+			kfree(buf);
 			return -ENOMEM;
 		}
 		acm->readurb = usb_alloc_urb(0, GFP_KERNEL);
@@ -613,6 +614,7 @@
 			err("out of memory");
 			usb_free_urb(acm->ctrlurb);
 			kfree(acm);
+			kfree(buf);
 			return -ENOMEM;
 		}
 		acm->writeurb = usb_alloc_urb(0, GFP_KERNEL);
@@ -621,6 +623,7 @@
 			usb_free_urb(acm->readurb);
 			usb_free_urb(acm->ctrlurb);
 			kfree(acm);
+			kfree(buf);
 			return -ENOMEM;
 		}
 
diff -Nru a/drivers/usb/core/message.c b/drivers/usb/core/message.c
--- a/drivers/usb/core/message.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/usb/core/message.c	Sun Feb 23 22:25:22 2003
@@ -219,16 +219,25 @@
 	spin_lock_irqsave (&io->lock, flags);
 
 	/* In 2.5 we require hcds' endpoint queues not to progress after fault
-	 * reports, until the competion callback (this!) returns.  That lets
+	 * reports, until the completion callback (this!) returns.  That lets
 	 * device driver code (like this routine) unlink queued urbs first,
 	 * if it needs to, since the HC won't work on them at all.  So it's
 	 * not possible for page N+1 to overwrite page N, and so on.
+	 *
+	 * That's only for "hard" faults; "soft" faults (unlinks) sometimes
+	 * complete before the HCD can get requests away from hardware,
+	 * though never during cleanup after a hard fault.
 	 */
-	if (io->status && urb->actual_length) {
-		err ("driver for bus %s dev %s ep %d-%s corrupted data!",
-			io->dev->bus->bus_name, io->dev->devpath,
+	if (io->status
+			&& (io->status != -ECONNRESET
+				|| urb->status != -ECONNRESET)
+			&& urb->actual_length) {
+		dev_err (io->dev->bus->controller,
+			"dev %s ep%d%s scatterlist error %d/%d\n",
+			io->dev->devpath,
 			usb_pipeendpoint (urb->pipe),
-			usb_pipein (urb->pipe) ? "in" : "out");
+			usb_pipein (urb->pipe) ? "in" : "out",
+			urb->status, io->status);
 		// BUG ();
 	}
 
diff -Nru a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
--- a/drivers/usb/core/urb.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/usb/core/urb.c	Sun Feb 23 22:25:25 2003
@@ -195,7 +195,7 @@
 
 	if (!urb || urb->hcpriv || !urb->complete)
 		return -EINVAL;
-	if (!(dev = urb->dev) || !dev->bus || dev->devnum <= 0)
+	if (!(dev = urb->dev) || !dev->present || !dev->bus || dev->devnum <= 0)
 		return -ENODEV;
 	if (!(op = dev->bus->op) || !op->submit_urb)
 		return -ENODEV;
@@ -376,7 +376,7 @@
  */
 int usb_unlink_urb(struct urb *urb)
 {
-	if (urb && urb->dev && urb->dev->bus && urb->dev->bus->op)
+	if (urb && urb->dev && urb->dev->present && urb->dev->bus && urb->dev->bus->op)
 		return urb->dev->bus->op->unlink_urb(urb);
 	else
 		return -ENODEV;
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/usb/core/usb.c	Sun Feb 23 22:25:24 2003
@@ -679,6 +679,7 @@
 	memset(dev, 0, sizeof(*dev));
 
 	device_initialize(&dev->dev);
+	dev->present = 1;
 
 	usb_bus_get(bus);
 
@@ -853,6 +854,10 @@
 		usbfs_remove_device(dev);
 	}
 	device_unregister(&dev->dev);
+
+	/* mark the device as not present so any further urb submissions for
+	 * this device will fail. */
+	dev->present = 0;
 
 	/* Decrement the reference count, it'll auto free everything when */
 	/* it hits 0 which could very well be now */
diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
--- a/drivers/usb/host/ehci-hcd.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/usb/host/ehci-hcd.c	Sun Feb 23 22:25:25 2003
@@ -37,7 +37,7 @@
 #include <linux/timer.h>
 #include <linux/list.h>
 #include <linux/interrupt.h>
-
+#include <linux/reboot.h>
 #include <linux/usb.h>
 
 #include <linux/version.h>
@@ -306,6 +306,19 @@
 	return 0;
 }
 
+static int
+ehci_reboot (struct notifier_block *self, unsigned long code, void *null)
+{
+	struct ehci_hcd		*ehci;
+
+	ehci = container_of (self, struct ehci_hcd, reboot_notifier);
+
+	/* make BIOS/etc use companion controller during reboot */
+	writel (0, &ehci->regs->configured_flag);
+	return 0;
+}
+
+
 /* called by khubd or root hub init threads */
 
 static int ehci_start (struct usb_hcd *hcd)
@@ -464,6 +477,9 @@
 	 * are explicitly handed to companion controller(s), so no TT is
 	 * involved with the root hub.
 	 */
+	ehci->reboot_notifier.notifier_call = ehci_reboot;
+	register_reboot_notifier (&ehci->reboot_notifier);
+
 	ehci->hcd.state = USB_STATE_READY;
 	writel (FLAG_CF, &ehci->regs->configured_flag);
 	readl (&ehci->regs->command);	/* unblock posted write */
@@ -520,6 +536,7 @@
 
 	/* let companion controllers work when we aren't */
 	writel (0, &ehci->regs->configured_flag);
+	unregister_reboot_notifier (&ehci->reboot_notifier);
 
 	remove_debug_files (ehci);
 
diff -Nru a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
--- a/drivers/usb/host/ehci.h	Sun Feb 23 22:25:26 2003
+++ b/drivers/usb/host/ehci.h	Sun Feb 23 22:25:26 2003
@@ -81,8 +81,10 @@
 	struct pci_pool		*sitd_pool;	/* sitd per split iso urb */
 
 	struct timer_list	watchdog;
+	struct notifier_block	reboot_notifier;
 	unsigned		stamp;
 
+	/* irq statistics */
 #ifdef EHCI_STATS
 	struct ehci_stats	stats;
 #	define COUNT(x) do { (x)++; } while (0)
diff -Nru a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig
--- a/drivers/usb/input/Kconfig	Sun Feb 23 22:25:25 2003
+++ b/drivers/usb/input/Kconfig	Sun Feb 23 22:25:25 2003
@@ -163,11 +163,10 @@
 	tristate "Griffin PowerMate and Contour Jog support"
 	depends on USB && INPUT
 	---help---
-	  Say Y here if you want to use  Griffin PowerMate or Contour Jog devices.
-	  These are stainless steel dials which can measure clockwise and
-	  anticlockwise rotation. The dial also acts as a pushbutton. The base
-	  contains an LED which can be instructed to pulse or to switch to a
-	  particular intensity.
+	  Say Y here if you want to use Griffin PowerMate or Contour Jog devices.
+	  These are aluminum dials which can measure clockwise and anticlockwise
+	  rotation.  The dial also acts as a pushbutton.  The base contains an LED
+	  which can be instructed to pulse or to switch to a particular intensity.
 
 	  You can download userspace tools from http://sowerbutts.com/powermate/
 
diff -Nru a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c
--- a/drivers/usb/input/usbkbd.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/usb/input/usbkbd.c	Sun Feb 23 22:25:26 2003
@@ -355,7 +355,7 @@
 MODULE_DEVICE_TABLE (usb, usb_kbd_id_table);
 
 static struct usb_driver usb_kbd_driver = {
-	.name =		"keyboard",
+	.name =		"usbkbd",
 	.probe =	usb_kbd_probe,
 	.disconnect =	usb_kbd_disconnect,
 	.id_table =	usb_kbd_id_table,
diff -Nru a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c
--- a/drivers/usb/input/usbmouse.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/usb/input/usbmouse.c	Sun Feb 23 22:25:26 2003
@@ -238,7 +238,7 @@
 MODULE_DEVICE_TABLE (usb, usb_mouse_id_table);
 
 static struct usb_driver usb_mouse_driver = {
-	.name		= "usb_mouse",
+	.name		= "usbmouse",
 	.probe		= usb_mouse_probe,
 	.disconnect	= usb_mouse_disconnect,
 	.id_table	= usb_mouse_id_table,
diff -Nru a/drivers/usb/media/ov511.c b/drivers/usb/media/ov511.c
--- a/drivers/usb/media/ov511.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/usb/media/ov511.c	Sun Feb 23 22:25:23 2003
@@ -1,7 +1,7 @@
 /*
  * OmniVision OV511 Camera-to-USB Bridge Driver
  *
- * Copyright (c) 1999-2002 Mark W. McClelland
+ * Copyright (c) 1999-2003 Mark W. McClelland
  * Original decompression code Copyright 1998-2000 OmniVision Technologies
  * Many improvements by Bret Wallach <bwallac1@san.rr.com>
  * Color fixes by by Orion Sky Lawlor <olawlor@acm.org> (2/26/2000)
@@ -60,7 +60,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.63 for Linux 2.5"
+#define DRIVER_VERSION "v1.64 for Linux 2.5"
 #define EMAIL "mark@alpha.dyndns.org"
 #define DRIVER_AUTHOR "Mark McClelland <mark@alpha.dyndns.org> & Bret Wallach \
 	& Orion Sky Lawlor <olawlor@acm.org> & Kevin Moore & Charl P. Botha \
@@ -137,7 +137,7 @@
 MODULE_PARM(cams, "i");
 MODULE_PARM_DESC(cams, "Number of simultaneous cameras");
 MODULE_PARM(compress, "i");
-MODULE_PARM_DESC(compress, "Turn on compression (not reliable yet)");
+MODULE_PARM_DESC(compress, "Turn on compression");
 MODULE_PARM(testpat, "i");
 MODULE_PARM_DESC(testpat,
   "Replace image with vertical bar testpattern (only partially working)");
@@ -1349,6 +1349,13 @@
 	return 0;
 }
 
+/* Sleeps until no frames are active. Returns !0 if got signal */
+static int
+ov51x_wait_frames_inactive(struct usb_ov511 *ov)
+{
+	return wait_event_interruptible(ov->wq, ov->curframe < 0);
+}
+
 /* Resets the hardware snapshot button */
 static void
 ov51x_clear_snapshot(struct usb_ov511 *ov)
@@ -2121,7 +2128,7 @@
 
 	return 0;
 }
-#endif /* CONFIG_PROC_FS && CONFIG_VIDEO_PROC_FS */
+#endif /* CONFIG_VIDEO_PROC_FS */
 
 /* Turns on or off the LED. Only has an effect with OV511+/OV518(+) */
 static void
@@ -2486,8 +2493,6 @@
 
 	/******** Clock programming ********/
 
-	// FIXME: Test this with OV6630
-
 	/* The OV6620 needs special handling. This prevents the 
 	 * severe banding that normally occurs */
 	if (ov->sensor == SEN_OV6620 || ov->sensor == SEN_OV6630)
@@ -2995,6 +3000,7 @@
 			ov->frame[i].format = force_palette;
 		else
 			ov->frame[i].format = VIDEO_PALETTE_YUV420;
+
 		ov->frame[i].depth = get_depth(ov->frame[i].format);
 	}
 
@@ -3577,12 +3583,8 @@
 		if (frame->scanstate == STATE_LINES) {
 	    		int nextf;
 
-			frame->grabstate = FRAME_DONE;	// FIXME: Is this right?
-
-			if (waitqueue_active(&frame->wq)) {
-				frame->grabstate = FRAME_DONE;
-				wake_up_interruptible(&frame->wq);
-			}
+			frame->grabstate = FRAME_DONE;
+			wake_up_interruptible(&frame->wq);
 
 			/* If next frame is ready or grabbing,
 			 * point to it */
@@ -3747,12 +3749,8 @@
 	if (frame->scanstate == STATE_LINES) {
     		int nextf;
 
-		frame->grabstate = FRAME_DONE;	// FIXME: Is this right?
-
-		if (waitqueue_active(&frame->wq)) {
-			frame->grabstate = FRAME_DONE;
-			wake_up_interruptible(&frame->wq);
-		}
+		frame->grabstate = FRAME_DONE;
+		wake_up_interruptible(&frame->wq);
 
 		/* If next frame is ready or grabbing,
 		 * point to it */
@@ -4228,7 +4226,7 @@
 }
 
 static void
-ov51x_dealloc(struct usb_ov511 *ov, int now)
+ov51x_dealloc(struct usb_ov511 *ov)
 {
 	PDEBUG(4, "entered");
 	down(&ov->buf_lock);
@@ -4258,10 +4256,6 @@
 	if (ov->user)
 		goto out;
 
-	err = ov51x_alloc(ov);
-	if (err < 0)
-		goto out;
-
 	ov->sub_flag = 0;
 
 	/* In case app doesn't set them... */
@@ -4283,9 +4277,13 @@
 			goto out;
 	}
 
+	err = ov51x_alloc(ov);
+	if (err < 0)
+		goto out;
+
 	err = ov51x_init_isoc(ov);
 	if (err) {
-		ov51x_dealloc(ov, 0);
+		ov51x_dealloc(ov);
 		goto out;
 	}
 
@@ -4319,7 +4317,7 @@
 		ov51x_led_control(ov, 0);
 
 	if (ov->dev)
-		ov51x_dealloc(ov, 0);
+		ov51x_dealloc(ov);
 
 	up(&ov->lock);
 
@@ -4331,7 +4329,7 @@
 		ov->cbuf = NULL;
 		up(&ov->cbuf_lock);
 
-		ov51x_dealloc(ov, 1);
+		ov51x_dealloc(ov);
 		kfree(ov);
 		ov = NULL;
 	}
@@ -4449,7 +4447,7 @@
 	case VIDIOCSPICT:
 	{
 		struct video_picture *p = arg;
-		int i;
+		int i, rc;
 
 		PDEBUG(4, "VIDIOCSPICT");
 
@@ -4469,10 +4467,9 @@
 		if (p->palette != ov->frame[0].format) {
 			PDEBUG(4, "Detected format change");
 
-			/* If we're collecting previous frame wait
-			   before changing modes */
-			interruptible_sleep_on(&ov->wq);
-			if (signal_pending(current)) return -EINTR;
+			rc = ov51x_wait_frames_inactive(ov);
+			if (rc)
+				return rc;
 
 			mode_init_regs(ov, ov->frame[0].width,
 				ov->frame[0].height, p->palette, ov->sub_flag);
@@ -4530,7 +4527,7 @@
 	case VIDIOCSWIN:
 	{
 		struct video_window *vw = arg;
-		int i, result;
+		int i, rc;
 
 		PDEBUG(4, "VIDIOCSWIN: %dx%d", vw->width, vw->height);
 
@@ -4545,15 +4542,14 @@
 			return -EINVAL;
 #endif
 
-		/* If we're collecting previous frame wait
-		   before changing modes */
-		interruptible_sleep_on(&ov->wq);
-		if (signal_pending(current)) return -EINTR;
+		rc = ov51x_wait_frames_inactive(ov);
+		if (rc)
+			return rc;
 
-		result = mode_init_regs(ov, vw->width, vw->height,
+		rc = mode_init_regs(ov, vw->width, vw->height,
 			ov->frame[0].format, ov->sub_flag);
-		if (result < 0)
-			return result;
+		if (rc < 0)
+			return rc;
 
 		for (i = 0; i < OV511_NUMFRAMES; i++) {
 			ov->frame[i].width = vw->width;
@@ -4600,7 +4596,7 @@
 	case VIDIOCMCAPTURE:
 	{
 		struct video_mmap *vm = arg;
-		int ret, depth;
+		int rc, depth;
 		unsigned int f = vm->frame;
 
 		PDEBUG(4, "VIDIOCMCAPTURE: frame: %d, %dx%d, %s", f, vm->width,
@@ -4642,14 +4638,14 @@
 		    (ov->frame[f].depth != depth)) {
 			PDEBUG(4, "VIDIOCMCAPTURE: change in image parameters");
 
-			/* If we're collecting previous frame wait
-			   before changing modes */
-			interruptible_sleep_on(&ov->wq);
-			if (signal_pending(current)) return -EINTR;
-			ret = mode_init_regs(ov, vm->width, vm->height,
+			rc = ov51x_wait_frames_inactive(ov);
+			if (rc)
+				return rc;
+
+			rc = mode_init_regs(ov, vm->width, vm->height,
 				vm->format, ov->sub_flag);
 #if 0
-			if (ret < 0) {
+			if (rc < 0) {
 				PDEBUG(1, "Got error while initializing regs ");
 				return ret;
 			}
@@ -4702,18 +4698,15 @@
 				return rc;
 
 			if (frame->grabstate == FRAME_ERROR) {
-				int ret;
-
-				if ((ret = ov51x_new_frame(ov, fnum)) < 0)
-					return ret;
+				if ((rc = ov51x_new_frame(ov, fnum)) < 0)
+					return rc;
 				goto redo;
 			}
 			/* Fall through */
 		case FRAME_DONE:
 			if (ov->snap_enabled && !frame->snapshot) {
-				int ret;
-				if ((ret = ov51x_new_frame(ov, fnum)) < 0)
-					return ret;
+				if ((rc = ov51x_new_frame(ov, fnum)) < 0)
+					return rc;
 				goto redo;
 			}
 
@@ -6089,7 +6082,6 @@
 	return -EBUSY;
 }
 
-
 /****************************************************************************
  *
  *  USB routines
@@ -6097,11 +6089,10 @@
  ***************************************************************************/
 
 static int
-ov51x_probe(struct usb_interface *intf, 
-	    const struct usb_device_id *id)
+ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id)
 {
 	struct usb_device *dev = interface_to_usbdev(intf);
-	struct usb_interface_descriptor *interface;
+	struct usb_interface_descriptor *idesc;
 	struct usb_ov511 *ov;
 	int i;
 	int registered = 0;
@@ -6112,12 +6103,11 @@
 	if (dev->descriptor.bNumConfigurations != 1)
 		return -ENODEV;
 
-	interface = &intf->altsetting[0].desc;
+	idesc = &intf->altsetting[0].desc;
 
-	/* Checking vendor/product should be enough, but what the hell */
-	if (interface->bInterfaceClass != 0xFF)
+	if (idesc->bInterfaceClass != 0xFF)
 		return -ENODEV;
-	if (interface->bInterfaceSubClass != 0x00)
+	if (idesc->bInterfaceSubClass != 0x00)
 		return -ENODEV;
 
 	if ((ov = kmalloc(sizeof(*ov), GFP_KERNEL)) == NULL) {
@@ -6128,7 +6118,7 @@
 	memset(ov, 0, sizeof(*ov));
 
 	ov->dev = dev;
-	ov->iface = interface->bInterfaceNumber;
+	ov->iface = idesc->bInterfaceNumber;
 	ov->led_policy = led;
 	ov->compress = compress;
 	ov->lightfreq = lightfreq;
@@ -6272,7 +6262,7 @@
 
 error_out:
 	err("Camera initialization failed");
-	return -ENOMEM;
+	return -EIO;
 }
 
 static void
@@ -6284,6 +6274,7 @@
 	PDEBUG(3, "");
 
 	usb_set_intfdata (intf, NULL);
+
 	if (!ov)
 		return;
 
@@ -6298,10 +6289,9 @@
 
 	/* This will cause the process to request another frame */
 	for (n = 0; n < OV511_NUMFRAMES; n++)
-		if (waitqueue_active(&ov->frame[n].wq))
-			wake_up_interruptible(&ov->frame[n].wq);
-	if (waitqueue_active(&ov->wq))
-		wake_up_interruptible(&ov->wq);
+		wake_up_interruptible(&ov->frame[n].wq);
+
+	wake_up_interruptible(&ov->wq);
 
 	ov->streaming = 0;
 	ov51x_unlink_isoc(ov);
@@ -6317,7 +6307,7 @@
 		ov->cbuf = NULL;
 		up(&ov->cbuf_lock);
 
-		ov51x_dealloc(ov, 1);
+		ov51x_dealloc(ov);
 		kfree(ov);
 		ov = NULL;
 	}
@@ -6332,7 +6322,6 @@
 	.probe =	ov51x_probe,
 	.disconnect =	ov51x_disconnect
 };
-
 
 /****************************************************************************
  *
diff -Nru a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
--- a/drivers/usb/misc/Kconfig	Sun Feb 23 22:25:26 2003
+++ b/drivers/usb/misc/Kconfig	Sun Feb 23 22:25:26 2003
@@ -96,6 +96,15 @@
 config USB_SPEEDTOUCH
 	tristate "Alcatel Speedtouch ADSL USB Modem"
 	depends on USB && ATM
+	help
+	  Say Y here if you have an Alcatel SpeedTouch USB or SpeedTouch 330
+	  modem.  In order to use your modem you will need to install some user
+	  space tools, see <http://www.linux-usb.org/SpeedTouch/> for details.
+
+	  This code is also available as a module ( = code which can be
+	  inserted in and removed from the running kernel whenever you want).
+	  The module will be called speedtch. If you want to compile it as
+	  a module, say M here and read <file:Documentation/modules.txt>.
 
 config USB_TEST
 	tristate "USB testing driver (DEVELOPMENT)"
diff -Nru a/drivers/usb/misc/atmsar.c b/drivers/usb/misc/atmsar.c
--- a/drivers/usb/misc/atmsar.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/usb/misc/atmsar.c	Sun Feb 23 22:25:22 2003
@@ -71,6 +71,7 @@
  *
  */
 
+#include <linux/crc32.h>
 #include "atmsar.h"
 
 /***********************
@@ -113,200 +114,22 @@
   *dest++ = (unsigned char) (header >> 8); \
   *dest++ = (unsigned char) (header & 0xff);
 
-/*
- * CRC Routines from  net/wan/sbni.c)
- * table generated by Rocksoft^tm Model CRC Algorithm Table Generation Program V1.0
- */
-#define CRC32_REMAINDER CBF43926
-#define CRC32_INITIAL 0xffffffff
-#define CRC32(c,crc) (crc32tab[((size_t)(crc>>24) ^ (c)) & 0xff] ^ (((crc) << 8)))
-unsigned long crc32tab[256] = {
-	0x00000000L, 0x04C11DB7L, 0x09823B6EL, 0x0D4326D9L,
-	0x130476DCL, 0x17C56B6BL, 0x1A864DB2L, 0x1E475005L,
-	0x2608EDB8L, 0x22C9F00FL, 0x2F8AD6D6L, 0x2B4BCB61L,
-	0x350C9B64L, 0x31CD86D3L, 0x3C8EA00AL, 0x384FBDBDL,
-	0x4C11DB70L, 0x48D0C6C7L, 0x4593E01EL, 0x4152FDA9L,
-	0x5F15ADACL, 0x5BD4B01BL, 0x569796C2L, 0x52568B75L,
-	0x6A1936C8L, 0x6ED82B7FL, 0x639B0DA6L, 0x675A1011L,
-	0x791D4014L, 0x7DDC5DA3L, 0x709F7B7AL, 0x745E66CDL,
-	0x9823B6E0L, 0x9CE2AB57L, 0x91A18D8EL, 0x95609039L,
-	0x8B27C03CL, 0x8FE6DD8BL, 0x82A5FB52L, 0x8664E6E5L,
-	0xBE2B5B58L, 0xBAEA46EFL, 0xB7A96036L, 0xB3687D81L,
-	0xAD2F2D84L, 0xA9EE3033L, 0xA4AD16EAL, 0xA06C0B5DL,
-	0xD4326D90L, 0xD0F37027L, 0xDDB056FEL, 0xD9714B49L,
-	0xC7361B4CL, 0xC3F706FBL, 0xCEB42022L, 0xCA753D95L,
-	0xF23A8028L, 0xF6FB9D9FL, 0xFBB8BB46L, 0xFF79A6F1L,
-	0xE13EF6F4L, 0xE5FFEB43L, 0xE8BCCD9AL, 0xEC7DD02DL,
-	0x34867077L, 0x30476DC0L, 0x3D044B19L, 0x39C556AEL,
-	0x278206ABL, 0x23431B1CL, 0x2E003DC5L, 0x2AC12072L,
-	0x128E9DCFL, 0x164F8078L, 0x1B0CA6A1L, 0x1FCDBB16L,
-	0x018AEB13L, 0x054BF6A4L, 0x0808D07DL, 0x0CC9CDCAL,
-	0x7897AB07L, 0x7C56B6B0L, 0x71159069L, 0x75D48DDEL,
-	0x6B93DDDBL, 0x6F52C06CL, 0x6211E6B5L, 0x66D0FB02L,
-	0x5E9F46BFL, 0x5A5E5B08L, 0x571D7DD1L, 0x53DC6066L,
-	0x4D9B3063L, 0x495A2DD4L, 0x44190B0DL, 0x40D816BAL,
-	0xACA5C697L, 0xA864DB20L, 0xA527FDF9L, 0xA1E6E04EL,
-	0xBFA1B04BL, 0xBB60ADFCL, 0xB6238B25L, 0xB2E29692L,
-	0x8AAD2B2FL, 0x8E6C3698L, 0x832F1041L, 0x87EE0DF6L,
-	0x99A95DF3L, 0x9D684044L, 0x902B669DL, 0x94EA7B2AL,
-	0xE0B41DE7L, 0xE4750050L, 0xE9362689L, 0xEDF73B3EL,
-	0xF3B06B3BL, 0xF771768CL, 0xFA325055L, 0xFEF34DE2L,
-	0xC6BCF05FL, 0xC27DEDE8L, 0xCF3ECB31L, 0xCBFFD686L,
-	0xD5B88683L, 0xD1799B34L, 0xDC3ABDEDL, 0xD8FBA05AL,
-	0x690CE0EEL, 0x6DCDFD59L, 0x608EDB80L, 0x644FC637L,
-	0x7A089632L, 0x7EC98B85L, 0x738AAD5CL, 0x774BB0EBL,
-	0x4F040D56L, 0x4BC510E1L, 0x46863638L, 0x42472B8FL,
-	0x5C007B8AL, 0x58C1663DL, 0x558240E4L, 0x51435D53L,
-	0x251D3B9EL, 0x21DC2629L, 0x2C9F00F0L, 0x285E1D47L,
-	0x36194D42L, 0x32D850F5L, 0x3F9B762CL, 0x3B5A6B9BL,
-	0x0315D626L, 0x07D4CB91L, 0x0A97ED48L, 0x0E56F0FFL,
-	0x1011A0FAL, 0x14D0BD4DL, 0x19939B94L, 0x1D528623L,
-	0xF12F560EL, 0xF5EE4BB9L, 0xF8AD6D60L, 0xFC6C70D7L,
-	0xE22B20D2L, 0xE6EA3D65L, 0xEBA91BBCL, 0xEF68060BL,
-	0xD727BBB6L, 0xD3E6A601L, 0xDEA580D8L, 0xDA649D6FL,
-	0xC423CD6AL, 0xC0E2D0DDL, 0xCDA1F604L, 0xC960EBB3L,
-	0xBD3E8D7EL, 0xB9FF90C9L, 0xB4BCB610L, 0xB07DABA7L,
-	0xAE3AFBA2L, 0xAAFBE615L, 0xA7B8C0CCL, 0xA379DD7BL,
-	0x9B3660C6L, 0x9FF77D71L, 0x92B45BA8L, 0x9675461FL,
-	0x8832161AL, 0x8CF30BADL, 0x81B02D74L, 0x857130C3L,
-	0x5D8A9099L, 0x594B8D2EL, 0x5408ABF7L, 0x50C9B640L,
-	0x4E8EE645L, 0x4A4FFBF2L, 0x470CDD2BL, 0x43CDC09CL,
-	0x7B827D21L, 0x7F436096L, 0x7200464FL, 0x76C15BF8L,
-	0x68860BFDL, 0x6C47164AL, 0x61043093L, 0x65C52D24L,
-	0x119B4BE9L, 0x155A565EL, 0x18197087L, 0x1CD86D30L,
-	0x029F3D35L, 0x065E2082L, 0x0B1D065BL, 0x0FDC1BECL,
-	0x3793A651L, 0x3352BBE6L, 0x3E119D3FL, 0x3AD08088L,
-	0x2497D08DL, 0x2056CD3AL, 0x2D15EBE3L, 0x29D4F654L,
-	0xC5A92679L, 0xC1683BCEL, 0xCC2B1D17L, 0xC8EA00A0L,
-	0xD6AD50A5L, 0xD26C4D12L, 0xDF2F6BCBL, 0xDBEE767CL,
-	0xE3A1CBC1L, 0xE760D676L, 0xEA23F0AFL, 0xEEE2ED18L,
-	0xF0A5BD1DL, 0xF464A0AAL, 0xF9278673L, 0xFDE69BC4L,
-	0x89B8FD09L, 0x8D79E0BEL, 0x803AC667L, 0x84FBDBD0L,
-	0x9ABC8BD5L, 0x9E7D9662L, 0x933EB0BBL, 0x97FFAD0CL,
-	0xAFB010B1L, 0xAB710D06L, 0xA6322BDFL, 0xA2F33668L,
-	0xBCB4666DL, 0xB8757BDAL, 0xB5365D03L, 0xB1F740B4L
-};
-
-#ifdef CRCASM
-
-unsigned long calc_crc (char *mem, int len, unsigned initial)
-{
-	unsigned crc, dummy_len;
-      __asm__ ("xorl %%eax,%%eax\n\t" "1:\n\t" "movl %%edx,%%eax\n\t" "shrl $16,%%eax\n\t" "lodsb\n\t" "xorb %%ah,%%al\n\t" "andl $255,%%eax\n\t" "shll $8,%%edx\n\t" "xorl (%%edi,%%eax,4),%%edx\n\t" "loop 1b":"=d" (crc),
-		 "=c"
-		 (dummy_len)
-      :	 "S" (mem), "D" (&crc32tab[0]), "1" (len), "0" (initial)
-      :	 "eax");
-	return crc;
-}
-
-#else
-
-unsigned long calc_crc (char *mem, int len, unsigned initial)
-{
-	unsigned crc;
-	crc = initial;
-
-	for (; len; mem++, len--) {
-		crc = CRC32 (*mem, crc);
-	}
-	return (crc);
-}
-#endif
-
-#define crc32( crc, mem, len) calc_crc(mem, len, crc);
-
-/* initialization routines. not used at the moment
- * I will avoid these as long as possible !!
- */
-
-int open_atmsar (void)
-{
-	return 0;
-}
-
-int remove_atmsar (void)
-{
-	return 0;
-}
-
-/* ATOMIC version of alloc_tx */
-struct sk_buff *atmsar_alloc_skb_wrapper (struct atm_vcc *vcc, unsigned int size)
-{
-	struct sk_buff *skb;
-
-	if (atomic_read (&vcc->tx_inuse) && !atm_may_send (vcc, size)) {
-		PDEBUG ("Sorry: tx_inuse = %d, size = %d, sndbuf = %d\n",
-			atomic_read (&vcc->tx_inuse), size, vcc->sk->sndbuf);
-		return NULL;
-	}
-	skb = alloc_skb (size, GFP_ATOMIC);
-	if (!skb)
-		return NULL;
-	atomic_add (skb->truesize + ATM_PDU_OVHD, &vcc->tx_inuse);
-	return skb;
-}
-
-struct sk_buff *atmsar_alloc_tx (struct atmsar_vcc_data *vcc, unsigned int size)
-{
-	struct sk_buff *tmp = NULL;
-	int bufsize = 0;
-
-	switch (vcc->type) {
-	case ATMSAR_TYPE_AAL0:
-		/* reserving adequate headroom */
-		bufsize =
-		    size + (((size / 48) + 1) * ((vcc->flags & ATMSAR_USE_53BYTE_CELL) ? 5 : 4));
-		break;
-	case ATMSAR_TYPE_AAL1:
-		/* reserving adequate headroom */
-		bufsize =
-		    size + (((size / 47) + 1) * ((vcc->flags & ATMSAR_USE_53BYTE_CELL) ? 5 : 4));
-		break;
-	case ATMSAR_TYPE_AAL2:
-	case ATMSAR_TYPE_AAL34:
-		/* not supported */
-		break;
-	case ATMSAR_TYPE_AAL5:
-		/* reserving adequate tailroom */
-		bufsize = size + (((size + 8 + 47) / 48) * 48);
-		break;
-	}
-
-	PDEBUG ("Requested size %d, Allocating size %d\n", size, bufsize);
-	tmp = vcc->alloc_tx (vcc->vcc, bufsize);
-	skb_put (tmp, bufsize);
-
-	return tmp;
-}
 
 struct atmsar_vcc_data *atmsar_open (struct atmsar_vcc_data **list, struct atm_vcc *vcc, uint type,
 				     ushort vpi, ushort vci, unchar pti, unchar gfc, uint flags)
 {
 	struct atmsar_vcc_data *new;
 
+	if (!vcc)
+		return NULL;
+
 	new = kmalloc (sizeof (struct atmsar_vcc_data), GFP_KERNEL);
 
 	if (!new)
 		return NULL;
 
-	if (!vcc)
-		return NULL;
-
 	memset (new, 0, sizeof (struct atmsar_vcc_data));
 	new->vcc = vcc;
-/*
- * This gives problems with the ATM layer alloc_tx().
- * It is not usable from interrupt context and for
- * some reason this is used in interrupt context
- * with br2684.c
- *
-  if (vcc->alloc_tx)
-    new->alloc_tx  = vcc->alloc_tx;
-  else
-*/
-	new->alloc_tx = atmsar_alloc_skb_wrapper;
-
 	new->stats = vcc->stats;
 	new->type = type;
 	new->next = NULL;
@@ -375,216 +198,6 @@
 	kfree (vcc);
 }
 
-/***********************
- **
- **    ENCODE FUNCTIONS
- **
- ***********************/
-
-/* encapsulate in an AAL5 frame, which is then split into ATM cells */
-unsigned int atmsar_encode (struct atmsar_vcc_data *ctx, char *source, char *target, unsigned int pdu_length)
-{
-	unsigned int num_cells = (pdu_length + ATM_AAL5_TRAILER + ATM_CELL_PAYLOAD - 1) / ATM_CELL_PAYLOAD;
-	unsigned int num_pdu_cells = pdu_length / ATM_CELL_PAYLOAD + 1;
-	unsigned int aal5_length = num_cells * ATM_CELL_PAYLOAD;
-	unsigned int zero_padding = aal5_length - pdu_length - ATM_AAL5_TRAILER;
-	unsigned int final_length = num_cells * ATM_CELL_SIZE;
-	unsigned char aal5_trailer [ATM_AAL5_TRAILER];
-	unsigned char cell_header [ATM_CELL_HEADER];
-	u32 crc;
-	int i;
-
-	PDEBUG ("atmsar_encode entered\n");
-
-	PDEBUG ("pdu_length %d, num_cells %d, num_pdu_cells %d, aal5_length %d, zero_padding %d, final_length %d\n", pdu_length, num_cells, num_pdu_cells, aal5_length, zero_padding, final_length);
-
-	PDEBUG ("source 0x=%p, target 0x%p\n", source, target);
-
-	aal5_trailer [0] = 0; /* UU = 0 */
-	aal5_trailer [1] = 0; /* CPI = 0 */
-	aal5_trailer [2] = pdu_length >> 8;
-	aal5_trailer [3] = pdu_length;
-
-	crc = crc32 (~0, source, pdu_length);
-	for (i = 0; i < zero_padding; i++)
-		crc = CRC32 (0, crc);
-	crc = crc32 (crc, aal5_trailer, 4);
-	crc = ~crc;
-
-	aal5_trailer [4] = crc >> 24;
-	aal5_trailer [5] = crc >> 16;
-	aal5_trailer [6] = crc >> 8;
-	aal5_trailer [7] = crc;
-
-	cell_header [0] = ctx->atmHeader >> 24;
-	cell_header [1] = ctx->atmHeader >> 16;
-	cell_header [2] = ctx->atmHeader >> 8;
-	cell_header [3] = ctx->atmHeader;
-	cell_header [4] = 0xec;
-
-	for (i = 1; i < num_pdu_cells; i++) {
-		memcpy (target, cell_header, ATM_CELL_HEADER);
-		target += ATM_CELL_HEADER;
-		memcpy (target, source, ATM_CELL_PAYLOAD);
-		target += ATM_CELL_PAYLOAD;
-		source += ATM_CELL_PAYLOAD;
-		PDEBUG ("source 0x=%p, target 0x%p\n", source, target);
-	}
-	memcpy (target, cell_header, ATM_CELL_HEADER);
-	target += ATM_CELL_HEADER;
-	memcpy (target, source, pdu_length % ATM_CELL_PAYLOAD);
-	target += pdu_length % ATM_CELL_PAYLOAD;
-	if (num_pdu_cells < num_cells) {
-		memset (target, 0, zero_padding + ATM_AAL5_TRAILER - ATM_CELL_PAYLOAD);
-		target += zero_padding + ATM_AAL5_TRAILER - ATM_CELL_PAYLOAD;
-		memcpy (target, cell_header, ATM_CELL_HEADER);
-		target += ATM_CELL_HEADER;
-		zero_padding = ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER;
-	}
-	memset (target, 0, zero_padding);
-	target += zero_padding;
-	memcpy (target, aal5_trailer, ATM_AAL5_TRAILER);
-
-	/* set pti bit in last cell */
-	*(target + ATM_AAL5_TRAILER + 3 - ATM_CELL_SIZE) |= 0x2;
-
-	/* update stats */
-	if (ctx->stats)
-		atomic_inc (&ctx->stats->tx);
-
-	if (ctx->stats && (ctx->type <= ATMSAR_TYPE_AAL1))
-		atomic_add (num_cells, &(ctx->stats->tx));
-
-	return final_length;
-}
-
-struct sk_buff *atmsar_encode_rawcell (struct atmsar_vcc_data *ctx, struct sk_buff *skb)
-{
-	int number_of_cells = (skb->len) / 48;
-	int total_length = number_of_cells * (ctx->flags & ATMSAR_USE_53BYTE_CELL ? 53 : 52);
-	unsigned char *source;
-	unsigned char *target;
-	struct sk_buff *out = NULL;
-	int i;
-
-	PDEBUG ("atmsar_encode_rawcell (0x%p, 0x%p) called\n", ctx, skb);
-
-	if (skb_cloned (skb)
-	    || (skb_headroom (skb) <
-		(number_of_cells * (ctx->flags & ATMSAR_USE_53BYTE_CELL ? 5 : 4)))) {
-		PDEBUG
-		    ("atmsar_encode_rawcell allocating new skb. ctx->alloc_tx = 0x%p, ctx->vcc = 0x%p\n",
-		     ctx->alloc_tx, ctx->vcc);
-		/* get new skb */
-		out = ctx->alloc_tx (ctx->vcc, total_length);
-		if (!out)
-			return NULL;
-
-		skb_put (out, total_length);
-		source = skb->data;
-		target = out->data;
-	} else {
-		PDEBUG ("atmsar_encode_rawcell: sufficient headroom\n");
-		source = skb->data;
-		skb_push (skb, number_of_cells * ((ctx->flags & ATMSAR_USE_53BYTE_CELL) ? 5 : 4));
-		target = skb->data;
-		out = skb;
-	}
-
-	PDEBUG ("source 0x=%p, target 0x%p\n", source, target);
-
-	if (ctx->flags & ATMSAR_USE_53BYTE_CELL) {
-		for (i = 0; i < number_of_cells; i++) {
-			ADD_HEADER (target, ctx->atmHeader);
-			*target++ = (char) 0xEC;
-			memcpy (target, source, 48);
-			target += 48;
-			source += 48;
-			PDEBUG ("source 0x=%p, target 0x%p\n", source, target);
-		}
-	} else {
-		for (i = 0; i < number_of_cells; i++) {
-			ADD_HEADER (target, ctx->atmHeader);
-			memcpy (target, source, 48);
-			target += 48;
-			source += 48;
-			PDEBUG ("source 0x=%p, target 0x%p\n", source, target);
-		};
-	}
-
-	if (ctx->flags & ATMSAR_SET_PTI) {
-		/* setting pti bit in last cell */
-		*(target - (ctx->flags & ATMSAR_USE_53BYTE_CELL ? 50 : 49)) |= 0x2;
-	}
-
-	/* update stats */
-	if (ctx->stats && (ctx->type <= ATMSAR_TYPE_AAL1))
-		atomic_add (number_of_cells, &(ctx->stats->tx));
-
-	PDEBUG ("atmsar_encode_rawcell return 0x%p (length %d)\n", out, out->len);
-	return out;
-}
-
-struct sk_buff *atmsar_encode_aal5 (struct atmsar_vcc_data *ctx, struct sk_buff *skb)
-{
-	int length, pdu_length;
-	unsigned char *trailer;
-	unsigned char *pad;
-	uint crc = 0xffffffff;
-
-	PDEBUG ("atmsar_encode_aal5 (0x%p, 0x%p) called\n", ctx, skb);
-
-	/* determine aal5 length */
-	pdu_length = skb->len;
-	length = ((pdu_length + 8 + 47) / 48) * 48;
-
-	if (skb_tailroom (skb) < (length - pdu_length)) {
-		struct sk_buff *out;
-		PDEBUG
-		    ("atmsar_encode_aal5 allocating new skb. ctx->alloc_tx = 0x%p, ctx->vcc = 0x%p\n",
-		     ctx->alloc_tx, ctx->vcc);
-		/* get new skb */
-		out = ctx->alloc_tx (ctx->vcc, length);
-		if (!out)
-			return NULL;
-
-		PDEBUG ("out->data = 0x%p\n", out->data);
-		PDEBUG ("atmsar_encode_aal5 pdu length %d, allocated length %d\n", skb->len,
-			length);
-		memcpy (out->data, skb->data, skb->len);
-		skb_put (out, skb->len);
-
-		skb = out;
-	}
-
-	PDEBUG ("skb->data = 0x%p\n", skb->data);
-	/* note end of pdu and add length */
-	pad = skb_put (skb, length - pdu_length);
-	trailer = skb->tail - 8;
-
-	PDEBUG ("trailer = 0x%p\n", trailer);
-
-	/* zero padding space */
-	memset (pad, 0, length - pdu_length - 8);
-
-	/* add trailer */
-	*trailer++ = (unsigned char) 0;	/* UU  = 0 */
-	*trailer++ = (unsigned char) 0;	/* CPI = 0 */
-	*trailer++ = (unsigned char) (pdu_length >> 8);
-	*trailer++ = (unsigned char) (pdu_length & 0xff);
-	crc = ~crc32 (crc, skb->data, length - 4);
-	*trailer++ = (unsigned char) (crc >> 24);
-	*trailer++ = (unsigned char) (crc >> 16);
-	*trailer++ = (unsigned char) (crc >> 8);
-	*trailer++ = (unsigned char) (crc & 0xff);
-
-	/* update stats */
-	if (ctx->stats)
-		atomic_inc (&ctx->stats->tx);
-
-	PDEBUG ("atmsar_encode_aal5 return 0x%p (length %d)\n", skb, skb->len);
-	return skb;
-}
 
 /***********************
  **
@@ -745,7 +358,7 @@
 		skb_pull (skb, skb->len - pdu_length);
 	}
 
-	crc = ~crc32 (crc, skb->data, pdu_length - 4);
+	crc = ~crc32_be (crc, skb->data, pdu_length - 4);
 
 	/* check crc */
 	if (pdu_crc != crc) {
diff -Nru a/drivers/usb/misc/atmsar.h b/drivers/usb/misc/atmsar.h
--- a/drivers/usb/misc/atmsar.h	Sun Feb 23 22:25:24 2003
+++ b/drivers/usb/misc/atmsar.h	Sun Feb 23 22:25:24 2003
@@ -58,7 +58,6 @@
 	int type;
 
 	/* connection specific non-atmsar data */
-	struct sk_buff *(*alloc_tx) (struct atm_vcc * vcc, unsigned int size);
 	struct atm_vcc *vcc;
 	struct k_atm_aal_stats *stats;
 	unsigned short mtu;	/* max is actually  65k for AAL5... */
@@ -81,15 +80,8 @@
 					    unchar gfc, uint flags);
 extern void atmsar_close (struct atmsar_vcc_data **list, struct atmsar_vcc_data *vcc);
 
-extern struct sk_buff *atmsar_encode_rawcell (struct atmsar_vcc_data *ctx, struct sk_buff *skb);
-extern struct sk_buff *atmsar_encode_aal5 (struct atmsar_vcc_data *ctx, struct sk_buff *skb);
-
 struct sk_buff *atmsar_decode_rawcell (struct atmsar_vcc_data *list, struct sk_buff *skb,
 				       struct atmsar_vcc_data **ctx);
 struct sk_buff *atmsar_decode_aal5 (struct atmsar_vcc_data *ctx, struct sk_buff *skb);
-
-struct sk_buff *atmsar_alloc_tx (struct atmsar_vcc_data *vcc, unsigned int size);
-
-unsigned int atmsar_encode (struct atmsar_vcc_data *ctx, char *source, char *target, unsigned int pdu_length);
 
 #endif				/* _ATMSAR_H_ */
diff -Nru a/drivers/usb/misc/speedtouch.c b/drivers/usb/misc/speedtouch.c
--- a/drivers/usb/misc/speedtouch.c	Sun Feb 23 22:25:27 2003
+++ b/drivers/usb/misc/speedtouch.c	Sun Feb 23 22:25:27 2003
@@ -61,6 +61,7 @@
 #include <linux/interrupt.h>
 #include <linux/atm.h>
 #include <linux/atmdev.h>
+#include <linux/crc32.h>
 #include "atmsar.h"
 
 /*
@@ -69,14 +70,15 @@
 */
 
 #ifdef DEBUG
-#define PDEBUG(arg...)  printk(KERN_DEBUG "SpeedTouch USB: " arg)
+#define PDEBUG(arg...)  printk(KERN_DEBUG __FILE__ ": " arg)
 #else
 #define PDEBUG(arg...)
 #endif
 
 
 #ifdef DEBUG_PACKET
-#define PACKETDEBUG(arg...) udsl_print_packet ( arg )
+static int udsl_print_packet (const unsigned char *data, int len);
+#define PACKETDEBUG(arg...) udsl_print_packet (arg)
 #else
 #define PACKETDEBUG(arg...)
 #endif
@@ -88,15 +90,14 @@
 #define SPEEDTOUCH_VENDORID		0x06b9
 #define SPEEDTOUCH_PRODUCTID		0x4061
 
-#define UDSL_OBUF_SIZE			32768
-#define UDSL_MINOR			48
 #define UDSL_NUMBER_RCV_URBS		1
 #define UDSL_NUMBER_SND_URBS		1
-#define UDSL_RECEIVE_BUFFER_SIZE	64*53
+#define UDSL_NUMBER_SND_BUFS		(2*UDSL_NUMBER_SND_URBS)
+#define UDSL_RCV_BUFFER_SIZE		(1*64) /* ATM cells */
+#define UDSL_SND_BUFFER_SIZE		(1*64) /* ATM cells */
 /* max should be (1500 IP mtu + 2 ppp bytes + 32 * 5 cellheader overhead) for
  * PPPoA and (1500 + 14 + 32*5 cellheader overhead) for PPPoE */
 #define UDSL_MAX_AAL5_MRU		2048
-#define UDSL_SEND_CONTEXTS		8
 
 #define UDSL_IOCTL_START		1
 #define UDSL_IOCTL_STOP			2
@@ -126,13 +127,31 @@
 	struct udsl_instance_data *instance;
 };
 
-struct udsl_usb_send_data_context {
+struct udsl_send_buffer {
+	struct list_head list;
+	unsigned char *base;
+	unsigned char *free_start;
+	unsigned int free_cells;
+};
+
+struct udsl_sender {
+	struct list_head list;
+	struct udsl_send_buffer *buffer;
 	struct urb *urb;
-	struct sk_buff *skb;
-	struct atm_vcc *vcc;
 	struct udsl_instance_data *instance;
 };
 
+struct udsl_control {
+	struct atm_skb_data atm_data;
+	unsigned int num_cells;
+	unsigned int num_entire;
+	unsigned char cell_header [ATM_CELL_HEADER];
+	unsigned int pdu_padding;
+	unsigned char aal5_trailer [ATM_AAL5_TRAILER];
+};
+
+#define UDSL_SKB(x)		((struct udsl_control *)(x)->cb)
+
 /*
  * UDSL main driver data
  */
@@ -142,13 +161,10 @@
 
 	/* usb device part */
 	struct usb_device *usb_dev;
-	struct sk_buff_head sndqueue;
-	struct udsl_usb_send_data_context send_ctx [UDSL_NUMBER_SND_URBS];
 	int firmware_loaded;
 
 	/* atm device part */
 	struct atm_dev *atm_dev;
-
 	struct atmsar_vcc_data *atmsar_vcc_list;
 
 	/* receiving */
@@ -161,18 +177,30 @@
 	struct list_head completed_receivers;
 
 	struct tasklet_struct receive_tasklet;
-};
 
-static const char udsl_driver_name [] = "Alcatel SpeedTouch USB";
+	/* sending */
+	struct udsl_sender all_senders [UDSL_NUMBER_SND_URBS];
+	struct udsl_send_buffer all_buffers [UDSL_NUMBER_SND_BUFS];
 
-#ifdef DEBUG_PACKET
-static int udsl_print_packet (const unsigned char *data, int len);
-#endif
+	struct sk_buff_head sndqueue;
+
+	spinlock_t send_lock;
+	struct list_head spare_senders;
+	struct list_head spare_buffers;
+
+	struct tasklet_struct send_tasklet;
+	struct sk_buff *current_skb;			/* being emptied */
+	struct udsl_send_buffer *current_buffer;	/* being filled */
+	struct list_head filled_buffers;
+};
+
+static const char udsl_driver_name [] = "speedtch";
 
 /*
  * atm driver prototypes and stuctures
  */
 
+static void udsl_atm_dev_close (struct atm_dev *dev);
 static int udsl_atm_open (struct atm_vcc *vcc, short vpi, int vci);
 static void udsl_atm_close (struct atm_vcc *vcc);
 static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void *arg);
@@ -180,6 +208,7 @@
 static int udsl_atm_proc_read (struct atm_dev *atm_dev, loff_t *pos, char *page);
 
 static struct atmdev_ops udsl_atm_devops = {
+	.dev_close =	udsl_atm_dev_close,
 	.open =		udsl_atm_open,
 	.close =	udsl_atm_close,
 	.ioctl =	udsl_atm_ioctl,
@@ -187,20 +216,13 @@
 	.proc_read =	udsl_atm_proc_read,
 };
 
-struct udsl_atm_dev_data {
-	struct atmsar_vcc_data *atmsar_vcc;
-};
-
 /*
  * usb driver prototypes and structures
  */
 static int udsl_usb_probe (struct usb_interface *intf,
 			   const struct usb_device_id *id);
 static void udsl_usb_disconnect (struct usb_interface *intf);
-static int udsl_usb_send_data (struct udsl_instance_data *instance, struct atm_vcc *vcc,
-			struct sk_buff *skb);
 static int udsl_usb_ioctl (struct usb_interface *intf, unsigned int code, void *user_data);
-static int udsl_usb_cancelsends (struct udsl_instance_data *instance, struct atm_vcc *vcc);
 
 static struct usb_driver udsl_usb_driver = {
 	.name =		udsl_driver_name,
@@ -211,6 +233,86 @@
 };
 
 
+/*************
+**  encode  **
+*************/
+
+static void udsl_groom_skb (struct atm_vcc *vcc, struct sk_buff *skb) {
+	struct udsl_control *ctrl = UDSL_SKB (skb);
+	unsigned int i, zero_padding;
+	unsigned char zero = 0;
+	u32 crc;
+
+	ctrl->atm_data.vcc = vcc;
+	ctrl->cell_header [0] = vcc->vpi >> 4;
+	ctrl->cell_header [1] = (vcc->vpi << 4) | (vcc->vci >> 12);
+	ctrl->cell_header [2] = vcc->vci >> 4;
+	ctrl->cell_header [3] = vcc->vci << 4;
+	ctrl->cell_header [4] = 0xec;
+
+	ctrl->num_cells = (skb->len + ATM_AAL5_TRAILER + ATM_CELL_PAYLOAD - 1) / ATM_CELL_PAYLOAD;
+	ctrl->num_entire = skb->len / ATM_CELL_PAYLOAD;
+
+	zero_padding = ctrl->num_cells * ATM_CELL_PAYLOAD - skb->len - ATM_AAL5_TRAILER;
+
+	if (ctrl->num_entire + 1 < ctrl->num_cells)
+		ctrl->pdu_padding = zero_padding - (ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER);
+	else
+		ctrl->pdu_padding = zero_padding;
+
+	ctrl->aal5_trailer [0] = 0; /* UU = 0 */
+	ctrl->aal5_trailer [1] = 0; /* CPI = 0 */
+	ctrl->aal5_trailer [2] = skb->len >> 8;
+	ctrl->aal5_trailer [3] = skb->len;
+
+	crc = crc32_be (~0, skb->data, skb->len);
+	for (i = 0; i < zero_padding; i++)
+		crc = crc32_be (crc, &zero, 1);
+	crc = crc32_be (crc, ctrl->aal5_trailer, 4);
+	crc = ~crc;
+
+	ctrl->aal5_trailer [4] = crc >> 24;
+	ctrl->aal5_trailer [5] = crc >> 16;
+	ctrl->aal5_trailer [6] = crc >> 8;
+	ctrl->aal5_trailer [7] = crc;
+}
+
+static char *udsl_write_cell (struct sk_buff *skb, char *target) {
+	struct udsl_control *ctrl = UDSL_SKB (skb);
+
+	ctrl->num_cells--;
+
+	memcpy (target, ctrl->cell_header, ATM_CELL_HEADER);
+	target += ATM_CELL_HEADER;
+
+	if (ctrl->num_entire) {
+		ctrl->num_entire--;
+		memcpy (target, skb->data, ATM_CELL_PAYLOAD);
+		target += ATM_CELL_PAYLOAD;
+		__skb_pull (skb, ATM_CELL_PAYLOAD);
+		return target;
+	}
+
+	memcpy (target, skb->data, skb->len);
+	target += skb->len;
+	__skb_pull (skb, skb->len);
+
+	memset (target, 0, ctrl->pdu_padding);
+	target += ctrl->pdu_padding;
+
+	if (ctrl->num_cells) {
+		ctrl->pdu_padding = ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER;
+	} else {
+		memcpy (target, ctrl->aal5_trailer, ATM_AAL5_TRAILER);
+		target += ATM_AAL5_TRAILER;
+		/* set pti bit in last cell */
+		*(target + 3 - ATM_CELL_SIZE) |= 0x2;
+	}
+
+	return target;
+}
+
+
 /**************
 **  receive  **
 **************/
@@ -221,19 +323,18 @@
 	struct udsl_receiver *rcv;
 	unsigned long flags;
 
-	PDEBUG ("udsl_complete_receive entered\n");
-
 	if (!urb || !(rcv = urb->context) || !(instance = rcv->instance)) {
 		PDEBUG ("udsl_complete_receive: bad urb!\n");
 		return;
 	}
 
+	PDEBUG ("udsl_complete_receive entered (urb 0x%p, status %d)\n", urb, urb->status);
+
+	tasklet_schedule (&instance->receive_tasklet);
 	/* may not be in_interrupt() */
 	spin_lock_irqsave (&instance->completed_receivers_lock, flags);
 	list_add_tail (&rcv->list, &instance->completed_receivers);
 	spin_unlock_irqrestore (&instance->completed_receivers_lock, flags);
-	PDEBUG ("udsl_complete_receive: scheduling tasklet\n");
-	tasklet_schedule (&instance->receive_tasklet);
 }
 
 static void udsl_process_receive (unsigned long data)
@@ -246,6 +347,7 @@
 	struct urb *urb;
 	struct atmsar_vcc_data *atmsar_vcc = NULL;
 	struct sk_buff *new = NULL, *tmp = NULL;
+	int err;
 
 	PDEBUG ("udsl_process_receive entered\n");
 
@@ -315,12 +417,12 @@
 					   instance->usb_dev,
 					   usb_rcvbulkpipe (instance->usb_dev, UDSL_ENDPOINT_DATA_IN),
 					   (unsigned char *) rcv->skb->data,
-					   UDSL_RECEIVE_BUFFER_SIZE,
+					   UDSL_RCV_BUFFER_SIZE * ATM_CELL_SIZE,
 					   udsl_complete_receive,
 					   rcv);
-			if (!usb_submit_urb (urb, GFP_ATOMIC))
+			if (!(err = usb_submit_urb (urb, GFP_ATOMIC)))
 				break;
-			PDEBUG ("udsl_process_receive: submission failed\n");
+			PDEBUG ("udsl_process_receive: submission failed (%d)\n", err);
 			/* fall through */
 		default: /* error or urb unlinked */
 			PDEBUG ("udsl_process_receive: adding to spare_receivers\n");
@@ -358,7 +460,7 @@
 				   instance->usb_dev,
 				   usb_rcvbulkpipe (instance->usb_dev, UDSL_ENDPOINT_DATA_IN),
 				   (unsigned char *) rcv->skb->data,
-				   UDSL_RECEIVE_BUFFER_SIZE,
+				   UDSL_RCV_BUFFER_SIZE * ATM_CELL_SIZE,
 				   udsl_complete_receive,
 				   rcv);
 
@@ -374,6 +476,210 @@
 }
 
 
+/***********
+**  send  **
+***********/
+
+static void udsl_complete_send (struct urb *urb, struct pt_regs *regs)
+{
+	struct udsl_instance_data *instance;
+	struct udsl_sender *snd;
+	unsigned long flags;
+
+	if (!urb || !(snd = urb->context) || !(instance = snd->instance)) {
+		PDEBUG ("udsl_complete_send: bad urb!\n");
+		return;
+	}
+
+	PDEBUG ("udsl_complete_send entered (urb 0x%p, status %d)\n", urb, urb->status);
+
+	tasklet_schedule (&instance->send_tasklet);
+	/* may not be in_interrupt() */
+	spin_lock_irqsave (&instance->send_lock, flags);
+	list_add (&snd->list, &instance->spare_senders);
+	list_add (&snd->buffer->list, &instance->spare_buffers);
+	spin_unlock_irqrestore (&instance->send_lock, flags);
+}
+
+static void udsl_process_send (unsigned long data)
+{
+	struct udsl_send_buffer *buf;
+	unsigned int cells_to_write;
+	int err;
+	unsigned long flags;
+	unsigned int i;
+	struct udsl_instance_data *instance = (struct udsl_instance_data *) data;
+	struct sk_buff *skb;
+	struct udsl_sender *snd;
+	unsigned char *target;
+
+	PDEBUG ("udsl_process_send entered\n");
+
+made_progress:
+	spin_lock_irqsave (&instance->send_lock, flags);
+	while (!list_empty (&instance->spare_senders)) {
+		if (!list_empty (&instance->filled_buffers)) {
+			buf = list_entry (instance->filled_buffers.next, struct udsl_send_buffer, list);
+			list_del (&buf->list);
+			PDEBUG ("sending filled buffer (0x%p)\n", buf);
+		} else if ((buf = instance->current_buffer)) {
+			instance->current_buffer = NULL;
+			PDEBUG ("sending current buffer (0x%p)\n", buf);
+		} else /* all buffers empty */
+			break;
+
+		snd = list_entry (instance->spare_senders.next, struct udsl_sender, list);
+		list_del (&snd->list);
+		spin_unlock_irqrestore (&instance->send_lock, flags);
+
+		snd->buffer = buf;
+	        usb_fill_bulk_urb (snd->urb,
+				   instance->usb_dev,
+				   usb_sndbulkpipe (instance->usb_dev, UDSL_ENDPOINT_DATA_OUT),
+				   buf->base,
+				   (UDSL_SND_BUFFER_SIZE - buf->free_cells) * ATM_CELL_SIZE,
+				   udsl_complete_send,
+				   snd);
+
+		PDEBUG ("submitting urb 0x%p, contains %d cells\n", snd->urb, UDSL_SND_BUFFER_SIZE - buf->free_cells);
+
+		if ((err = usb_submit_urb(snd->urb, GFP_ATOMIC)) < 0) {
+			PDEBUG ("submission failed (%d)!\n", err);
+			spin_lock_irqsave (&instance->send_lock, flags);
+			list_add (&snd->list, &instance->spare_senders);
+			spin_unlock_irqrestore (&instance->send_lock, flags);
+			list_add (&buf->list, &instance->filled_buffers);
+			return;
+		}
+
+		spin_lock_irqsave (&instance->send_lock, flags);
+	} /* while */
+	spin_unlock_irqrestore (&instance->send_lock, flags);
+
+	if (!instance->current_skb && !(instance->current_skb = skb_dequeue (&instance->sndqueue))) {
+		PDEBUG ("done - no more skbs\n");
+		return;
+	}
+
+	skb = instance->current_skb;
+
+	if (!(buf = instance->current_buffer)) {
+		spin_lock_irqsave (&instance->send_lock, flags);
+		if (list_empty (&instance->spare_buffers)) {
+			instance->current_buffer = NULL;
+			spin_unlock_irqrestore (&instance->send_lock, flags);
+			PDEBUG ("done - no more buffers\n");
+			return;
+		}
+		buf = list_entry (instance->spare_buffers.next, struct udsl_send_buffer, list);
+		list_del (&buf->list);
+		spin_unlock_irqrestore (&instance->send_lock, flags);
+
+		buf->free_start = buf->base;
+		buf->free_cells = UDSL_SND_BUFFER_SIZE;
+
+		instance->current_buffer = buf;
+	}
+
+	cells_to_write = min (buf->free_cells, UDSL_SKB (skb)->num_cells);
+	target = buf->free_start;
+
+	PDEBUG ("writing %u cells from skb 0x%p to buffer 0x%p\n", cells_to_write, skb, buf);
+
+	for (i = 0; i < cells_to_write; i++)
+		target = udsl_write_cell (skb, target);
+
+	buf->free_start = target;
+	if (!(buf->free_cells -= cells_to_write)) {
+		list_add_tail (&buf->list, &instance->filled_buffers);
+		instance->current_buffer = NULL;
+		PDEBUG ("queued filled buffer\n");
+	}
+
+	PDEBUG ("buffer contains %d cells, %d left\n", UDSL_SND_BUFFER_SIZE - buf->free_cells, buf->free_cells);
+
+	if (!UDSL_SKB (skb)->num_cells) {
+		struct atm_vcc *vcc = UDSL_SKB (skb)->atm_data.vcc;
+
+		PDEBUG ("discarding empty skb\n");
+		if (vcc->pop)
+			vcc->pop (vcc, skb);
+		else
+			kfree_skb (skb);
+		instance->current_skb = NULL;
+
+		if (vcc->stats)
+			atomic_inc (&vcc->stats->tx);
+	}
+
+	goto made_progress;
+}
+
+static void udsl_cancel_send (struct udsl_instance_data *instance, struct atm_vcc *vcc)
+{
+	unsigned long flags;
+	struct sk_buff *skb, *n;
+
+	PDEBUG ("udsl_cancel_send entered\n");
+	spin_lock_irqsave (&instance->sndqueue.lock, flags);
+	for (skb = instance->sndqueue.next, n = skb->next; skb != (struct sk_buff *)&instance->sndqueue; skb = n, n = skb->next)
+		if (UDSL_SKB (skb)->atm_data.vcc == vcc) {
+			PDEBUG ("popping skb 0x%p\n", skb);
+			__skb_unlink (skb, &instance->sndqueue);
+			if (vcc->pop)
+				vcc->pop (vcc, skb);
+			else
+				kfree_skb (skb);
+		}
+	spin_unlock_irqrestore (&instance->sndqueue.lock, flags);
+
+	tasklet_disable (&instance->send_tasklet);
+	if ((skb = instance->current_skb) && (UDSL_SKB (skb)->atm_data.vcc == vcc)) {
+		PDEBUG ("popping current skb (0x%p)\n", skb);
+		instance->current_skb = NULL;
+		if (vcc->pop)
+			vcc->pop (vcc, skb);
+		else
+			kfree_skb (skb);
+	}
+	tasklet_enable (&instance->send_tasklet);
+	PDEBUG ("udsl_cancel_send done\n");
+}
+
+static int udsl_atm_send (struct atm_vcc *vcc, struct sk_buff *skb)
+{
+	struct udsl_instance_data *instance = vcc->dev->dev_data;
+
+	PDEBUG ("udsl_atm_send called (skb 0x%p, len %u)\n", skb, skb->len);
+
+	if (!instance) {
+		PDEBUG ("NULL instance!\n");
+		return -EINVAL;
+	}
+
+	if (!instance->firmware_loaded)
+		return -EAGAIN;
+
+	if (vcc->qos.aal != ATM_AAL5) {
+		PDEBUG ("unsupported ATM type %d!\n", vcc->qos.aal);
+		return -EINVAL;
+	}
+
+	if (skb->len > ATM_MAX_AAL5_PDU) {
+		PDEBUG ("packet too long (%d vs %d)!\n", skb->len, ATM_MAX_AAL5_PDU);
+		return -EINVAL;
+	}
+
+	PACKETDEBUG (skb->data, skb->len);
+
+	udsl_groom_skb (vcc, skb);
+	skb_queue_tail (&instance->sndqueue, skb);
+	tasklet_schedule (&instance->send_tasklet);
+
+	return 0;
+}
+
+
 /************
 **   ATM   **
 ************/
@@ -384,24 +690,21 @@
 *
 ****************************************************************************/
 
-static void udsl_atm_stopdevice (struct udsl_instance_data *instance)
+static void udsl_atm_dev_close (struct atm_dev *dev)
 {
-	struct atm_vcc *walk;
-	struct atm_dev *atm_dev;
+	struct udsl_instance_data *instance = dev->dev_data;
 
-	if (!instance->atm_dev)
+	if (!instance) {
+		PDEBUG ("udsl_atm_dev_close: NULL instance!\n");
 		return;
+	}
 
-	atm_dev = instance->atm_dev;
-
-	atm_dev->signal = ATM_PHY_SIG_LOST;
-	walk = atm_dev->vccs;
-	shutdown_atm_dev (atm_dev);
-
-	for (; walk; walk = walk->next)
-		wake_up (&walk->sleep);
+	PDEBUG ("udsl_atm_dev_close: queue has %u elements\n", instance->sndqueue.qlen);
 
-	instance->atm_dev = NULL;
+	PDEBUG ("udsl_atm_dev_close: killing tasklet\n");
+	tasklet_kill (&instance->send_tasklet);
+	PDEBUG ("udsl_atm_dev_close: freeing instance\n");
+	kfree (instance);
 }
 
 
@@ -410,17 +713,6 @@
 * ATM helper functions
 *
 ****************************************************************************/
-static struct sk_buff *udsl_atm_alloc_tx (struct atm_vcc *vcc, unsigned int size)
-{
-	struct atmsar_vcc_data *atmsar_vcc =
-	    ((struct udsl_atm_dev_data *) vcc->dev_data)->atmsar_vcc;
-	if (atmsar_vcc)
-		return atmsar_alloc_tx (atmsar_vcc, size);
-
-	printk (KERN_INFO
-		"SpeedTouch USB: udsl_atm_alloc_tx could not find correct alloc_tx function !\n");
-	return NULL;
-}
 
 static int udsl_atm_proc_read (struct atm_dev *atm_dev, loff_t *pos, char *page)
 {
@@ -439,14 +731,6 @@
 				atm_dev->esi[3], atm_dev->esi[4], atm_dev->esi[5]);
 
 	if (!left--)
-		return sprintf (page, "AAL0: tx %d ( %d err ), rx %d ( %d err, %d drop )\n",
-				atomic_read (&atm_dev->stats.aal0.tx),
-				atomic_read (&atm_dev->stats.aal0.tx_err),
-				atomic_read (&atm_dev->stats.aal0.rx),
-				atomic_read (&atm_dev->stats.aal0.rx_err),
-				atomic_read (&atm_dev->stats.aal0.rx_drop));
-
-	if (!left--)
 		return sprintf (page, "AAL5: tx %d ( %d err ), rx %d ( %d err, %d drop )\n",
 				atomic_read (&atm_dev->stats.aal5.tx),
 				atomic_read (&atm_dev->stats.aal5.tx_err),
@@ -460,67 +744,12 @@
 
 /***************************************************************************
 *
-* ATM DATA functions
-*
-****************************************************************************/
-static int udsl_atm_send (struct atm_vcc *vcc, struct sk_buff *skb)
-{
-	struct udsl_atm_dev_data *dev_data = vcc->dev_data;
-	struct udsl_instance_data *instance = vcc->dev->dev_data;
-	struct sk_buff *new = NULL;
-	int err;
-
-	PDEBUG ("udsl_atm_send called\n");
-
-	if (!dev_data || !instance) {
-		PDEBUG ("NULL data!\n");
-		return -EINVAL;
-	}
-
-	if (!instance->firmware_loaded)
-		return -EAGAIN;
-
-	switch (vcc->qos.aal) {
-	case ATM_AAL5:
-		new = atmsar_encode_aal5 (dev_data->atmsar_vcc, skb);
-		if (!new)
-			goto nomem;
-		if (new != skb) {
-			vcc->pop (vcc, skb);
-			skb = new;
-		}
-		new = atmsar_encode_rawcell (dev_data->atmsar_vcc, skb);
-		if (!new)
-			goto nomem;
-		if (new != skb) {
-			vcc->pop (vcc, skb);
-			skb = new;
-		}
-		err = udsl_usb_send_data (instance, vcc, skb);
-		PDEBUG ("udsl_atm_send successfull (%d)\n", err);
-		return err;
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	PDEBUG ("udsl_atm_send unsuccessfull\n");
-	return 0;
-      nomem:
-	vcc->pop (vcc, skb);
-	return -ENOMEM;
-}
-
-
-/***************************************************************************
-*
 * SAR driver entries
 *
 ****************************************************************************/
 
 static int udsl_atm_open (struct atm_vcc *vcc, short vpi, int vci)
 {
-	struct udsl_atm_dev_data *dev_data;
 	struct udsl_instance_data *instance = vcc->dev->dev_data;
 
 	PDEBUG ("udsl_atm_open called\n");
@@ -535,15 +764,12 @@
 		return -EINVAL;
 
 	MOD_INC_USE_COUNT;
-	dev_data = kmalloc (sizeof (struct udsl_atm_dev_data), GFP_KERNEL);
-	if (!dev_data)
-		return -ENOMEM;
 
-	dev_data->atmsar_vcc =
+	vcc->dev_data =
 	    atmsar_open (&(instance->atmsar_vcc_list), vcc, ATMSAR_TYPE_AAL5, vpi, vci, 0, 0,
 			 ATMSAR_USE_53BYTE_CELL | ATMSAR_SET_PTI);
-	if (!dev_data->atmsar_vcc) {
-		kfree (dev_data);
+	if (!vcc->dev_data) {
+		MOD_DEC_USE_COUNT;
 		return -ENOMEM;	/* this is the only reason atmsar_open can fail... */
 	}
 
@@ -552,10 +778,8 @@
 	set_bit (ATM_VF_ADDR, &vcc->flags);
 	set_bit (ATM_VF_PARTIAL, &vcc->flags);
 	set_bit (ATM_VF_READY, &vcc->flags);
-	vcc->dev_data = dev_data;
-	vcc->alloc_tx = udsl_atm_alloc_tx;
 
-	dev_data->atmsar_vcc->mtu = UDSL_MAX_AAL5_MRU;
+	((struct atmsar_vcc_data *)vcc->dev_data)->mtu = UDSL_MAX_AAL5_MRU;
 
 	if (instance->firmware_loaded)
 		udsl_fire_receivers (instance);
@@ -566,22 +790,20 @@
 
 static void udsl_atm_close (struct atm_vcc *vcc)
 {
-	struct udsl_atm_dev_data *dev_data = vcc->dev_data;
 	struct udsl_instance_data *instance = vcc->dev->dev_data;
 
 	PDEBUG ("udsl_atm_close called\n");
 
-	if (!dev_data || !instance) {
-		PDEBUG ("NULL data!\n");
+	if (!instance) {
+		PDEBUG ("NULL instance!\n");
 		return;
 	}
 
 	/* freeing resources */
 	/* cancel all sends on this vcc */
-	udsl_usb_cancelsends (instance, vcc);
+	udsl_cancel_send (instance, vcc);
 
-	atmsar_close (&(instance->atmsar_vcc_list), dev_data->atmsar_vcc);
-	kfree (dev_data);
+	atmsar_close (&(instance->atmsar_vcc_list), vcc->dev_data);
 	vcc->dev_data = NULL;
 	clear_bit (ATM_VF_PARTIAL, &vcc->flags);
 
@@ -611,131 +833,6 @@
 **   USB   **
 ************/
 
-/***************************************************************************
-*
-* usb data functions
-*
-****************************************************************************/
-
-struct udsl_cb {
-	struct atm_vcc *vcc;
-};
-
-static void udsl_usb_send_data_complete (struct urb *urb, struct pt_regs *regs)
-{
-	struct udsl_usb_send_data_context *ctx = urb->context;
-	struct udsl_instance_data *instance = ctx->instance;
-	int err;
-
-	PDEBUG ("udsl_usb_send_data_completion (vcc = %p, skb = %p, status %d)\n", ctx->vcc,
-		ctx->skb, urb->status);
-
-	ctx->vcc->pop (ctx->vcc, ctx->skb);
-
-	if (!(ctx->skb = skb_dequeue (&(instance->sndqueue))))
-		return;
-
-	/* submit next skb */
-	ctx->vcc = ((struct udsl_cb *) (ctx->skb->cb))->vcc;
-	usb_fill_bulk_urb (urb,
-		       instance->usb_dev,
-		       usb_sndbulkpipe (instance->usb_dev, UDSL_ENDPOINT_DATA_OUT),
-		       (unsigned char *) ctx->skb->data,
-		       ctx->skb->len, udsl_usb_send_data_complete, ctx);
-
-	err = usb_submit_urb (urb, GFP_ATOMIC);
-
-	PDEBUG ("udsl_usb_send_data_completion (send packet %p with length %d), retval = %d\n",
-		ctx->skb, ctx->skb->len, err);
-}
-
-static int udsl_usb_cancelsends (struct udsl_instance_data *instance, struct atm_vcc *vcc)
-{
-	int i;
-
-	for (i = 0; i < UDSL_NUMBER_SND_URBS; i++) {
-		if (!instance->send_ctx[i].skb)
-			continue;
-		if (instance->send_ctx[i].vcc == vcc) {
-			usb_unlink_urb (instance->send_ctx[i].urb);
-			usb_free_urb (instance->send_ctx[i].urb);
-			instance->send_ctx[i].vcc->pop (instance->send_ctx[i].vcc,
-							instance->send_ctx[i].skb);
-			instance->send_ctx[i].skb = NULL;
-		}
-	}
-
-	return 0;
-}
-
-/**** send ******/
-static int udsl_usb_send_data (struct udsl_instance_data *instance, struct atm_vcc *vcc,
-			struct sk_buff *skb)
-{
-	int err, i;
-	struct urb *urb;
-	unsigned long flags;
-
-	PDEBUG ("udsl_usb_send_data entered, sending packet %p with length %d\n", skb, skb->len);
-
-	PACKETDEBUG (skb->data, skb->len);
-
-	spin_lock_irqsave (&instance->sndqueue.lock, flags);
-	((struct udsl_cb *) skb->cb)->vcc = vcc;
-
-	/* we are already queueing */
-	if (!skb_queue_empty (&instance->sndqueue)) {
-		__skb_queue_tail (&instance->sndqueue, skb);
-		spin_unlock_irqrestore (&instance->sndqueue.lock, flags);
-		PDEBUG ("udsl_usb_send_data: already queing, skb (0x%p) queued\n", skb);
-		return 0;
-	}
-
-	for (i = 0; i < UDSL_NUMBER_SND_URBS; i++)
-		if (instance->send_ctx[i].skb == NULL)
-			break;
-
-	/* we must start queueing */
-	if (i == UDSL_NUMBER_SND_URBS) {
-		__skb_queue_tail (&instance->sndqueue, skb);
-		spin_unlock_irqrestore (&instance->sndqueue.lock, flags);
-		PDEBUG ("udsl_usb_send_data: skb (0x%p) queued\n", skb);
-		return 0;
-	}
-
-	/* init context */
-	urb = instance->send_ctx[i].urb;
-	instance->send_ctx[i].skb = skb;
-	instance->send_ctx[i].vcc = vcc;
-	instance->send_ctx[i].instance = instance;
-
-	spin_unlock_irqrestore (&instance->sndqueue.lock, flags);
-
-	/* submit packet */
-	usb_fill_bulk_urb (urb,
-		       instance->usb_dev,
-		       usb_sndbulkpipe (instance->usb_dev, UDSL_ENDPOINT_DATA_OUT),
-		       (unsigned char *) skb->data,
-		       skb->len,
-		       udsl_usb_send_data_complete, &(instance->send_ctx[i])
-	    );
-
-	err = usb_submit_urb (urb, GFP_KERNEL);
-
-	if (err != 0)
-		skb_unlink (skb);
-
-	PDEBUG ("udsl_usb_send_data done (retval = %d)\n", err);
-	return err;
-}
-
-
-/***************************************************************************
-*
-* usb driver entries
-*
-****************************************************************************/
-
 static int udsl_usb_ioctl (struct usb_interface *intf, unsigned int code, void *user_data)
 {
 	struct udsl_instance_data *instance = usb_get_intfdata (intf);
@@ -752,7 +849,7 @@
 		instance->atm_dev->signal = ATM_PHY_SIG_FOUND;
 		down (&instance->serialize); /* vs self */
 		if (!instance->firmware_loaded) {
-			usb_set_interface (instance->usb_dev, 1, 2);
+			usb_set_interface (instance->usb_dev, 1, 1);
 			instance->firmware_loaded = 1;
 		}
 		up (&instance->serialize);
@@ -773,7 +870,7 @@
 	struct udsl_instance_data *instance;
 	unsigned char mac_str [13];
 	unsigned char mac [6];
-	int i, err;
+	int i;
 
 	PDEBUG ("Trying device with Vendor=0x%x, Product=0x%x, ifnum %d\n",
 		dev->descriptor.idVendor, dev->descriptor.idProduct, ifnum);
@@ -788,8 +885,7 @@
 	/* instance init */
 	if (!(instance = kmalloc (sizeof (struct udsl_instance_data), GFP_KERNEL))) {
 		PDEBUG ("No memory for Instance data!\n");
-		err = -ENOMEM;
-		goto fail_instance;
+		return -ENOMEM;
 	}
 
 	memset (instance, 0, sizeof (struct udsl_instance_data));
@@ -808,46 +904,63 @@
 
 	skb_queue_head_init (&instance->sndqueue);
 
-	/* receive urb init */
+	spin_lock_init (&instance->send_lock);
+	INIT_LIST_HEAD (&instance->spare_senders);
+	INIT_LIST_HEAD (&instance->spare_buffers);
+
+	tasklet_init (&instance->send_tasklet, udsl_process_send, (unsigned long) instance);
+	INIT_LIST_HEAD (&instance->filled_buffers);
+
+	/* receive init */
 	for (i = 0; i < UDSL_NUMBER_RCV_URBS; i++) {
 		struct udsl_receiver *rcv = &(instance->all_receivers[i]);
 
-		if (!(rcv->skb = dev_alloc_skb (UDSL_RECEIVE_BUFFER_SIZE))) {
+		if (!(rcv->skb = dev_alloc_skb (UDSL_RCV_BUFFER_SIZE * ATM_CELL_SIZE))) {
 			PDEBUG ("No memory for skb %d!\n", i);
-			err = -ENOMEM;
-			goto fail_urbs;
+			goto fail;
 		}
 
 		if (!(rcv->urb = usb_alloc_urb (0, GFP_KERNEL))) {
 			PDEBUG ("No memory for receive urb %d!\n", i);
-			err = -ENOMEM;
-			goto fail_urbs;
+			goto fail;
 		}
 
 		rcv->instance = instance;
 
 		list_add (&rcv->list, &instance->spare_receivers);
 
-		PDEBUG ("skb->truesize = %d (asked for %d)\n", rcv->skb->truesize, UDSL_RECEIVE_BUFFER_SIZE);
+		PDEBUG ("skb->truesize = %d (asked for %d)\n", rcv->skb->truesize, UDSL_RCV_BUFFER_SIZE * ATM_CELL_SIZE);
 	}
 
+	/* send init */
 	for (i = 0; i < UDSL_NUMBER_SND_URBS; i++) {
-		struct udsl_usb_send_data_context *snd = &(instance->send_ctx[i]);
+		struct udsl_sender *snd = &(instance->all_senders[i]);
 
 		if (!(snd->urb = usb_alloc_urb (0, GFP_KERNEL))) {
 			PDEBUG ("No memory for send urb %d!\n", i);
-			err = -ENOMEM;
-			goto fail_urbs;
+			goto fail;
 		}
 
 		snd->instance = instance;
+
+		list_add (&snd->list, &instance->spare_senders);
+	}
+
+	for (i = 0; i < UDSL_NUMBER_SND_BUFS; i++) {
+		struct udsl_send_buffer *buf = &(instance->all_buffers[i]);
+
+		if (!(buf->base = kmalloc (UDSL_SND_BUFFER_SIZE * ATM_CELL_SIZE, GFP_KERNEL))) {
+			PDEBUG ("No memory for send buffer %d!\n", i);
+			goto fail;
+		}
+
+		list_add (&buf->list, &instance->spare_buffers);
 	}
 
 	/* atm init */
 	if (!(instance->atm_dev = atm_dev_register (udsl_driver_name, &udsl_atm_devops, -1, 0))) {
 		PDEBUG ("failed to register ATM device!\n");
-		err = -ENOMEM;
-		goto fail_atm;
+		goto fail;
 	}
 
 	instance->atm_dev->ci_range.vpi_bits = ATM_CI_MAX;
@@ -874,27 +987,25 @@
 
 	return 0;
 
-fail_atm:
-fail_urbs:
-	for (i = 0; i < UDSL_NUMBER_SND_URBS; i++) {
-		struct udsl_usb_send_data_context *snd = &(instance->send_ctx[i]);
+fail:
+	for (i = 0; i < UDSL_NUMBER_SND_BUFS; i++)
+		kfree (instance->all_buffers[i].base);
 
-		if (snd->urb)
-			usb_free_urb (snd->urb);
-	}
+	for (i = 0; i < UDSL_NUMBER_SND_URBS; i++)
+		usb_free_urb (instance->all_senders[i].urb);
 
 	for (i = 0; i < UDSL_NUMBER_RCV_URBS; i++) {
 		struct udsl_receiver *rcv = &(instance->all_receivers[i]);
 
+		usb_free_urb (rcv->urb);
+
 		if (rcv->skb)
 			kfree_skb (rcv->skb);
-
-		if (rcv->urb)
-			usb_free_urb (rcv->urb);
 	}
+
 	kfree (instance);
-fail_instance:
-	return err;
+
+	return -ENOMEM;
 }
 
 static void udsl_usb_disconnect (struct usb_interface *intf)
@@ -903,7 +1014,7 @@
 	struct list_head *pos;
 	unsigned long flags;
 	unsigned int count = 0;
-	int i;
+	int result, i;
 
 	PDEBUG ("disconnecting\n");
 
@@ -916,8 +1027,9 @@
 
 	tasklet_disable (&instance->receive_tasklet);
 
+	/* receive finalize */
 	down (&instance->serialize); /* vs udsl_fire_receivers */
-	/* no need to take the spinlock - receive_tasklet is not running */
+	/* no need to take the spinlock */
 	list_for_each (pos, &instance->spare_receivers)
 		if (++count > UDSL_NUMBER_RCV_URBS)
 			panic (__FILE__ ": memory corruption detected at line %d!\n", __LINE__);
@@ -929,7 +1041,8 @@
 	count = UDSL_NUMBER_RCV_URBS - count;
 
 	for (i = 0; i < UDSL_NUMBER_RCV_URBS; i++)
-		usb_unlink_urb (instance->all_receivers[i].urb);
+		if ((result = usb_unlink_urb (instance->all_receivers[i].urb)) < 0)
+			PDEBUG ("udsl_usb_disconnect: usb_unlink_urb on receive urb %d returned %d\n", i, result);
 
 	/* wait for completion handlers to finish */
 	do {
@@ -946,12 +1059,11 @@
 		if (completed == count)
 			break;
 
-		/* not all urbs completed */
 		yield ();
 	} while (1);
 
-	PDEBUG ("udsl_usb_disconnect: flushing %u completed receivers\n", count);
-	/* no need to take the spinlock - no completion handlers running */
+	PDEBUG ("udsl_usb_disconnect: flushing\n");
+	/* no need to take the spinlock */
 	INIT_LIST_HEAD (&instance->completed_receivers);
 
 	tasklet_enable (&instance->receive_tasklet);
@@ -965,25 +1077,48 @@
 		kfree_skb (rcv->skb);
 	}
 
-	for (i = 0; i < UDSL_NUMBER_SND_URBS; i++) {
-		struct udsl_usb_send_data_context *ctx = &(instance->send_ctx[i]);
+	/* send finalize */
+	tasklet_disable (&instance->send_tasklet);
 
-		usb_unlink_urb (ctx->urb);
+	for (i = 0; i < UDSL_NUMBER_SND_URBS; i++)
+		if ((result = usb_unlink_urb (instance->all_senders[i].urb)) < 0)
+			PDEBUG ("udsl_usb_disconnect: usb_unlink_urb on send urb %d returned %d\n", i, result);
+
+	/* wait for completion handlers to finish */
+	do {
+		count = 0;
+		spin_lock_irqsave (&instance->send_lock, flags);
+		list_for_each (pos, &instance->spare_senders)
+			if (++count > UDSL_NUMBER_SND_URBS)
+				panic (__FILE__ ": memory corruption detected at line %d!\n", __LINE__);
+		spin_unlock_irqrestore (&instance->send_lock, flags);
 
-		if (ctx->skb)
-			ctx->vcc->pop (ctx->vcc, ctx->skb);
-		ctx->skb = NULL;
+		PDEBUG ("udsl_usb_disconnect: found %u spare senders\n", count);
 
-		usb_free_urb (ctx->urb);
+		if (count == UDSL_NUMBER_SND_URBS)
+			break;
 
-	}
+		yield ();
+	} while (1);
 
+	PDEBUG ("udsl_usb_disconnect: flushing\n");
+	/* no need to take the spinlock */
+	INIT_LIST_HEAD (&instance->spare_senders);
+	INIT_LIST_HEAD (&instance->spare_buffers);
+	instance->current_buffer = NULL;
 
-	/* removing atm device */
-	if (instance->atm_dev)
-		udsl_atm_stopdevice (instance);
+	tasklet_enable (&instance->send_tasklet);
 
-	kfree (instance);
+	PDEBUG ("udsl_usb_disconnect: freeing senders\n");
+	for (i = 0; i < UDSL_NUMBER_SND_URBS; i++)
+		usb_free_urb (instance->all_senders[i].urb);
+
+	PDEBUG ("udsl_usb_disconnect: freeing buffers\n");
+	for (i = 0; i < UDSL_NUMBER_SND_BUFS; i++)
+		kfree (instance->all_buffers[i].base);
+
+	/* atm finalize */
+	shutdown_atm_dev (instance->atm_dev);
 }
 
 
@@ -995,7 +1130,14 @@
 
 static int __init udsl_usb_init (void)
 {
+	struct sk_buff *skb; /* dummy for sizeof */
+
 	PDEBUG ("udsl_usb_init: driver version " DRIVER_VERSION "\n");
+
+	if (sizeof (struct udsl_control) > sizeof (skb->cb)) {
+		printk (KERN_ERR __FILE__ ": unusable with this kernel!\n");
+		return -EIO;
+	}
 
 	return usb_register (&udsl_usb_driver);
 }
diff -Nru a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c
--- a/drivers/usb/net/kaweth.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/usb/net/kaweth.c	Sun Feb 23 22:25:25 2003
@@ -130,6 +130,7 @@
 	{ USB_DEVICE(0x03e8, 0x0008) }, /* AOX Endpoints USB Ethernet */
 	{ USB_DEVICE(0x04bb, 0x0901) }, /* I-O DATA USB-ET/T */
 	{ USB_DEVICE(0x0506, 0x03e8) }, /* 3Com 3C19250 */
+	{ USB_DEVICE(0x0506, 0x11f8) }, /* 3Com 3C460 */
 	{ USB_DEVICE(0x0557, 0x2002) }, /* ATEN USB Ethernet */
 	{ USB_DEVICE(0x0557, 0x4000) }, /* D-Link DSB-650C */
 	{ USB_DEVICE(0x0565, 0x0002) }, /* Peracom Enet */
@@ -712,7 +713,7 @@
 static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net)
 {
 	struct kaweth_device *kaweth = net->priv;
-	char *private_header;
+	u16 *private_header;
 
 	int res;
 
@@ -744,7 +745,7 @@
 	}
 
 	private_header = __skb_push(skb, 2);
-	*private_header = cpu_to_le16(skb->len);
+	*private_header = cpu_to_le16(skb->len-2);
 	kaweth->tx_skb = skb;
 
 	usb_fill_bulk_urb(kaweth->tx_urb,
diff -Nru a/drivers/usb/net/pegasus.h b/drivers/usb/net/pegasus.h
--- a/drivers/usb/net/pegasus.h	Sun Feb 23 22:25:27 2003
+++ b/drivers/usb/net/pegasus.h	Sun Feb 23 22:25:27 2003
@@ -133,6 +133,7 @@
 #define	VENDOR_LANEED		0x056e
 #define	VENDOR_LINKSYS		0x066b
 #define	VENDOR_MELCO		0x0411
+#define	VENDOR_MOBILITY		0x1342
 #define	VENDOR_NETGEAR		0x0846
 #define	VENDOR_SMARTBRIDGES	0x08d1
 #define	VENDOR_SMC		0x0707
@@ -167,7 +168,7 @@
 PEGASUS_DEV( "Accton USB 10/100 Ethernet Adapter", VENDOR_ACCTON, 0x1046,
 		DEFAULT_GPIO_RESET )
 PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046,
-		DEFAULT_GPIO_RESET )
+		DEFAULT_GPIO_RESET | PEGASUS_II )
 PEGASUS_DEV( "ADMtek ADM8511 \"Pegasus II\" USB Ethernet",
 		VENDOR_ADMTEK, 0x8511,
 		DEFAULT_GPIO_RESET | PEGASUS_II )
@@ -215,6 +216,8 @@
 		DEFAULT_GPIO_RESET )
 PEGASUS_DEV( "GOLDPFEIL USB Adapter", VENDOR_ELCON, 0x0002,
 		DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA )
+PEGASUS_DEV( "EasiDock Ethernet", VENDOR_MOBILITY, 0x0304,
+		DEFAULT_GPIO_RESET )
 PEGASUS_DEV( "Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000,
 		DEFAULT_GPIO_RESET )
 PEGASUS_DEV( "Hawking UF100 10/100 Ethernet", VENDOR_HAWKING, 0x400c,
diff -Nru a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
--- a/drivers/usb/serial/Kconfig	Sun Feb 23 22:25:25 2003
+++ b/drivers/usb/serial/Kconfig	Sun Feb 23 22:25:25 2003
@@ -297,10 +297,14 @@
 config USB_SERIAL_KEYSPAN_USA19QW
 	bool "USB Keyspan USA-19QW Firmware"
 	depends on USB_SERIAL_KEYSPAN
+	help
+	  Say Y here to include firmware for the USA-19QW converter.
 
 config USB_SERIAL_KEYSPAN_USA19QI
 	bool "USB Keyspan USA-19QI Firmware"
 	depends on USB_SERIAL_KEYSPAN
+	help
+	  Say Y here to include firmware for the USA-19QI converter.
 
 config USB_SERIAL_KEYSPAN_USA49W
 	bool "USB Keyspan USA-49W Firmware"
diff -Nru a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
--- a/drivers/usb/serial/console.c	Sun Feb 23 22:25:26 2003
+++ b/drivers/usb/serial/console.c	Sun Feb 23 22:25:26 2003
@@ -141,7 +141,6 @@
 	}
 
 	port = &serial->port[0];
-	down (&port->sem);
 	port->tty = NULL;
 
 	info->port = port;
@@ -158,8 +157,6 @@
 			port->open_count = 0;
 	}
 
-	up (&port->sem);
-
 	if (retval) {
 		err ("could not open USB console port");
 		return retval;
@@ -208,8 +205,6 @@
 	if (count == 0)
 		return;
 
-	down (&port->sem);
-
 	dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count);
 
 	if (!port->open_count) {
@@ -224,7 +219,6 @@
 		retval = usb_serial_generic_write(port, 0, buf, count);
 
 exit:
-	up (&port->sem);
 	dbg("%s - return value (if we had one): %d", __FUNCTION__, retval);
 }
 
diff -Nru a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
--- a/drivers/usb/serial/usb-serial.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/usb/serial/usb-serial.c	Sun Feb 23 22:25:24 2003
@@ -391,7 +391,11 @@
 
 struct usb_serial *usb_serial_get_by_minor (unsigned int minor)
 {
-	return serial_table[minor];
+	struct usb_serial *serial = serial_table[minor];
+
+	if (serial)
+		kobject_get (&serial->kobj);
+	return serial;
 }
 
 static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_ports, unsigned int *minor)
@@ -468,7 +472,6 @@
 	port = &serial->port[portNumber];
 	tty->driver_data = port;
 
-	down (&port->sem);
 	port->tty = tty;
 	 
 	/* lock this module before we call it,
@@ -492,8 +495,6 @@
 		}
 	}
 bailout:
-
-	up (&port->sem);
 	return retval;
 }
 
@@ -516,6 +517,7 @@
 	}
 
 	module_put(port->serial->type->owner);
+	kobject_put(&port->serial->kobj);
 }
 
 static void serial_close(struct tty_struct *tty, struct file * filp)
@@ -526,16 +528,12 @@
 	if (!serial)
 		return;
 
-	down (&port->sem);
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	/* if disconnect beat us to the punch here, there's nothing to do */
 	if (tty->driver_data) {
 		__serial_close(port, filp);
 	}
-
-	up (&port->sem);
 }
 
 static int serial_write (struct tty_struct * tty, int from_user, const unsigned char *buf, int count)
@@ -547,8 +545,6 @@
 	if (!serial)
 		return -ENODEV;
 
-	down (&port->sem);
-
 	dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count);
 
 	if (!port->open_count) {
@@ -563,7 +559,6 @@
 		retval = usb_serial_generic_write(port, from_user, buf, count);
 
 exit:
-	up (&port->sem);
 	return retval;
 }
 
@@ -576,8 +571,6 @@
 	if (!serial)
 		return -ENODEV;
 
-	down (&port->sem);
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	if (!port->open_count) {
@@ -592,7 +585,6 @@
 		retval = usb_serial_generic_write_room(port);
 
 exit:
-	up (&port->sem);
 	return retval;
 }
 
@@ -605,8 +597,6 @@
 	if (!serial)
 		return -ENODEV;
 
-	down (&port->sem);
-
 	dbg("%s = port %d", __FUNCTION__, port->number);
 
 	if (!port->open_count) {
@@ -621,7 +611,6 @@
 		retval = usb_serial_generic_chars_in_buffer(port);
 
 exit:
-	up (&port->sem);
 	return retval;
 }
 
@@ -633,8 +622,6 @@
 	if (!serial)
 		return;
 
-	down (&port->sem);
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	if (!port->open_count) {
@@ -647,7 +634,6 @@
 		serial->type->throttle(port);
 
 exit:
-	up (&port->sem);
 }
 
 static void serial_unthrottle (struct tty_struct * tty)
@@ -658,8 +644,6 @@
 	if (!serial)
 		return;
 
-	down (&port->sem);
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	if (!port->open_count) {
@@ -672,7 +656,6 @@
 		serial->type->unthrottle(port);
 
 exit:
-	up (&port->sem);
 }
 
 static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg)
@@ -684,8 +667,6 @@
 	if (!serial)
 		return -ENODEV;
 
-	down (&port->sem);
-
 	dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd);
 
 	if (!port->open_count) {
@@ -700,7 +681,6 @@
 		retval = -ENOIOCTLCMD;
 
 exit:
-	up (&port->sem);
 	return retval;
 }
 
@@ -712,8 +692,6 @@
 	if (!serial)
 		return;
 
-	down (&port->sem);
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	if (!port->open_count) {
@@ -726,7 +704,6 @@
 		serial->type->set_termios(port, old);
 
 exit:
-	up (&port->sem);
 }
 
 static void serial_break (struct tty_struct *tty, int break_state)
@@ -737,8 +714,6 @@
 	if (!serial)
 		return;
 
-	down (&port->sem);
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	if (!port->open_count) {
@@ -751,7 +726,6 @@
 		serial->type->break_ctl(port, break_state);
 
 exit:
-	up (&port->sem);
 }
 
 static void serial_shutdown (struct usb_serial *serial)
@@ -797,6 +771,7 @@
 			begin += length;
 			length = 0;
 		}
+		kobject_put(&serial->kobj);
 	}
 	*eof = 1;
 done:
@@ -833,6 +808,75 @@
 	wake_up_interruptible(&tty->write_wait);
 }
 
+static void destroy_serial (struct kobject *kobj)
+{
+	struct usb_serial *serial;
+	struct usb_serial_port *port;
+	int i;
+
+	dbg ("%s", __FUNCTION__);
+
+	serial = to_usb_serial(kobj);
+
+	/* fail all future close/read/write/ioctl/etc calls */
+	for (i = 0; i < serial->num_ports; ++i) {
+		port = &serial->port[i];
+		if (port->tty != NULL) {
+			port->tty->driver_data = NULL;
+			while (port->open_count > 0) {
+				__serial_close(port, NULL);
+			}
+		}
+	}
+
+	serial_shutdown (serial);
+
+	for (i = 0; i < serial->num_ports; ++i)
+		device_unregister(&serial->port[i].dev);
+
+	for (i = 0; i < serial->num_ports; ++i)
+		serial->port[i].open_count = 0;
+
+	for (i = 0; i < serial->num_bulk_in; ++i) {
+		port = &serial->port[i];
+		if (port->read_urb) {
+			usb_unlink_urb (port->read_urb);
+			usb_free_urb (port->read_urb);
+		}
+		if (port->bulk_in_buffer)
+			kfree (port->bulk_in_buffer);
+	}
+	for (i = 0; i < serial->num_bulk_out; ++i) {
+		port = &serial->port[i];
+		if (port->write_urb) {
+			usb_unlink_urb (port->write_urb);
+			usb_free_urb (port->write_urb);
+		}
+		if (port->bulk_out_buffer)
+			kfree (port->bulk_out_buffer);
+	}
+	for (i = 0; i < serial->num_interrupt_in; ++i) {
+		port = &serial->port[i];
+		if (port->interrupt_in_urb) {
+			usb_unlink_urb (port->interrupt_in_urb);
+			usb_free_urb (port->interrupt_in_urb);
+		}
+		if (port->interrupt_in_buffer)
+			kfree (port->interrupt_in_buffer);
+	}
+	/* return the minor range that this device had */
+	return_serial (serial);
+
+	usb_put_dev(serial->dev);
+
+	/* free up any memory that we allocated */
+	kfree (serial);
+}
+
+static struct kobj_type usb_serial_kobj_type = {
+	.release = destroy_serial,
+};
+
 static struct usb_serial * create_serial (struct usb_device *dev, 
 					  struct usb_interface *interface,
 					  struct usb_serial_device_type *type)
@@ -845,12 +889,16 @@
 		return NULL;
 	}
 	memset (serial, 0, sizeof(*serial));
-	serial->dev = dev;
+	serial->dev = usb_get_dev(dev);
 	serial->type = type;
 	serial->interface = interface;
 	serial->vendor = dev->descriptor.idVendor;
 	serial->product = dev->descriptor.idProduct;
 
+	/* initialize the kobject portion of the usb_device */
+	kobject_init(&serial->kobj);
+	serial->kobj.ktype = &usb_serial_kobj_type;
+
 	return serial;
 }
 
@@ -1113,7 +1161,6 @@
 		port->serial = serial;
 		port->magic = USB_SERIAL_PORT_MAGIC;
 		INIT_WORK(&port->work, usb_serial_port_softint, port);
-		init_MUTEX (&port->sem);
 	}
 
 	/* if this device type has an attach function, call it */
@@ -1189,67 +1236,14 @@
 {
 	struct usb_serial *serial = usb_get_intfdata (interface);
 	struct device *dev = &interface->dev;
-	struct usb_serial_port *port;
-	int i;
 
 	dbg ("%s", __FUNCTION__);
 
 	usb_set_intfdata (interface, NULL);
 	if (serial) {
-		/* fail all future close/read/write/ioctl/etc calls */
-		for (i = 0; i < serial->num_ports; ++i) {
-			port = &serial->port[i];
-			down (&port->sem);
-			if (port->tty != NULL) {
-				port->tty->driver_data = NULL;
-				while (port->open_count > 0) {
-					__serial_close(port, NULL);
-				}
-			}
-			up (&port->sem);
-		}
-
-		serial->dev = NULL;
-		serial_shutdown (serial);
-
-		for (i = 0; i < serial->num_ports; ++i)
-			device_unregister(&serial->port[i].dev);
-
-		for (i = 0; i < serial->num_ports; ++i)
-			serial->port[i].open_count = 0;
-
-		for (i = 0; i < serial->num_bulk_in; ++i) {
-			port = &serial->port[i];
-			if (port->read_urb) {
-				usb_unlink_urb (port->read_urb);
-				usb_free_urb (port->read_urb);
-			}
-			if (port->bulk_in_buffer)
-				kfree (port->bulk_in_buffer);
-		}
-		for (i = 0; i < serial->num_bulk_out; ++i) {
-			port = &serial->port[i];
-			if (port->write_urb) {
-				usb_unlink_urb (port->write_urb);
-				usb_free_urb (port->write_urb);
-			}
-			if (port->bulk_out_buffer)
-				kfree (port->bulk_out_buffer);
-		}
-		for (i = 0; i < serial->num_interrupt_in; ++i) {
-			port = &serial->port[i];
-			if (port->interrupt_in_urb) {
-				usb_unlink_urb (port->interrupt_in_urb);
-				usb_free_urb (port->interrupt_in_urb);
-			}
-			if (port->interrupt_in_buffer)
-				kfree (port->interrupt_in_buffer);
-		}
-		/* return the minor range that this device had */
-		return_serial (serial);
-
-		/* free up any memory that we allocated */
-		kfree (serial);
+		/* let the last holder of this object 
+		 * cause it to be cleaned up */
+		kobject_put (&serial->kobj);
 	}
 	dev_info(dev, "device disconnected\n");
 }
diff -Nru a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h
--- a/drivers/usb/serial/usb-serial.h	Sun Feb 23 22:25:27 2003
+++ b/drivers/usb/serial/usb-serial.h	Sun Feb 23 22:25:27 2003
@@ -89,7 +89,6 @@
  * @write_wait: a wait_queue_head_t used by the port.
  * @work: work queue entry for the line discipline waking up.
  * @open_count: number of times this port has been opened.
- * @sem: struct semaphore used to lock this structure.
  *
  * This structure is used by the usb-serial core and drivers for the specific
  * ports of a device.
@@ -116,7 +115,6 @@
 	wait_queue_head_t	write_wait;
 	struct work_struct	work;
 	int			open_count;
-	struct semaphore	sem;
 	struct device		dev;
 };
 #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
@@ -164,8 +162,10 @@
 	__u16				vendor;
 	__u16				product;
 	struct usb_serial_port		port[MAX_NUM_PORTS];
+	struct kobject			kobj;
 	void *				private;
 };
+#define to_usb_serial(d) container_of(d, struct usb_serial, kobj)
 
 #define NUM_DONT_CARE	(-1)
 
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/usb/storage/transport.c	Sun Feb 23 22:25:23 2003
@@ -314,7 +314,7 @@
 		return USB_STOR_XFER_ERROR;
 
 	/* the transfer was cancelled, presumably by an abort */
-	case -ENODEV:
+	case -ECONNRESET:
 		US_DEBUGP("-- transfer cancelled\n");
 		return USB_STOR_XFER_ERROR;
 
diff -Nru a/drivers/video/Kconfig b/drivers/video/Kconfig
--- a/drivers/video/Kconfig	Sun Feb 23 22:25:21 2003
+++ b/drivers/video/Kconfig	Sun Feb 23 22:25:21 2003
@@ -363,7 +363,7 @@
 
 config FB_SGIVW
 	tristate "SGI Visual Workstation framebuffer support"
-	depends on FB && VISWS
+	depends on FB && X86_VISWS
 	help
 	  SGI Visual Workstation support for framebuffer graphics.
 
diff -Nru a/drivers/video/fm2fb.c b/drivers/video/fm2fb.c
--- a/drivers/video/fm2fb.c	Sun Feb 23 22:25:23 2003
+++ b/drivers/video/fm2fb.c	Sun Feb 23 22:25:23 2003
@@ -267,7 +267,7 @@
 		fb_info.fix = fb_fix;
 		fb_info.flags = FBINFO_FLAG_DEFAULT;
 
-		/* The below feilds will go away !!!! */
+		/* The below fields will go away !!!! */
 		fb_alloc_cmap(&fb_info.cmap, 16, 0);
 
 		if (register_framebuffer(&fb_info) < 0)
diff -Nru a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c
--- a/drivers/video/pm3fb.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/video/pm3fb.c	Sun Feb 23 22:25:22 2003
@@ -2325,7 +2325,7 @@
 	PM3_WRITE_REG(PM3ForegroundColor, fgx);
 	PM3_WRITE_REG(PM3FillBackgroundColor, bgx);
 
-	/* WARNING : adress select X need to specify 8 bits for fontwidth <= 8 */
+	/* WARNING : address select X need to specify 8 bits for fontwidth <= 8 */
 	/* and 16 bits for fontwidth <= 16 */
 	/* same in _putcs, same for Y and fontheight */
 	if (fontwidth(p) <= 8)
@@ -2438,7 +2438,7 @@
 	PM3_WRITE_REG(PM3ForegroundColor, fgx);
 	PM3_WRITE_REG(PM3FillBackgroundColor, bgx);
 
-	/* WARNING : adress select X need to specify 8 bits for fontwidth <= 8 */
+	/* WARNING : address select X need to specify 8 bits for fontwidth <= 8 */
 	/* and 16 bits for fontwidth <= 16 */
 	/* same in _putc, same for Y and fontheight */
 	if (fontwidth(p) <= 8)
diff -Nru a/drivers/video/q40fb.c b/drivers/video/q40fb.c
--- a/drivers/video/q40fb.c	Sun Feb 23 22:25:22 2003
+++ b/drivers/video/q40fb.c	Sun Feb 23 22:25:22 2003
@@ -111,7 +111,7 @@
 	fb_info.pseudo_palette = pseudo_palette;	
    	fb_info.screen_base = (char *) q40fb_fix.smem_start;
 
-	/* The below feilds will go away !!!! */
+	/* The below fields will go away !!!! */
 	fb_alloc_cmap(&fb_info.cmap, 16, 0);
 
 	master_outb(3, DISPLAY_CONTROL_REG);
diff -Nru a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c
--- a/drivers/video/sgivwfb.c	Sun Feb 23 22:25:24 2003
+++ b/drivers/video/sgivwfb.c	Sun Feb 23 22:25:24 2003
@@ -13,14 +13,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/tty.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
 #include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <asm/uaccess.h>
 #include <linux/fb.h>
 #include <linux/init.h>
 #include <linux/ioport.h>
@@ -29,7 +22,7 @@
 
 #define INCLUDE_TIMING_TABLE_DATA
 #define DBE_REG_BASE default_par.regs
-#include <asm/sgi-vwdbe.h>
+#include <video/sgivw.h>
 
 struct sgivw_par {
 	struct asregs *regs;
@@ -37,6 +30,8 @@
 	u_long timing_num;
 };
 
+#define FLATPANEL_SGI_1600SW	5
+
 /*
  *  RAM we reserve for the frame buffer. This defines the maximum screen
  *  size
@@ -54,26 +49,29 @@
 static int ypan = 0;
 static int ywrap = 0;
 
+static int flatpanel_id = -1;
+
 static struct fb_fix_screeninfo sgivwfb_fix __initdata = {
 	.id		= "SGI Vis WS FB",
 	.type		= FB_TYPE_PACKED_PIXELS,
         .visual		= FB_VISUAL_PSEUDOCOLOR,
 	.mmio_start	= DBE_REG_PHYS,
 	.mmio_len	= DBE_REG_SIZE,
-        .accel		= FB_ACCEL_NONE
+        .accel		= FB_ACCEL_NONE,
+	.line_length	= 640,
 };
 
 static struct fb_var_screeninfo sgivwfb_var __initdata = {
-        /* 640x480, 8 bpp */
-        .xres		= 640,
+	/* 640x480, 8 bpp */
+	.xres		= 640,
 	.yres		= 480,
 	.xres_virtual	= 640,
 	.yres_virtual	= 480,
 	.bits_per_pixel	= 8,
-        .red		= {0, 8, 0},
-	.green		= {0, 8, 0},
-	.blue		= {0, 8, 0},
-        .height		= -1,
+	.red		= { 0, 8, 0 },
+	.green		= { 0, 8, 0 },
+	.blue		= { 0, 8, 0 },
+	.height		= -1,
 	.width		= -1,
 	.pixclock	= 20000,
 	.left_margin	= 64,
@@ -82,14 +80,35 @@
 	.lower_margin	= 32,
 	.hsync_len	= 64,
 	.vsync_len	= 2,
-        .vmode		= FB_VMODE_NONINTERLACED
+	.vmode		= FB_VMODE_NONINTERLACED
+};
+
+static struct fb_var_screeninfo sgivwfb_var1600sw __initdata = {
+	/* 1600x1024, 8 bpp */
+	.xres		= 1600,
+	.yres		= 1024,
+	.xres_virtual	= 1600,
+	.yres_virtual	= 1024,
+	.bits_per_pixel	= 8,
+	.red		= { 0, 8, 0 },
+	.green		= { 0, 8, 0 },
+	.blue		= { 0, 8, 0 },
+	.height		= -1,
+	.width		= -1,
+	.pixclock	= 9353,
+	.left_margin	= 20,
+	.right_margin	= 30,
+	.upper_margin	= 37,
+	.lower_margin	= 3,
+	.hsync_len	= 20,
+	.vsync_len	= 3,
+	.vmode		= FB_VMODE_NONINTERLACED
 };
 
 /*
  *  Interface used by the world
  */
 int sgivwfb_init(void);
-int sgivwfb_setup(char *);
 
 static int sgivwfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info);
 static int sgivwfb_set_par(struct fb_info *info);
@@ -114,34 +133,24 @@
 /*
  *  Internal routines
  */
-static u_long get_line_length(int xres_virtual, int bpp);
-static unsigned long bytes_per_pixel(int bpp);
-
-static unsigned long get_line_length(int xres_virtual, int bpp)
-{
-	return (xres_virtual * bytes_per_pixel(bpp));
-}
-
 static unsigned long bytes_per_pixel(int bpp)
 {
-	unsigned long length;
-
 	switch (bpp) {
-	case 8:
-		length = 1;
-		break;
-	case 16:
-		length = 2;
-		break;
-	case 32:
-		length = 4;
-		break;
-	default:
-		printk(KERN_INFO "sgivwfb: unsupported bpp=%d\n", bpp);
-		length = 0;
-		break;
+		case 8:
+			return 1;
+		case 16:
+			return 2;
+		case 32:
+			return 4;
+		default:
+			printk(KERN_INFO "sgivwfb: unsupported bpp %d\n", bpp);
+			return 0;
 	}
-	return (length);
+}
+
+static unsigned long get_line_length(int xres_virtual, int bpp)
+{
+	return (xres_virtual * bytes_per_pixel(bpp));
 }
 
 /*
@@ -280,8 +289,7 @@
 		test_mode--;
 	min_mode = test_mode;
 	timing = &dbeVTimings[min_mode];
-	printk(KERN_INFO "sgivwfb: granted dot-clock=%d KHz\n",
-	       timing->cfreq);
+	printk(KERN_INFO "sgivwfb: granted dot-clock=%d KHz\n", timing->cfreq);
 
 	/* Adjust virtual resolution, if necessary */
 	if (var->xres > var->xres_virtual || (!ywrap && !ypan))
@@ -292,11 +300,12 @@
 	/*
 	 *  Memory limit
 	 */
-	line_length =
-	    get_line_length(var->xres_virtual, var->bits_per_pixel);
+	line_length = get_line_length(var->xres_virtual, var->bits_per_pixel);
 	if (line_length * var->yres_virtual > sgivwfb_mem_size)
 		return -ENOMEM;	/* Virtual resolution to high */
 
+	info->fix.line_length = line_length;
+
 	switch (var->bits_per_pixel) {
 	case 8:
 		var->red.offset = 0;
@@ -355,6 +364,48 @@
 }
 
 /*
+ *  Setup flatpanel related registers.
+ */
+static void sgivwfb_setup_flatpanel(struct dbe_timing_info *currentTiming)
+{
+	int fp_wid, fp_hgt, fp_vbs, fp_vbe;
+	u32 outputVal = 0;
+
+	SET_DBE_FIELD(VT_FLAGS, HDRV_INVERT, outputVal, 
+		(currentTiming->flags & FB_SYNC_HOR_HIGH_ACT) ? 0 : 1);
+	SET_DBE_FIELD(VT_FLAGS, VDRV_INVERT, outputVal, 
+		(currentTiming->flags & FB_SYNC_VERT_HIGH_ACT) ? 0 : 1);
+	DBE_SETREG(vt_flags, outputVal);
+
+	/* Turn on the flat panel */
+	switch (flatpanel_id) {
+		case FLATPANEL_SGI_1600SW:
+			fp_wid = 1600;
+			fp_hgt = 1024;
+			fp_vbs = 0;
+			fp_vbe = 1600;
+			currentTiming->pll_m = 4;
+			currentTiming->pll_n = 1;
+			currentTiming->pll_p = 0;
+			break;
+		default:
+      			fp_wid = fp_hgt = fp_vbs = fp_vbe = 0xfff;
+  	}
+
+	outputVal = 0;
+	SET_DBE_FIELD(FP_DE, FP_DE_ON, outputVal, fp_vbs);
+	SET_DBE_FIELD(FP_DE, FP_DE_OFF, outputVal, fp_vbe);
+	DBE_SETREG(fp_de, outputVal);
+	outputVal = 0;
+	SET_DBE_FIELD(FP_HDRV, FP_HDRV_OFF, outputVal, fp_wid);
+	DBE_SETREG(fp_hdrv, outputVal);
+	outputVal = 0;
+	SET_DBE_FIELD(FP_VDRV, FP_VDRV_ON, outputVal, 1);
+	SET_DBE_FIELD(FP_VDRV, FP_VDRV_OFF, outputVal, fp_hgt + 1);
+	DBE_SETREG(fp_vdrv, outputVal);
+}
+
+/*
  *  Set the hardware according to 'par'.
  */
 static int sgivwfb_set_par(struct fb_info *info)
@@ -364,7 +415,7 @@
 	u32 readVal, outputVal;
 	int wholeTilesX, maxPixelsPerTileX;
 	int frmWrite1, frmWrite2, frmWrite3b;
-	struct dbe_timing_info_t *currentTiming; /* Current Video Timing */
+	struct dbe_timing_info *currentTiming; /* Current Video Timing */
 	int xpmax, ypmax;	// Monitor resolution
 	int bytesPerPixel;	// Bytes per pixel
 
@@ -514,6 +565,9 @@
 		      currentTiming->hblank_end - 3);
 	DBE_SETREG(vt_hcmap, outputVal);
 
+	if (flatpanel_id != -1)
+		sgivwfb_setup_flatpanel(currentTiming);
+
 	outputVal = 0;
 	temp = currentTiming->vblank_start - currentTiming->vblank_end - 1;
 	if (temp > 0)
@@ -680,14 +734,16 @@
 {
 	char *this_opt;
 
-	fb_info.fontname[0] = '\0';
-
 	if (!options || !*options)
 		return 0;
 
 	while ((this_opt = strsep(&options, ",")) != NULL) {
-		if (!strncmp(this_opt, "font:", 5))
-			strcpy(fb_info.fontname, this_opt + 5);
+		if (!strncmp(this_opt, "monitor:", 8)) {
+			if (!strncmp(this_opt + 8, "crt", 3))
+				flatpanel_id = -1;
+			else if (!strncmp(this_opt + 8, "1600sw", 6))
+				flatpanel_id = FLATPANEL_SGI_1600SW;
+		}
 	}
 	return 0;
 }
@@ -697,12 +753,11 @@
  */
 int __init sgivwfb_init(void)
 {
-	printk(KERN_INFO "sgivwfb: framebuffer at 0x%lx, size %ldk\n",
-	       sgivwfb_mem_phys, sgivwfb_mem_size / 1024);
+	char *monitor;
 
 	if (!request_mem_region(DBE_REG_PHYS, DBE_REG_SIZE, "sgivwfb")) {
 		printk(KERN_ERR "sgivwfb: couldn't reserve mmio region\n");
-		goto fail_request_mem_region;
+		return -EBUSY;
 	}
 	default_par.regs = (struct asregs *) ioremap_nocache(DBE_REG_PHYS, DBE_REG_SIZE);
 	if (!default_par.regs) {
@@ -710,10 +765,7 @@
 		goto fail_ioremap_regs;
 	}
 
-#ifdef CONFIG_MTRR
-	mtrr_add((unsigned long) sgivwfb_mem_phys, sgivwfb_mem_size,
-		 MTRR_TYPE_WRCOMB, 1);
-#endif
+	mtrr_add(sgivwfb_mem_phys, sgivwfb_mem_size, MTRR_TYPE_WRCOMB, 1);
 
 	sgivwfb_fix.smem_start = sgivwfb_mem_phys;
 	sgivwfb_fix.smem_len = sgivwfb_mem_size;
@@ -722,13 +774,24 @@
 
 	fb_info.node = NODEV;
 	fb_info.fix = sgivwfb_fix;
-	fb_info.var = sgivwfb_var;
+
+	switch (flatpanel_id) {
+		case FLATPANEL_SGI_1600SW:
+			fb_info.var = sgivwfb_var1600sw;
+			monitor = "SGI 1600SW flatpanel";
+			break;
+		default:
+			fb_info.var = sgivwfb_var;
+			monitor = "CRT";
+	}
+
+	printk(KERN_INFO "sgivwfb: %s monitor selected\n", monitor);
+
 	fb_info.fbops = &sgivwfb_ops;
 	fb_info.pseudo_palette = pseudo_palette;
 	fb_info.par = &default_par;
 	fb_info.flags = FBINFO_FLAG_DEFAULT;
 
-	fb_info.screen_base =
 	fb_info.screen_base = ioremap_nocache((unsigned long) sgivwfb_mem_phys, sgivwfb_mem_size);
 	if (!fb_info.screen_base) {
 		printk(KERN_ERR "sgivwfb: couldn't ioremap screen_base\n");
@@ -742,14 +805,16 @@
 		goto fail_register_framebuffer;
 	}
 
-	printk(KERN_INFO "fb%d: SGI BDE frame buffer device, using %ldK of video memory\n", minor(fb_info.node, sgivwfb_mem_size >> 10);
+	printk(KERN_INFO "fb%d: SGI DBE frame buffer device, using %ldK of video memory at %#lx\n",      
+		minor(fb_info.node), sgivwfb_mem_size >> 10, sgivwfb_mem_phys);
 	return 0;
 
-      fail_register_framebuffer:
+fail_register_framebuffer:
 	iounmap((char *) fb_info.screen_base);
-      fail_ioremap_fbmem:
+fail_ioremap_fbmem:
 	iounmap(default_par.regs);
-      fail_ioremap_regs:
+fail_ioremap_regs:
+	release_mem_region(DBE_REG_PHYS, DBE_REG_SIZE);
 	return -ENXIO;
 }
 
@@ -767,6 +832,7 @@
 	dbe_TurnOffDma();
 	iounmap(regs);
 	iounmap(&fb_info.screen_base);
+	release_mem_region(DBE_REG_PHYS, DBE_REG_SIZE);
 }
 
 #endif				/* MODULE */
diff -Nru a/drivers/video/sstfb.c b/drivers/video/sstfb.c
--- a/drivers/video/sstfb.c	Sun Feb 23 22:25:25 2003
+++ b/drivers/video/sstfb.c	Sun Feb 23 22:25:25 2003
@@ -21,7 +21,7 @@
  */
 
 /*
- * The voodoo1 has the following memory mapped adress space:
+ * The voodoo1 has the following memory mapped address space:
  * 0x000000 - 0x3fffff : registers              (4MB)
  * 0x400000 - 0x7fffff : linear frame buffer    (4MB)
  * 0x800000 - 0xffffff : texture memory         (8MB)
diff -Nru a/fs/befs/ChangeLog b/fs/befs/ChangeLog
--- a/fs/befs/ChangeLog	Sun Feb 23 22:25:22 2003
+++ b/fs/befs/ChangeLog	Sun Feb 23 22:25:22 2003
@@ -32,7 +32,7 @@
 * Andrew Farnham <andrewfarnham@uq.net.au> pointed out that the module
 	wouldn't work on older (<2.4.10) kernels due to an unresolved symbol.
 	This is bad, since 2.4.9 is still the current RedHat kernel. I added
-	a workaround for this problem (compatability.h) [WD]
+	a workaround for this problem (compatibility.h) [WD]
 
 * Sergey S. Kostyliov made befs_find_key() use a binary search to find 
 	keys within btree nodes, rather than the linear search we were using 
diff -Nru a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
--- a/fs/befs/linuxvfs.c	Sun Feb 23 22:25:24 2003
+++ b/fs/befs/linuxvfs.c	Sun Feb 23 22:25:24 2003
@@ -22,7 +22,6 @@
 #include "io.h"
 #include "endian.h"
 
-EXPORT_NO_SYMBOLS;
 MODULE_DESCRIPTION("BeOS File System (BeFS) driver");
 MODULE_AUTHOR("Will Dyson");
 MODULE_LICENSE("GPL");
diff -Nru a/fs/binfmt_flat.c b/fs/binfmt_flat.c
--- a/fs/binfmt_flat.c	Sun Feb 23 22:25:21 2003
+++ b/fs/binfmt_flat.c	Sun Feb 23 22:25:21 2003
@@ -80,8 +80,10 @@
 	envp = sp;
 	sp -= argc+1;
 	argv = sp;
-	put_user((unsigned long) envp, --sp);
-	put_user((unsigned long) argv, --sp);
+	if (flat_argvp_envp_on_stack()) {
+		put_user((unsigned long) envp, --sp);
+		put_user((unsigned long) argv, --sp);
+	}
 	put_user(argc,--sp);
 	current->mm->arg_start = (unsigned long) p;
 	while (argc-->0) {
@@ -178,15 +180,28 @@
 	}
 
 	ret = 10;
-	if (buf[3] & EXTRA_FIELD)
+	if (buf[3] & EXTRA_FIELD) {
 		ret += 2 + buf[10] + (buf[11] << 8);
+		if (unlikely(LBUFSIZE == ret)) {
+			DBG_FLAT("binfmt_flat: buffer overflow (EXTRA)?\n");
+			return -ENOEXEC;
+		}
+	}
 	if (buf[3] & ORIG_NAME) {
-		for (; (buf[ret] != 0); ret++)
+		for (; ret < LBUFSIZE && (buf[ret] != 0); ret++)
 			;
+		if (unlikely(LBUFSIZE == ret)) {
+			DBG_FLAT("binfmt_flat: buffer overflow (ORIG_NAME)?\n");
+			return -ENOEXEC;
+		}
 	}
 	if (buf[3] & COMMENT) {
-		for (; (buf[ret] != 0); ret++)
+		for (;  ret < LBUFSIZE && (buf[ret] != 0); ret++)
 			;
+		if (unlikely(LBUFSIZE == ret)) {
+			DBG_FLAT("binfmt_flat: buffer overflow (COMMENT)?\n");
+			return -ENOEXEC;
+		}
 	}
 
 	strm.next_in += ret;
@@ -203,7 +218,7 @@
 
 	while ((ret = zlib_inflate(&strm, Z_NO_FLUSH)) == Z_OK) {
 		ret = bprm->file->f_op->read(bprm->file, buf, LBUFSIZE, &fpos);
-		if (ret == 0)
+		if (ret <= 0)
 			break;
 		if (ret >= (unsigned long) -4096)
 			break;
@@ -361,7 +376,8 @@
 		/*
 		 * because a lot of people do not manage to produce good
 		 * flat binaries,  we leave this printk to help them realise
-		 * the problem.  We only print the error if its * not a script file
+		 * the problem.  We only print the error if it's 
+		 * not a script file.
 		 */
 		if (strncmp(hdr->magic, "#!", 2))
 			printk("BINFMT_FLAT: bad magic/rev (0x%x, need 0x%x)\n",
@@ -652,8 +668,6 @@
 {
 	unregister_binfmt(&flat_format);
 }
-
-EXPORT_NO_SYMBOLS;
 
 module_init(init_flat_binfmt);
 module_exit(exit_flat_binfmt);
diff -Nru a/fs/bio.c b/fs/bio.c
--- a/fs/bio.c	Sun Feb 23 22:25:25 2003
+++ b/fs/bio.c	Sun Feb 23 22:25:25 2003
@@ -52,16 +52,6 @@
 };
 #undef BV
 
-static void *slab_pool_alloc(int gfp_mask, void *data)
-{
-	return kmem_cache_alloc(data, gfp_mask);
-}
-
-static void slab_pool_free(void *ptr, void *data)
-{
-	kmem_cache_free(data, ptr);
-}
-
 static inline struct bio_vec *bvec_alloc(int gfp_mask, int nr, unsigned long *idx)
 {
 	struct biovec_pool *bp;
@@ -749,8 +739,8 @@
 		if (i >= scale)
 			pool_entries >>= 1;
 
-		bp->pool = mempool_create(pool_entries, slab_pool_alloc,
-					slab_pool_free, bp->slab);
+		bp->pool = mempool_create(pool_entries, mempool_alloc_slab,
+					mempool_free_slab, bp->slab);
 		if (!bp->pool)
 			panic("biovec: can't init mempool\n");
 
@@ -766,7 +756,7 @@
 					SLAB_HWCACHE_ALIGN, NULL, NULL);
 	if (!bio_slab)
 		panic("bio: can't create slab cache\n");
-	bio_pool = mempool_create(BIO_POOL_SIZE, slab_pool_alloc, slab_pool_free, bio_slab);
+	bio_pool = mempool_create(BIO_POOL_SIZE, mempool_alloc_slab, mempool_free_slab, bio_slab);
 	if (!bio_pool)
 		panic("bio: can't create mempool\n");
 
diff -Nru a/fs/buffer.c b/fs/buffer.c
--- a/fs/buffer.c	Sun Feb 23 22:25:24 2003
+++ b/fs/buffer.c	Sun Feb 23 22:25:24 2003
@@ -659,8 +659,7 @@
 		struct buffer_head *bh, struct list_head *list)
 {
 	spin_lock(lock);
-	list_del(&bh->b_assoc_buffers);
-	list_add(&bh->b_assoc_buffers, list);
+	list_move_tail(&bh->b_assoc_buffers, list);
 	spin_unlock(lock);
 }
 
diff -Nru a/fs/cifs/CHANGES b/fs/cifs/CHANGES
--- a/fs/cifs/CHANGES	Sun Feb 23 22:25:26 2003
+++ b/fs/cifs/CHANGES	Sun Feb 23 22:25:26 2003
@@ -128,7 +128,7 @@
 Version 0.42
 ------------
 SessionSetup and NegotiateProtocol now work from Big Endian machines.
-Various Big Endian fixes found during testing on the Linux on 390.  Various fixes for compatability with older
+Various Big Endian fixes found during testing on the Linux on 390.  Various fixes for compatibility with older
 versions of 2.4 kernel (now builds and works again on kernels at least as early as 2.4.7).
 
 Version 0.41
diff -Nru a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
--- a/fs/cifs/cifsglob.h	Sun Feb 23 22:25:22 2003
+++ b/fs/cifs/cifsglob.h	Sun Feb 23 22:25:22 2003
@@ -105,7 +105,7 @@
 	char versionMinor;
 	int svlocal:1;		/* local server or remote */
 	atomic_t socketUseCount;	/* indicates if the server has any open cifs sessions */
-	enum statusEnum tcpStatus;	/* what we think the status is */
+	enum statusEnum tcpStatus; /* what we think the status is */
 	struct semaphore tcpSem;
 	struct task_struct *tsk;
 	char server_GUID[16];
@@ -170,7 +170,7 @@
 	struct list_head openFileList;
 	struct semaphore tconSem;
 	struct cifsSesInfo *ses;	/* pointer to session associated with */
-	char treeName[MAX_TREE_SIZE + 1];	/* The ascii or unicode name of this resource depending on the ses->capabilities *//* BB fill in this field */
+	char treeName[MAX_TREE_SIZE + 1]; /* UNC name of resource (in ASCII not UTF) */
 	char *nativeFileSystem;
 	__u16 tid;		/* The 2 byte transaction id */
 	__u16 Flags;		/* optional support bits */
diff -Nru a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
--- a/fs/cifs/cifsproto.h	Sun Feb 23 22:25:21 2003
+++ b/fs/cifs/cifsproto.h	Sun Feb 23 22:25:21 2003
@@ -93,26 +93,26 @@
 			const char *tree, struct cifsTconInfo *tcon,
 			const struct nls_table *);
 
-extern int CIFSFindFirst(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
 			const char *searchName,
 			FILE_DIRECTORY_INFO * findData,
 			T2_FFIRST_RSP_PARMS * findParms,
 			const struct nls_table *nls_codepage,
 			int *pUnicodeFlag,
 			int *pUnixFlag /* if Unix extensions used */ );
-extern int CIFSFindNext(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
 			FILE_DIRECTORY_INFO * findData,
 			T2_FNEXT_RSP_PARMS * findParms,
 			const __u16 searchHandle, const __u32 resumeKey,
 			int *UnicodeFlag, int *pUnixFlag);
 
-extern int CIFSSMBQPathInfo(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
 			const unsigned char *searchName,
 			FILE_ALL_INFO * findData,
 			const struct nls_table *nls_codepage);
 
 extern int CIFSSMBUnixQPathInfo(const int xid,
-			const struct cifsTconInfo *tcon,
+			struct cifsTconInfo *tcon,
 			const unsigned char *searchName,
 			FILE_UNIX_BASIC_INFO * pFindData,
 			const struct nls_table *nls_codepage);
@@ -127,7 +127,7 @@
 			const char *old_path,
 			const struct nls_table *nls_codepage);
 
-extern int CIFSSMBQFSInfo(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon,
 			struct statfs *FSData,
 			const struct nls_table *nls_codepage);
 extern int CIFSSMBQFSAttributeInfo(const int xid,
@@ -150,57 +150,57 @@
 			char *full_path, __u64 mode, __u64 uid,
 			__u64 gid, const struct nls_table *nls_codepage);
 
-extern int CIFSSMBMkDir(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon,
 			const char *newName,
 			const struct nls_table *nls_codepage);
-extern int CIFSSMBRmDir(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon,
 			const char *name, const struct nls_table *nls_codepage);
 
-extern int CIFSSMBDelFile(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon,
 			const char *name,
 			const struct nls_table *nls_codepage);
-extern int CIFSSMBRename(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSSMBRename(const int xid, struct cifsTconInfo *tcon,
 			const char *fromName, const char *toName,
 			const struct nls_table *nls_codepage);
 extern int CIFSCreateHardLink(const int xid,
-			const struct cifsTconInfo *tcon,
+			struct cifsTconInfo *tcon,
 			const char *fromName, const char *toName,
 			const struct nls_table *nls_codepage);
 extern int CIFSUnixCreateHardLink(const int xid,
-			const struct cifsTconInfo *tcon,
+			struct cifsTconInfo *tcon,
 			const char *fromName, const char *toName,
 			const struct nls_table *nls_codepage);
 extern int CIFSUnixCreateSymLink(const int xid,
-			const struct cifsTconInfo *tcon,
+			struct cifsTconInfo *tcon,
 			const char *fromName, const char *toName,
 			const struct nls_table *nls_codepage);
 extern int CIFSSMBUnixQuerySymLink(const int xid,
-			const struct cifsTconInfo *tcon,
+			struct cifsTconInfo *tcon,
 			const unsigned char *searchName,
 			char *syminfo, const int buflen,
 			const struct nls_table *nls_codepage);
 extern int CIFSSMBQueryReparseLinkInfo(const int xid, 
-			const struct cifsTconInfo *tcon,
+			struct cifsTconInfo *tcon,
 			const unsigned char *searchName,
 			char *symlinkinfo, const int buflen, __u16 fid,
 			const struct nls_table *nls_codepage);
 
-extern int CIFSSMBOpen(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
 			const char *fileName, const int disposition,
 			const int access_flags, const int omode,
 			__u16 * netfid, int *pOplock,
 			const struct nls_table *nls_codepage);
-extern int CIFSSMBClose(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSSMBClose(const int xid, struct cifsTconInfo *tcon,
 			const int smb_file_id);
 
-extern int CIFSSMBRead(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSSMBRead(const int xid, struct cifsTconInfo *tcon,
 			const int netfid, unsigned int count,
 			const __u64 lseek, unsigned int *nbytes, char **buf);
-extern int CIFSSMBWrite(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
 			const int netfid, const unsigned int count,
 			const __u64 lseek, unsigned int *nbytes,
 			const char *buf, const int long_op);
-extern int CIFSSMBLock(const int xid, const struct cifsTconInfo *tcon,
+extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
 			const __u16 netfid, const __u64 len,
 			const __u64 offset, const __u32 numUnlock,
 			const __u32 numLock, const __u8 lockType,
diff -Nru a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
--- a/fs/cifs/cifssmb.c	Sun Feb 23 22:25:22 2003
+++ b/fs/cifs/cifssmb.c	Sun Feb 23 22:25:22 2003
@@ -43,16 +43,27 @@
 };
 
 int
-smb_init(int smb_command, int wct, const struct cifsTconInfo *tcon,
+smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
 	 void **request_buf /* returned */ ,
 	 void **response_buf /* returned */ )
 {
 	int rc = 0;
 
-	if(tcon)
-		if(tcon->ses)
+	if(tcon && (tcon->tidStatus == CifsNeedReconnect)) {
+		rc = -EIO;
+		if(tcon->ses) {
+			struct nls_table *nls_codepage = load_nls_default();
 			if(tcon->ses->status == CifsNeedReconnect)
-				setup_session(0, tcon->ses, load_nls_default());
+				rc = setup_session(0, tcon->ses, nls_codepage);
+			if(!rc) {
+				rc = CIFSTCon(0, tcon->ses, tcon->treeName, tcon,
+					nls_codepage);
+				cFYI(1, ("reconnect tcon rc = %d", rc));
+			}
+		}
+	}
+	if(rc)
+		return rc;
 
 	*request_buf = buf_get();
 	if (request_buf == 0) {
@@ -143,7 +154,7 @@
 						pSMBr->u.extended_response.
 						GUID, 16) != 0) {
 						cFYI(1,
-							("UID of server does not match that of previous connection to same ip address"));
+							("UID of server does not match previous connection to same ip address"));
 						memcpy(server->
 							server_GUID,
 							pSMBr->u.
@@ -166,7 +177,8 @@
 			server->capabilities &= ~CAP_EXTENDED_SECURITY;
 		if(sign_CIFS_PDUs == FALSE) {        
 			if(server->secMode & SECMODE_SIGN_REQUIRED)
-				cERROR(1,("Server required CIFS packet signing - enable /proc/fs/cifs/PacketSigningEnabled"));
+				cERROR(1,
+				 ("Server requires /proc/fs/cifs/PacketSigningEnabled"));
 			server->secMode &= ~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED);
 		}
 	}
@@ -188,8 +200,8 @@
 	 *  If last user of the connection and
 	 *  connection alive - disconnect it
 	 *  If this is the last connection on the server session disconnect it
-	 *  (and inside session disconnect we should check if tcp socket needs to 
-	 *  be freed and kernel thread woken up).
+	 *  (and inside session disconnect we should check if tcp socket needs 
+	 *  to be freed and kernel thread woken up).
 	 */
 	if (tcon)
 		down(&tcon->tconSem);
@@ -237,7 +249,7 @@
 	cFYI(1, ("In SMBLogoff for session disconnect"));
 
 	if (ses)
-		down(&ses->sesSem);	/* need to add more places where this sem is checked */
+		down(&ses->sesSem); /* check this sem more places */
 	else
 		return -EIO;
 
@@ -246,10 +258,10 @@
 		up(&ses->sesSem);
 		return -EBUSY;
 	}
-    if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
-        pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
-	rc = smb_init(SMB_COM_LOGOFF_ANDX, 2, 0 /* no tcon anymore */ ,
-		      (void **) &pSMB, (void **) &smb_buffer_response);
+	if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
+		pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
+	rc = smb_init(SMB_COM_LOGOFF_ANDX, 2, 0 /* no tcon anymore */,
+		 (void **) &pSMB, (void **) &smb_buffer_response);
 	if (rc) {
 		up(&ses->sesSem);
 		return rc;
@@ -272,7 +284,7 @@
 }
 
 int
-CIFSSMBDelFile(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon,
 	       const char *fileName, const struct nls_table *nls_codepage)
 {
 	DELETE_FILE_REQ *pSMB = NULL;
@@ -315,7 +327,7 @@
 }
 
 int
-CIFSSMBRmDir(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon,
 	     const char *dirName, const struct nls_table *nls_codepage)
 {
 	DELETE_DIRECTORY_REQ *pSMB = NULL;
@@ -358,7 +370,7 @@
 }
 
 int
-CIFSSMBMkDir(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon,
 	     const char *name, const struct nls_table *nls_codepage)
 {
 	int rc = 0;
@@ -402,7 +414,7 @@
 }
 
 int
-CIFSSMBOpen(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
 	    const char *fileName, const int openDisposition,
 	    const int access_flags, const int create_options, __u16 * netfid,
 	    int *pOplock, const struct nls_table *nls_codepage)
@@ -446,14 +458,15 @@
 	pSMB->AllocationSize = 0;
 	pSMB->FileAttributes = ATTR_NORMAL;	/* XP does not handle ATTR_POSIX_SEMANTICS */
 	/*if ((omode & S_IWUGO) == 0)
-		pSMB->FileAttributes |= ATTR_READONLY;*/	
-    /*  Above line causes problems due to problem with vfs splitting create into
-        two pieces - need to set mode after file created not while it is being created */
+		pSMB->FileAttributes |= ATTR_READONLY;*/
+	/*  Above line causes problems due to vfs splitting create into two
+		pieces - need to set mode after file created not while it is
+		being created */
 	pSMB->FileAttributes = cpu_to_le32(pSMB->FileAttributes);
 	pSMB->ShareAccess = cpu_to_le32(FILE_SHARE_ALL);
 	pSMB->CreateDisposition = cpu_to_le32(openDisposition);
 	pSMB->CreateOptions = cpu_to_le32(create_options);
-	pSMB->ImpersonationLevel = cpu_to_le32(SECURITY_IMPERSONATION);	/* BB ?? BB */
+	pSMB->ImpersonationLevel = cpu_to_le32(SECURITY_IMPERSONATION);	/* BB ??*/
 	pSMB->SecurityFlags =
 	    cpu_to_le32(SECURITY_CONTEXT_TRACKING | SECURITY_EFFECTIVE_ONLY);
 
@@ -470,7 +483,7 @@
 		*netfid = pSMBr->Fid;	/* cifs fid stays in le */
 		/* Do we care about the CreateAction in any cases? */
 
-		/* BB add code to update inode with file sizes from create response */
+		/* BB add code to update inode file sizes from create response */
 	}
 	if (pSMB)
 		buf_release(pSMB);
@@ -483,7 +496,7 @@
 	freed by the caller */
 
 int
-CIFSSMBRead(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBRead(const int xid, struct cifsTconInfo *tcon,
 	    const int netfid, const unsigned int count,
 	    const __u64 lseek, unsigned int *nbytes, char **buf)
 {
@@ -504,9 +517,8 @@
 	pSMB->OffsetLow = cpu_to_le32(lseek & 0xFFFFFFFF);
 	pSMB->OffsetHigh = cpu_to_le32(lseek >> 32);
 	pSMB->Remaining = 0;
-	pSMB->MaxCount = cpu_to_le16(min(count,
-					 (tcon->ses->server->maxBuf -
-					  MAX_CIFS_HDR_SIZE) & 0xFFFFFF00));
+	pSMB->MaxCount = cpu_to_le16(min_t(const unsigned int, count,
+		(tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFF00));
 	pSMB->MaxCountHigh = 0;
 	pSMB->ByteCount = 0;  /* no need to do le conversion since it is 0 */
 
@@ -545,7 +557,7 @@
 }
 
 int
-CIFSSMBWrite(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
 	     const int netfid, const unsigned int count,
 	     const __u64 offset, unsigned int *nbytes, const char *buf,
 	     const int long_op)
@@ -596,7 +608,7 @@
 }
 
 int
-CIFSSMBLock(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
 	    const __u16 smb_file_id, const __u64 len,
 	    const __u64 offset, const __u32 numUnlock,
 	    const __u32 numLock, const __u8 lockType, const int waitFlag)
@@ -639,7 +651,7 @@
 }
 
 int
-CIFSSMBClose(const int xid, const struct cifsTconInfo *tcon, int smb_file_id)
+CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
 {
 	int rc = 0;
 	CLOSE_REQ *pSMB = NULL;
@@ -667,7 +679,7 @@
 }
 
 int
-CIFSSMBRename(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBRename(const int xid, struct cifsTconInfo *tcon,
 	      const char *fromName, const char *toName,
 	      const struct nls_table *nls_codepage)
 {
@@ -697,7 +709,8 @@
 		name_len++;	/* trailing null */
 		name_len *= 2;
 		pSMB->OldFileName[name_len] = 0;	/* pad */
-		pSMB->OldFileName[name_len + 1] = 0x04;	/* strange that protocol requires an ASCII signature byte on Unicode string */
+	/* protocol requires ASCII signature byte on Unicode string */
+		pSMB->OldFileName[name_len + 1] = 0x04;
 		name_len2 =
 		    cifs_strtoUCS((wchar_t *) & pSMB->
 				  OldFileName[name_len + 2], toName, 530,
@@ -710,13 +723,13 @@
 		strncpy(pSMB->OldFileName, fromName, name_len);
 		name_len2 = strnlen(toName, 530);
 		name_len2++;	/* trailing null */
-		pSMB->OldFileName[name_len] = 0x04;	/* 2nd buffer format */
+		pSMB->OldFileName[name_len] = 0x04;  /* 2nd buffer format */
 		strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2);
 		name_len2++;	/* trailing null */
 		name_len2++;	/* signature byte */
 	}
 
-	pSMB->ByteCount = 1 /* 1st signature byte */  + name_len + name_len2;	
+	pSMB->ByteCount = 1 /* 1st signature byte */  + name_len + name_len2;
     /* we could also set search attributes but not needed */
 	pSMB->hdr.smb_buf_length += pSMB->ByteCount;
 	pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
@@ -733,7 +746,7 @@
 }
 
 int
-CIFSUnixCreateSymLink(const int xid, const struct cifsTconInfo *tcon,
+CIFSUnixCreateSymLink(const int xid, struct cifsTconInfo *tcon,
 		      const char *fromName, const char *toName,
 		      const struct nls_table *nls_codepage)
 {
@@ -791,7 +804,8 @@
 
 	pSMB->DataCount = name_len_target;
 	pSMB->MaxParameterCount = cpu_to_le16(2);
-	pSMB->MaxDataCount = cpu_to_le16(1000);	/*BB find exact max SMB from sess */
+	/* BB find exact max on data count below from sess */
+	pSMB->MaxDataCount = cpu_to_le16(1000);
 	pSMB->SetupCount = 1;
 	pSMB->Reserved3 = 0;
 	pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
@@ -820,7 +834,7 @@
 }
 
 int
-CIFSUnixCreateHardLink(const int xid, const struct cifsTconInfo *tcon,
+CIFSUnixCreateHardLink(const int xid, struct cifsTconInfo *tcon,
 		       const char *fromName, const char *toName,
 		       const struct nls_table *nls_codepage)
 {
@@ -877,7 +891,8 @@
 
 	pSMB->DataCount = name_len_target;
 	pSMB->MaxParameterCount = cpu_to_le16(2);
-	pSMB->MaxDataCount = cpu_to_le16(1000);	/* BB find exact max SMB from sess*/
+	/* BB find exact max on data count below from sess*/
+	pSMB->MaxDataCount = cpu_to_le16(1000);
 	pSMB->SetupCount = 1;
 	pSMB->Reserved3 = 0;
 	pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
@@ -904,7 +919,7 @@
 }
 
 int
-CIFSCreateHardLink(const int xid, const struct cifsTconInfo *tcon,
+CIFSCreateHardLink(const int xid, struct cifsTconInfo *tcon,
 		   const char *fromName, const char *toName,
 		   const struct nls_table *nls_codepage)
 {
@@ -937,7 +952,7 @@
 		name_len++;	/* trailing null */
 		name_len *= 2;
 		pSMB->OldFileName[name_len] = 0;	/* pad */
-		pSMB->OldFileName[name_len + 1] = 0x04;	/* strange that protocol requires an ASCII signature byte on Unicode string */
+		pSMB->OldFileName[name_len + 1] = 0x04; 
 		name_len2 =
 		    cifs_strtoUCS((wchar_t *) & pSMB->
 				  OldFileName[name_len + 2], toName, 530,
@@ -972,7 +987,7 @@
 }
 
 int
-CIFSSMBUnixQuerySymLink(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBUnixQuerySymLink(const int xid, struct cifsTconInfo *tcon,
 			const unsigned char *searchName,
 			char *symlinkinfo, const int buflen,
 			const struct nls_table *nls_codepage)
@@ -1007,7 +1022,8 @@
 	    2 /* level */  + 4 /* rsrvd */  + name_len /* incl null */ ;
 	pSMB->TotalDataCount = 0;
 	pSMB->MaxParameterCount = cpu_to_le16(2);
-	pSMB->MaxDataCount = cpu_to_le16(4000);	/* BB find exact max SMB PDU from sess structure BB */
+	/* BB find exact max data count below from sess structure BB */
+	pSMB->MaxDataCount = cpu_to_le16(4000);
 	pSMB->MaxSetupCount = 0;
 	pSMB->Reserved = 0;
 	pSMB->Flags = 0;
@@ -1041,27 +1057,17 @@
 		else {
 			if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) {
 				name_len = UniStrnlen((wchar_t *) ((char *)
-								   &pSMBr->hdr.
-								   Protocol +
-								   pSMBr->
-								   DataOffset),
-						      min(buflen,
-							  (int) pSMBr->
-							  DataCount) / 2);
+					&pSMBr->hdr.Protocol +pSMBr->DataOffset),
+					min_t(const int, buflen,pSMBr->DataCount) / 2);
 				cifs_strfromUCS_le(symlinkinfo,
-						   (wchar_t *) ((char *)
-								&pSMBr->
-								hdr.
-								Protocol +
-								pSMBr->
-								DataOffset),
-						   name_len, nls_codepage);
+					(wchar_t *) ((char *)&pSMBr->hdr.Protocol +
+						pSMBr->DataOffset),
+					name_len, nls_codepage);
 			} else {
 				strncpy(symlinkinfo,
-					(char *) &pSMBr->hdr.Protocol +
-					pSMBr->DataOffset, min(buflen, (int)
-							       pSMBr->
-							       DataCount));
+					(char *) &pSMBr->hdr.Protocol + 
+						pSMBr->DataOffset,
+					min_t(const int, buflen, pSMBr->DataCount));
 			}
 			symlinkinfo[buflen] = 0;
 	/* just in case so calling code does not go off the end of buffer */
@@ -1075,7 +1081,7 @@
 
 
 int
-CIFSSMBQueryReparseLinkInfo(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon,
 			const unsigned char *searchName,
 			char *symlinkinfo, const int buflen,__u16 fid,
 			const struct nls_table *nls_codepage)
@@ -1086,7 +1092,7 @@
 	struct smb_com_transaction_ioctl_req * pSMB;
 	struct smb_com_transaction_ioctl_rsp * pSMBr;
 
-	cFYI(1, ("In Windows reparse style QueryLink info for path %s", searchName));
+	cFYI(1, ("In Windows reparse style QueryLink for path %s", searchName));
 	rc = smb_init(SMB_COM_NT_TRANSACT, 23, tcon, (void **) &pSMB,
 		      (void **) &pSMBr);
 	if (rc)
@@ -1095,7 +1101,8 @@
 	pSMB->TotalParameterCount = 0 ;
 	pSMB->TotalDataCount = 0;
 	pSMB->MaxParameterCount = cpu_to_le16(2);
-	pSMB->MaxDataCount = cpu_to_le16(4000);	/* BB find exact max SMB PDU from sess structure BB */
+	/* BB find exact data count max from sess structure BB */
+	pSMB->MaxDataCount = cpu_to_le16(4000);
 	pSMB->MaxSetupCount = 4;
 	pSMB->Reserved = 0;
 	pSMB->ParameterOffset = 0;
@@ -1122,7 +1129,7 @@
 			rc = -EIO;	/* bad smb */
 		else {
 			if(pSMBr->DataCount && (pSMBr->DataCount < 2048)) {
-		/* could also validata reparse tag && better check name length */
+		/* could also validate reparse tag && better check name length */
 				struct reparse_data * reparse_buf = (struct reparse_data *)
 					((char *)&pSMBr->hdr.Protocol + pSMBr->DataOffset);
 				if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) {
@@ -1137,7 +1144,7 @@
 				} else { /* ASCII names */
 					strncpy(symlinkinfo,reparse_buf->LinkNamesBuf + 
 						reparse_buf->TargetNameOffset, 
-						min(buflen, (int)reparse_buf->TargetNameLen));
+						min_t(const int, buflen, reparse_buf->TargetNameLen));
 				}
 			} else {
 				rc = -EIO;
@@ -1154,7 +1161,7 @@
 }
 
 int
-CIFSSMBQPathInfo(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
 		 const unsigned char *searchName,
 		 FILE_ALL_INFO * pFindData,
 		 const struct nls_table *nls_codepage)
@@ -1216,7 +1223,8 @@
 		cFYI(1, ("Send error in QPathInfo = %d", rc));
 	} else {		/* decode response */
 		pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset);
-		if ((pSMBr->ByteCount < 40) || (pSMBr->DataOffset > 512))	/* BB also check enough total bytes returned */
+		/* BB also check enough total bytes returned */
+		if ((pSMBr->ByteCount < 40) || (pSMBr->DataOffset > 512)) 
 			rc = -EIO;	/* bad smb */
 		else {
 			memcpy((char *) pFindData,
@@ -1230,7 +1238,7 @@
 }
 
 int
-CIFSSMBUnixQPathInfo(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon,
 		     const unsigned char *searchName,
 		     FILE_UNIX_BASIC_INFO * pFindData,
 		     const struct nls_table *nls_codepage)
@@ -1265,7 +1273,8 @@
 	    name_len /* includes null */ ;
 	pSMB->TotalDataCount = 0;
 	pSMB->MaxParameterCount = cpu_to_le16(2);
-	pSMB->MaxDataCount = cpu_to_le16(4000);	/* BB find exact max SMB PDU from sess structure BB */
+	/* BB find exact max SMB PDU from sess structure BB */
+	pSMB->MaxDataCount = cpu_to_le16(4000); 
 	pSMB->MaxSetupCount = 0;
 	pSMB->Reserved = 0;
 	pSMB->Flags = 0;
@@ -1292,7 +1301,8 @@
 		cFYI(1, ("Send error in QPathInfo = %d", rc));
 	} else {		/* decode response */
 		pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset);
-		if ((pSMBr->ByteCount < 40) || (pSMBr->DataOffset > 512))	/* BB also check enough total bytes returned */
+		/* BB also check if enough total bytes returned */
+		if ((pSMBr->ByteCount < 40) || (pSMBr->DataOffset > 512))
 			rc = -EIO;	/* bad smb */
 		else {
 			memcpy((char *) pFindData,
@@ -1307,7 +1317,7 @@
 }
 
 int
-CIFSFindSingle(const int xid, const struct cifsTconInfo *tcon,
+CIFSFindSingle(const int xid, struct cifsTconInfo *tcon,
 	       const char *searchName, FILE_ALL_INFO * findData,
 	       const struct nls_table *nls_codepage)
 {
@@ -1381,7 +1391,7 @@
 }
 
 int
-CIFSFindFirst(const int xid, const struct cifsTconInfo *tcon,
+CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
 	      const char *searchName, FILE_DIRECTORY_INFO * findData,
 	      T2_FFIRST_RSP_PARMS * findParms,
 	      const struct nls_table *nls_codepage, int *pUnicodeFlag,
@@ -1484,7 +1494,7 @@
 }
 
 int
-CIFSFindNext(const int xid, const struct cifsTconInfo *tcon,
+CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
 	     FILE_DIRECTORY_INFO * findData,
 	     T2_FNEXT_RSP_PARMS * findParms, const __u16 searchHandle,
 	     __u32 resumeKey, int *pUnicodeFlag, int *pUnixFlag)
@@ -1661,7 +1671,7 @@
 }
 
 int
-CIFSSMBQFSInfo(const int xid, const struct cifsTconInfo *tcon,
+CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon,
 	       struct statfs *FSData, const struct nls_table *nls_codepage)
 {
 /* level 0x103 SMB_QUERY_FILE_SYSTEM_INFO */
diff -Nru a/fs/cifs/connect.c b/fs/cifs/connect.c
--- a/fs/cifs/connect.c	Sun Feb 23 22:25:26 2003
+++ b/fs/cifs/connect.c	Sun Feb 23 22:25:26 2003
@@ -76,22 +76,32 @@
 	int rc = 0;
 	struct list_head *tmp;
 	struct cifsSesInfo *ses;
+    struct cifsTconInfo *tcon;
 
 	server->tcpStatus = CifsNeedReconnect;
 	server->maxBuf = 0;
 
 	cFYI(1, ("Reconnecting tcp session "));
 
+	/* before reconnecting the tcp session, mark the smb session (uid)
+		and the tid bad so they are not used until reconnected */
 	read_lock(&GlobalSMBSeslock);
 	list_for_each(tmp, &GlobalSMBSessionList) {
 		ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
 		if (ses->server) {
 			if (ses->server == server) {
 				ses->status = CifsNeedReconnect;
+				ses->ipc_tid = 0;
 			}
 		}
 		/* else tcp and smb sessions need reconnection */
 	}
+	list_for_each(tmp, &GlobalTreeConnectionList) {
+		tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
+		if(tcon->ses->server == server) {
+			tcon->tidStatus = CifsNeedReconnect;
+		}
+	}
 	read_unlock(&GlobalSMBSeslock);
 
 	if(server->ssocket) {
@@ -112,6 +122,7 @@
 			schedule_timeout(3 * HZ);
 		} else {
 			server->tcpStatus = CifsGood;
+			wake_up(&server->response_q);
 		}
 	}
 
@@ -174,15 +185,12 @@
 				csocket = server->ssocket;
 				continue;
 			} else { /* find define for the -512 returned at unmount time */
-				cFYI(1,
-				       ("Received error on sock_recvmsg( peek) with length = %d",
+				cFYI(1,("Error on sock_recvmsg(peek) length = %d",
 					length)); 
 			}
 			break;
-		}
-		if (length == 0) {
-			cFYI(1,
-			     ("Zero length peek received - dead session?"));
+		} else if (length == 0) {
+			cFYI(1,("Zero length peek received - dead session?"));
 			cifs_reconnect(server);
 			csocket = server->ssocket;
 			continue;
@@ -507,8 +515,7 @@
 	/* BB lock tcon and server and tcp session and increment use count here? */
 					/* found a match on the TCP session */
 					/* BB check if reconnection needed */
-					cFYI(1,
-					     ("Matched ip, old UNC: %s == new: %s ?",
+					cFYI(1,("Matched ip, old UNC: %s == new: %s ?",
 					      tcon->treeName, uncName));
 					if (strncmp
 					    (tcon->treeName, uncName,
@@ -855,9 +862,9 @@
 					FreeXid(xid);
 					return -ENODEV;
 				} else {
-					rc = CIFSTCon(xid, pSesInfo,
-						      volume_info.UNC,
-						      tcon, cifs_sb->local_nls);
+					rc = CIFSTCon(xid, pSesInfo, 
+						volume_info.UNC,
+						tcon, cifs_sb->local_nls);
 					cFYI(1, ("CIFS Tcon rc = %d", rc));
 				}
 				if (!rc)
@@ -2196,6 +2203,7 @@
 	/* if (rc) rc = map_smb_to_linux_error(smb_buffer_response); */
 	/* above now done in SendReceive */
 	if ((rc == 0) && (tcon != NULL)) {
+        tcon->tidStatus = CifsGood;
 		tcon->tid = smb_buffer_response->Tid;
 		bcc_ptr = pByteArea(smb_buffer_response);
 		length = strnlen(bcc_ptr, BCC(smb_buffer_response) - 2);
diff -Nru a/fs/cifs/file.c b/fs/cifs/file.c
--- a/fs/cifs/file.c	Sun Feb 23 22:25:21 2003
+++ b/fs/cifs/file.c	Sun Feb 23 22:25:21 2003
@@ -423,6 +423,7 @@
 	return rc;
 }
 
+#if 0
 static int
 cifs_writepages(struct address_space *mapping, struct writeback_control *wbc)
 {
@@ -434,6 +435,7 @@
 	FreeXid(xid);
 	return rc;
 }
+#endif
 
 static int
 cifs_writepage(struct page* page, struct writeback_control *wbc)
@@ -635,7 +637,7 @@
 		}
 
 		page_cache_get(page);
-		target = kmap(page);
+		target = kmap_atomic(page,KM_USER0);
 
 		if(PAGE_CACHE_SIZE > bytes_read) {
 			memcpy(target,data,bytes_read);
@@ -649,7 +651,7 @@
 			__pagevec_lru_add(plru_pvec);
 		flush_dcache_page(page);
 		SetPageUptodate(page);
-		kunmap(page);
+		kunmap_atomic(page,KM_USER0);
 		unlock_page(page);
 		page_cache_release(page);
 		data += PAGE_CACHE_SIZE;
diff -Nru a/fs/cifs/misc.c b/fs/cifs/misc.c
--- a/fs/cifs/misc.c	Sun Feb 23 22:25:26 2003
+++ b/fs/cifs/misc.c	Sun Feb 23 22:25:26 2003
@@ -70,6 +70,7 @@
 		memset(ret_buf, 0, sizeof (struct cifsSesInfo));
 		write_lock(&GlobalSMBSeslock);
 		atomic_inc(&sesInfoAllocCount);
+		ret_buf->status = CifsNew;
 		list_add(&ret_buf->cifsSessionList, &GlobalSMBSessionList);
 		init_MUTEX(&ret_buf->sesSem);
 		write_unlock(&GlobalSMBSeslock);
@@ -111,6 +112,7 @@
 		atomic_inc(&tconInfoAllocCount);
 		list_add(&ret_buf->cifsConnectionList,
 			 &GlobalTreeConnectionList);
+		ret_buf->tidStatus = CifsNew;
 		INIT_LIST_HEAD(&ret_buf->openFileList);
 		init_MUTEX(&ret_buf->tconSem);
 		write_unlock(&GlobalSMBSeslock);
diff -Nru a/fs/cifs/transport.c b/fs/cifs/transport.c
--- a/fs/cifs/transport.c	Sun Feb 23 22:25:22 2003
+++ b/fs/cifs/transport.c	Sun Feb 23 22:25:22 2003
@@ -37,6 +37,7 @@
 AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
 {
 	struct mid_q_entry *temp;
+	int timeout = 10 * HZ;
 
 /* BB add spinlock to protect midq for each session BB */
 	if (ses == NULL) {
@@ -57,13 +58,22 @@
 		temp->ses = ses;
 		temp->tsk = current;
 	}
+
+	while ((ses->server->tcpStatus != CifsGood) && (timeout > 0)){ 
+		/* Give the tcp thread up to 10 seconds to reconnect */
+		/* Should we wake up tcp thread first? BB  */
+		timeout = wait_event_interruptible_timeout(ses->server->response_q,
+			(ses->server->tcpStatus == CifsGood), timeout);
+        cFYI(1,("timeout (after reconnection wait) %d",timeout));
+	}
+
 	if (ses->server->tcpStatus == CifsGood) {
 		write_lock(&GlobalMid_Lock);
 		list_add_tail(&temp->qhead, &ses->server->pending_mid_q);
 		atomic_inc(&midCount);
 		temp->midState = MID_REQUEST_ALLOCATED;
 		write_unlock(&GlobalMid_Lock);
-	} else {		/* could add more reconnect code here BB */
+	} else { 
 		cERROR(1,("Need to reconnect after session died to server"));
 		if (temp)
 			kmem_cache_free(cifs_mid_cachep, temp);
@@ -106,16 +116,16 @@
 	smb_msg.msg_iovlen = 1;
 	smb_msg.msg_control = NULL;
 	smb_msg.msg_controllen = 0;
-	smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL;	/* BB add more flags? */
+	smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/
 
-	/* smb header is converted in header_assemble. bcc and rest of SMB word area, 
-	   and byte area if necessary, is converted to littleendian in cifssmb.c and RFC1001 
-	   len is converted to bigendian in smb_send */
+	/* smb header is converted in header_assemble. bcc and rest of SMB word
+	   area, and byte area if necessary, is converted to littleendian in 
+	   cifssmb.c and RFC1001 len is converted to bigendian in smb_send */
 	if (smb_buf_length > 12)
 		smb_buffer->Flags2 = cpu_to_le16(smb_buffer->Flags2);
 
-    /* if(smb_buffer->Flags2 & SMBFLG2_SECURITY_SIGNATURE)
-        sign_smb(smb_buffer); */ /* BB enable when signing tested more */
+	/* if(smb_buffer->Flags2 & SMBFLG2_SECURITY_SIGNATURE)
+		sign_smb(smb_buffer); */ /* BB enable when signing tested more */
 
 	smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length);
 	cFYI(1, ("Sending smb of length %d ", smb_buf_length));
@@ -148,7 +158,7 @@
 
 	midQ = AllocMidQEntry(in_buf, ses);
 	if (midQ == NULL)
-		return -EIO;	/* reconnect should be done, if possible, in AllocMidQEntry */
+		return -EIO;
 	if (in_buf->smb_buf_length > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE) {
 		cERROR(1,
 		       ("Illegal length, greater than maximum frame, %d ",
@@ -219,7 +229,7 @@
 			*pbytes_returned = out_buf->smb_buf_length;
 
 			/* BB special case reconnect tid and reconnect uid here? */
-			rc = map_smb_to_linux_error(out_buf);	/* BB watch endianness here BB */
+			rc = map_smb_to_linux_error(out_buf);
 
 			/* convert ByteCount if necessary */
 			if (receive_len >=
diff -Nru a/fs/exec.c b/fs/exec.c
--- a/fs/exec.c	Sun Feb 23 22:25:23 2003
+++ b/fs/exec.c	Sun Feb 23 22:25:23 2003
@@ -823,6 +823,7 @@
 			
 	flush_signal_handlers(current);
 	flush_old_files(current->files);
+	exit_itimers(current);
 
 	return 0;
 
diff -Nru a/fs/file_table.c b/fs/file_table.c
--- a/fs/file_table.c	Sun Feb 23 22:25:21 2003
+++ b/fs/file_table.c	Sun Feb 23 22:25:21 2003
@@ -188,6 +188,13 @@
 	file_list_unlock();
 }
 
+void file_kill(struct file *file)
+{
+	file_list_lock();
+	list_del_init(&file->f_list);
+	file_list_unlock();
+}
+
 int fs_may_remount_ro(struct super_block *sb)
 {
 	struct list_head *p;
diff -Nru a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
--- a/fs/jffs2/wbuf.c	Sun Feb 23 22:25:22 2003
+++ b/fs/jffs2/wbuf.c	Sun Feb 23 22:25:22 2003
@@ -256,7 +256,7 @@
 	if (!c->wbuf)
 		return jffs2_flash_direct_writev(c, invecs, count, to, retlen);
 	
-	/* If wbuf_ofs is not initialized, set it to target adress */
+	/* If wbuf_ofs is not initialized, set it to target address */
 	if (c->wbuf_ofs == 0xFFFFFFFF) {
 		c->wbuf_ofs = PAGE_DIV(to);
 		c->wbuf_len = PAGE_MOD(to);			
diff -Nru a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
--- a/fs/jfs/jfs_metapage.c	Sun Feb 23 22:25:22 2003
+++ b/fs/jfs/jfs_metapage.c	Sun Feb 23 22:25:22 2003
@@ -120,15 +120,6 @@
 	mempool_free(mp, metapage_mempool);
 }
 
-static void *mp_mempool_alloc(int gfp_mask, void *pool_data)
-{
-	return kmem_cache_alloc(metapage_cache, gfp_mask);
-}
-static void mp_mempool_free(void *element, void *pool_data)
-{
-	return kmem_cache_free(metapage_cache, element);
-}
-
 int __init metapage_init(void)
 {
 	/*
@@ -139,8 +130,8 @@
 	if (metapage_cache == NULL)
 		return -ENOMEM;
 
-	metapage_mempool = mempool_create(METAPOOL_MIN_PAGES, mp_mempool_alloc,
-					  mp_mempool_free, NULL);
+	metapage_mempool = mempool_create(METAPOOL_MIN_PAGES, mempool_alloc_slab,
+					  mempool_free_slab, metapage_cache);
 
 	if (metapage_mempool == NULL) {
 		kmem_cache_destroy(metapage_cache);
diff -Nru a/fs/nfsctl.c b/fs/nfsctl.c
--- a/fs/nfsctl.c	Sun Feb 23 22:25:27 2003
+++ b/fs/nfsctl.c	Sun Feb 23 22:25:27 2003
@@ -54,13 +54,36 @@
 static struct {
 	char *name; int wsize; int rsize;
 } map[] = {
-	[NFSCTL_SVC]={".svc", sizeof(struct nfsctl_svc)},
-	[NFSCTL_ADDCLIENT]={".add", sizeof(struct nfsctl_client)},
-	[NFSCTL_DELCLIENT]={".del", sizeof(struct nfsctl_client)},
-	[NFSCTL_EXPORT]={".export", sizeof(struct nfsctl_export)},
-	[NFSCTL_UNEXPORT]={".unexport", sizeof(struct nfsctl_export)},
-	[NFSCTL_GETFD]={".getfd", sizeof(struct nfsctl_fdparm), NFS_FHSIZE},
-	[NFSCTL_GETFS]={".getfs", sizeof(struct nfsctl_fsparm), sizeof(struct knfsd_fh)},
+	[NFSCTL_SVC] = {
+		.name	= ".svc",
+		.wsize	= sizeof(struct nfsctl_svc)
+	},
+	[NFSCTL_ADDCLIENT] = {
+		.name	= ".add",
+		.wsize	= sizeof(struct nfsctl_client)
+	},
+	[NFSCTL_DELCLIENT] = {
+		.name	= ".del",
+		.wsize	= sizeof(struct nfsctl_client)
+	},
+	[NFSCTL_EXPORT] = {
+		.name	= ".export",
+		.wsize	= sizeof(struct nfsctl_export)
+	},
+	[NFSCTL_UNEXPORT] = {
+		.name	= ".unexport",
+		.wsize	= sizeof(struct nfsctl_export)
+	},
+	[NFSCTL_GETFD] = {
+		.name	= ".getfd",
+		.wsize	= sizeof(struct nfsctl_fdparm),
+		.rsize	= NFS_FHSIZE
+	},
+	[NFSCTL_GETFS] = {
+		.name	= ".getfs",
+		.wsize	= sizeof(struct nfsctl_fsparm),
+		.rsize	= sizeof(struct knfsd_fh)
+	},
 };
 
 long
diff -Nru a/fs/nfsd/export.c b/fs/nfsd/export.c
--- a/fs/nfsd/export.c	Sun Feb 23 22:25:24 2003
+++ b/fs/nfsd/export.c	Sun Feb 23 22:25:24 2003
@@ -692,7 +692,7 @@
 	new.ex_anon_gid = nxp->ex_anon_gid;
 	new.ex_fsid = nxp->ex_dev;
 
-	exp = svc_export_lookup(&new, 2);
+	exp = svc_export_lookup(&new, 1);
 
 	if (exp == NULL)
 		goto finish;
diff -Nru a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
--- a/fs/nfsd/nfs3proc.c	Sun Feb 23 22:25:23 2003
+++ b/fs/nfsd/nfs3proc.c	Sun Feb 23 22:25:23 2003
@@ -317,11 +317,10 @@
 	if (argp->ftype == 0 || argp->ftype >= NF3BAD)
 		RETURN_STATUS(nfserr_inval);
 	if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
-		if ((argp->ftype == NF3CHR && argp->major >= MAX_CHRDEV)
-		    || (argp->ftype == NF3BLK && argp->major >= MAX_BLKDEV)
-		    || argp->minor > 0xFF)
-			RETURN_STATUS(nfserr_inval);
 		rdev = MKDEV(argp->major, argp->minor);
+		if (MAJOR(rdev) != argp->major ||
+		    MINOR(rdev) != argp->minor)
+			RETURN_STATUS(nfserr_inval);
 	} else
 		if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO)
 			RETURN_STATUS(nfserr_inval);
diff -Nru a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
--- a/fs/nfsd/nfs3xdr.c	Sun Feb 23 22:25:21 2003
+++ b/fs/nfsd/nfs3xdr.c	Sun Feb 23 22:25:21 2003
@@ -202,7 +202,6 @@
 static inline u32 *
 encode_saved_post_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
 {
-	struct timespec  time;
 	struct inode	*inode = fhp->fh_dentry->d_inode;
 
 	/* Attributes to follow */
@@ -228,13 +227,9 @@
 	else
 		p = xdr_encode_hyper(p, (u64) inode->i_sb->s_dev);
 	p = xdr_encode_hyper(p, (u64) inode->i_ino);
-	time.tv_sec = fhp->fh_post_atime; 
-	time.tv_nsec = 0;
-	p = encode_time3(p, &time);
-	time.tv_sec = fhp->fh_post_mtime;
-	p = encode_time3(p, &time);
-	time.tv_sec = fhp->fh_post_ctime; 
-	p = encode_time3(p, &time);
+	p = encode_time3(p, &fhp->fh_post_atime);
+	p = encode_time3(p, &fhp->fh_post_mtime);
+	p = encode_time3(p, &fhp->fh_post_ctime);
 
 	return p;
 }
@@ -266,14 +261,10 @@
 
 	if (dentry && dentry->d_inode && fhp->fh_post_saved) {
 		if (fhp->fh_pre_saved) {
-			struct timespec time;
 			*p++ = xdr_one;
 			p = xdr_encode_hyper(p, (u64) fhp->fh_pre_size);
-			time.tv_nsec = 0;
-			time.tv_sec =  fhp->fh_pre_mtime;
-			p = encode_time3(p, &time);
-			time.tv_sec = fhp->fh_pre_ctime;
-			p = encode_time3(p, &time);
+			p = encode_time3(p, &fhp->fh_pre_mtime);
+			p = encode_time3(p, &fhp->fh_pre_ctime);
 		} else {
 			*p++ = xdr_zero;
 		}
@@ -578,6 +569,9 @@
 	args->dircount = ntohl(*p++);
 	args->count    = ntohl(*p++);
 
+	if (args->count > PAGE_SIZE)
+		args->count = PAGE_SIZE;
+
 	svc_take_page(rqstp);
 	args->buffer = page_address(rqstp->rq_respages[rqstp->rq_resused-1]);
 
@@ -664,6 +658,7 @@
 		rqstp->rq_res.page_len = resp->len;
 		if (resp->len & 3) {
 			/* need to pad the tail */
+			rqstp->rq_restailpage = 0;
 			rqstp->rq_res.tail[0].iov_base = p;
 			*p = 0;
 			rqstp->rq_res.tail[0].iov_len = 4 - (resp->len&3);
@@ -688,6 +683,7 @@
 		rqstp->rq_res.page_len = resp->count;
 		if (resp->count & 3) {
 			/* need to pad the tail */
+			rqstp->rq_restailpage = 0;
 			rqstp->rq_res.tail[0].iov_base = p;
 			*p = 0;
 			rqstp->rq_res.tail[0].iov_len = 4 - (resp->count & 3);
diff -Nru a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
--- a/fs/nfsd/nfs4proc.c	Sun Feb 23 22:25:27 2003
+++ b/fs/nfsd/nfs4proc.c	Sun Feb 23 22:25:27 2003
@@ -264,6 +264,7 @@
 {
 	struct svc_fh resfh;
 	int status;
+	dev_t rdev;
 
 	fh_init(&resfh, NFS4_FHSIZE);
 
@@ -288,21 +289,23 @@
 		break;
 
 	case NF4BLK:
-		if (create->cr_specdata1 >= MAX_BLKDEV || create->cr_specdata2 > 0xFF)
+		rdev = MKDEV(create->cr_specdata1, create->cr_specdata2);
+		if (MAJOR(rdev) != create->cr_specdata1 ||
+		    MINOR(rdev) != create->cr_specdata2)
 			return nfserr_inval;
 		status = nfsd_create(rqstp, current_fh, create->cr_name,
-				     create->cr_namelen, &create->cr_iattr, S_IFBLK,
-				     MKDEV(create->cr_specdata1, create->cr_specdata2),
-				     &resfh);
+				     create->cr_namelen, &create->cr_iattr,
+				     S_IFBLK, rdev, &resfh);
 		break;
 
 	case NF4CHR:
-		if (create->cr_specdata1 >= MAX_CHRDEV || create->cr_specdata2 > 0xFF)
+		rdev = MKDEV(create->cr_specdata1, create->cr_specdata2);
+		if (MAJOR(rdev) != create->cr_specdata1 ||
+		    MINOR(rdev) != create->cr_specdata2)
 			return nfserr_inval;
 		status = nfsd_create(rqstp, current_fh, create->cr_name,
-				     create->cr_namelen, &create->cr_iattr, S_IFCHR,
-				     MKDEV(create->cr_specdata1, create->cr_specdata2),
-				     &resfh);
+				     create->cr_namelen, &create->cr_iattr,
+				     S_IFCHR, rdev, &resfh);
 		break;
 
 	case NF4SOCK:
@@ -568,9 +571,9 @@
 
 	resp->xbuf = &rqstp->rq_res;
 	resp->p = rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len;
-	resp->tagp = resp->p + 1; /* skip over status */
-	/* reserve space for: status, taglen, tag, and opcnt */
-	resp->p += 3 + XDR_QUADLEN(args->taglen);
+	resp->tagp = resp->p;
+	/* reserve space for: taglen, tag, and opcnt */
+	resp->p += 2 + XDR_QUADLEN(args->taglen);
 	resp->end = rqstp->rq_res.head[0].iov_base + PAGE_SIZE;
 	resp->taglen = args->taglen;
 	resp->tag = args->tag;
diff -Nru a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
--- a/fs/nfsd/nfs4xdr.c	Sun Feb 23 22:25:26 2003
+++ b/fs/nfsd/nfs4xdr.c	Sun Feb 23 22:25:26 2003
@@ -1735,6 +1735,7 @@
 	svc_take_page(resp->rqstp);
 	resp->xbuf->tail[0].iov_base = 
 		page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]);
+	resp->rqstp->rq_restailpage = resp->rqstp->rq_resused-1;
 	resp->xbuf->tail[0].iov_len = 0;
 	resp->p = resp->xbuf->tail[0].iov_base;
 	resp->end = resp->p + PAGE_SIZE/4;
@@ -1782,6 +1783,7 @@
 	svc_take_page(resp->rqstp);
 	resp->xbuf->tail[0].iov_base = 
 		page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]);
+	resp->rqstp->rq_restailpage = resp->rqstp->rq_resused-1;
 	resp->xbuf->tail[0].iov_len = 0;
 	resp->p = resp->xbuf->tail[0].iov_base;
 	resp->end = resp->p + PAGE_SIZE/4;
@@ -1859,6 +1861,7 @@
 	svc_take_page(resp->rqstp);
 	resp->xbuf->tail[0].iov_base = 
 		page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused-1]);
+	resp->rqstp->rq_restailpage = resp->rqstp->rq_resused-1;
 	resp->xbuf->tail[0].iov_len = 0;
 	resp->p = resp->xbuf->tail[0].iov_base;
 	resp->end = resp->p + PAGE_SIZE/4;
diff -Nru a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
--- a/fs/nfsd/nfssvc.c	Sun Feb 23 22:25:24 2003
+++ b/fs/nfsd/nfssvc.c	Sun Feb 23 22:25:24 2003
@@ -264,6 +264,7 @@
 	struct svc_procedure	*proc;
 	kxdrproc_t		xdr;
 	u32			nfserr;
+	u32			*nfserrp;
 
 	dprintk("nfsd_dispatch: vers %d proc %d\n",
 				rqstp->rq_vers, rqstp->rq_proc);
@@ -290,6 +291,13 @@
 		return 1;
 	}
 
+	/* need to grab the location to store the status, as
+	 * nfsv4 does some encoding while processing 
+	 */
+	nfserrp = rqstp->rq_res.head[0].iov_base
+		+ rqstp->rq_res.head[0].iov_len;
+	rqstp->rq_res.head[0].iov_len += sizeof(u32);
+
 	/* Now call the procedure handler, and encode NFS status. */
 	nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
 	if (nfserr == nfserr_dropit) {
@@ -297,16 +305,16 @@
 		nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
 		return 0;
 	}
-		
+
 	if (rqstp->rq_proc != 0)
-		svc_putu32(&rqstp->rq_res.head[0], nfserr);
+		*nfserrp++ = nfserr;
 
 	/* Encode result.
 	 * For NFSv2, additional info is never returned in case of an error.
 	 */
 	if (!(nfserr && rqstp->rq_vers == 2)) {
 		xdr = proc->pc_encode;
-		if (xdr && !xdr(rqstp, (u32*)(rqstp->rq_res.head[0].iov_base+rqstp->rq_res.head[0].iov_len),
+		if (xdr && !xdr(rqstp, nfserrp,
 				rqstp->rq_resp)) {
 			/* Failed to encode result. Release cache entry */
 			dprintk("nfsd: failed to encode result!\n");
diff -Nru a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
--- a/fs/nfsd/nfsxdr.c	Sun Feb 23 22:25:21 2003
+++ b/fs/nfsd/nfsxdr.c	Sun Feb 23 22:25:21 2003
@@ -396,6 +396,7 @@
 	rqstp->rq_res.page_len = resp->len;
 	if (resp->len & 3) {
 		/* need to pad the tail */
+		rqstp->rq_restailpage = 0;
 		rqstp->rq_res.tail[0].iov_base = p;
 		*p = 0;
 		rqstp->rq_res.tail[0].iov_len = 4 - (resp->len&3);
@@ -415,6 +416,7 @@
 	rqstp->rq_res.page_len = resp->count;
 	if (resp->count & 3) {
 		/* need to pad the tail */
+		rqstp->rq_restailpage = 0;
 		rqstp->rq_res.tail[0].iov_base = p;
 		*p = 0;
 		rqstp->rq_res.tail[0].iov_len = 4 - (resp->count&3);
diff -Nru a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
--- a/fs/ntfs/attrib.c	Sun Feb 23 22:25:27 2003
+++ b/fs/ntfs/attrib.c	Sun Feb 23 22:25:27 2003
@@ -1183,7 +1183,8 @@
 			register int rc;
 			
 			rc = memcmp(val, (u8*)a + le16_to_cpu(
-					a->_ARA(value_offset)), min(val_len,
+					a->_ARA(value_offset)), 
+				    	min_t(const u32, val_len,
 					le32_to_cpu(a->_ARA(value_length))));
 			/*
 			 * If @val collates before the current attribute's
diff -Nru a/fs/ntfs/mst.c b/fs/ntfs/mst.c
--- a/fs/ntfs/mst.c	Sun Feb 23 22:25:25 2003
+++ b/fs/ntfs/mst.c	Sun Feb 23 22:25:25 2003
@@ -114,7 +114,7 @@
  * mean that the structure is not subject to protection and hence doesn't need
  * to be fixed up. This means that you have to create a valid update sequence
  * array header in the ntfs record before calling this function, otherwise it
- * will fail (the header needs to contain the position of the update seqeuence
+ * will fail (the header needs to contain the position of the update sequence
  * array together with the number of elements in the array). You also need to
  * initialise the update sequence number before calling this function
  * otherwise a random word will be used (whatever was in the record at that
diff -Nru a/fs/ntfs/unistr.c b/fs/ntfs/unistr.c
--- a/fs/ntfs/unistr.c	Sun Feb 23 22:25:25 2003
+++ b/fs/ntfs/unistr.c	Sun Feb 23 22:25:25 2003
@@ -96,10 +96,10 @@
 		const int err_val, const IGNORE_CASE_BOOL ic,
 		const uchar_t *upcase, const u32 upcase_len)
 {
-	u32 cnt, min_len;
+	u32 cnt;
+	const u32 min_len = min_t(const u32, name1_len, name2_len);
 	uchar_t c1, c2;
 
-	min_len = min(name1_len, name2_len);
 	for (cnt = 0; cnt < min_len; ++cnt) {
 		c1 = le16_to_cpu(*name1++);
 		c2 = le16_to_cpu(*name2++);
diff -Nru a/fs/open.c b/fs/open.c
--- a/fs/open.c	Sun Feb 23 22:25:21 2003
+++ b/fs/open.c	Sun Feb 23 22:25:21 2003
@@ -638,7 +638,6 @@
 {
 	struct file * f;
 	struct inode *inode;
-	static LIST_HEAD(kill_list);
 	int error;
 
 	error = -ENFILE;
@@ -683,7 +682,7 @@
 	fops_put(f->f_op);
 	if (f->f_mode & FMODE_WRITE)
 		put_write_access(inode);
-	file_move(f, &kill_list); /* out of the way.. */
+	file_kill(f);
 	f->f_dentry = NULL;
 	f->f_vfsmnt = NULL;
 cleanup_file:
diff -Nru a/fs/partitions/msdos.c b/fs/partitions/msdos.c
--- a/fs/partitions/msdos.c	Sun Feb 23 22:25:25 2003
+++ b/fs/partitions/msdos.c	Sun Feb 23 22:25:25 2003
@@ -377,7 +377,7 @@
 	void (*parse)(struct parsed_partitions *, struct block_device *,
 			u32, u32, int);
 } subtypes[] = {
-	{BSD_PARTITION, parse_freebsd},
+	{FREEBSD_PARTITION, parse_freebsd},
 	{NETBSD_PARTITION, parse_netbsd},
 	{OPENBSD_PARTITION, parse_openbsd},
 	{MINIX_PARTITION, parse_minix},
diff -Nru a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
--- a/fs/proc/task_nommu.c	Sun Feb 23 22:25:24 2003
+++ b/fs/proc/task_nommu.c	Sun Feb 23 22:25:24 2003
@@ -1,5 +1,6 @@
 
 #include <linux/mm.h>
+#include <linux/file.h>
 
 /*
  * Logic: we've got two memory sums for each process, "shared", and
@@ -44,10 +45,10 @@
 	else
 		bytes += kobjsize(current->files);
 
-	if (current->sig && atomic_read(&current->sig->count) > 1)
-		sbytes += kobjsize(current->sig);
+	if (current->sighand && atomic_read(&current->sighand->count) > 1)
+		sbytes += kobjsize(current->sighand);
 	else
-		bytes += kobjsize(current->sig);
+		bytes += kobjsize(current->sighand);
 
 	bytes += kobjsize(current); /* includes kernel stack */
 
@@ -64,7 +65,7 @@
 unsigned long task_vsize(struct mm_struct *mm)
 {
 	struct mm_tblock_struct *tbp;
-	unsigned long vsize;
+	unsigned long vsize = 0;
 
 	for (tbp = &mm->context.tblock; tbp; tbp = tbp->next) {
 		if (tbp->rblock)
@@ -89,8 +90,8 @@
 		}
 	}
 
-	size += (text = mm->end_code - mm->start_code);
-	size += (data = mm->start_stack - mm->start_data);
+	size += (*text = mm->end_code - mm->start_code);
+	size += (*data = mm->start_stack - mm->start_data);
 
 	*resident = size;
 	return size;
diff -Nru a/fs/quota_v1.c b/fs/quota_v1.c
--- a/fs/quota_v1.c	Sun Feb 23 22:25:25 2003
+++ b/fs/quota_v1.c	Sun Feb 23 22:25:25 2003
@@ -234,8 +234,6 @@
         unregister_quota_format(&v1_quota_format);
 }
 
-EXPORT_NO_SYMBOLS;
-
 module_init(init_v1_quota_format);
 module_exit(exit_v1_quota_format);
 
diff -Nru a/fs/quota_v2.c b/fs/quota_v2.c
--- a/fs/quota_v2.c	Sun Feb 23 22:25:26 2003
+++ b/fs/quota_v2.c	Sun Feb 23 22:25:26 2003
@@ -688,7 +688,5 @@
 	unregister_quota_format(&v2_quota_format);
 }
 
-EXPORT_NO_SYMBOLS;
-
 module_init(init_v2_quota_format);
 module_exit(exit_v2_quota_format);
diff -Nru a/fs/xfs/linux/xfs_aops.c b/fs/xfs/linux/xfs_aops.c
--- a/fs/xfs/linux/xfs_aops.c	Sun Feb 23 22:25:26 2003
+++ b/fs/xfs/linux/xfs_aops.c	Sun Feb 23 22:25:26 2003
@@ -53,12 +53,15 @@
 		count = max_t(ssize_t, count, XFS_WRITE_IO_LOG);
 retry:
 	VOP_BMAP(vp, offset, count, flags, pbmapp, &nmaps, error);
-	if (flags & PBF_WRITE) {
-		if (unlikely((flags & PBF_DIRECT) && nmaps &&
-		    (pbmapp->pbm_flags & PBMF_DELAY))) {
-			flags = PBF_FILE_ALLOCATE;
-			goto retry;
-		}
+	if (error == EAGAIN)
+		return -error;
+	if (unlikely((flags & (PBF_WRITE|PBF_DIRECT)) ==
+					(PBF_WRITE|PBF_DIRECT) && nmaps &&
+					(pbmapp->pbm_flags & PBMF_DELAY))) {
+		flags = PBF_FILE_ALLOCATE;
+		goto retry;
+	}
+	if (flags & (PBF_WRITE|PBF_FILE_ALLOCATE)) {
 		VMODIFY(vp);
 	}
 	return -error;
@@ -309,6 +312,7 @@
 		if (startio && (offset < end)) {
 			bh_arr[index++] = bh;
 		} else {
+			set_buffer_dirty(bh);
 			unlock_buffer(bh);
 		}
 	} while (i++, (bh = bh->b_this_page) != head);
@@ -365,9 +369,9 @@
 
 STATIC int
 delalloc_convert(
-	struct page		*page,
-	int			startio,
-	int			allocate_space)
+	struct page	*page,
+	int		startio,
+	int		unmapped) /* also implies page uptodate */
 {
 	struct inode		*inode = page->mapping->host;
 	struct buffer_head	*bh_arr[MAX_BUF_PER_PAGE], *bh, *head;
@@ -375,6 +379,9 @@
 	unsigned long		p_offset = 0, end_index;
 	loff_t			offset, end_offset;
 	int			len, err, i, cnt = 0, uptodate = 1;
+	int			flags = startio ? 0 : PBF_TRYLOCK;
+	int			page_dirty = 1;
+
 
 	/* Are we off the end of the file ? */
 	end_index = inode->i_size >> PAGE_CACHE_SHIFT;
@@ -390,9 +397,6 @@
 	if (end_offset > inode->i_size)
 		end_offset = inode->i_size;
 
-	if (startio && !page_has_buffers(page))
-		create_empty_buffers(page, 1 << inode->i_blkbits, 0);
-
 	bh = head = page_buffers(page);
 	mp = NULL;
 
@@ -406,10 +410,14 @@
 			mp = match_offset_to_mapping(page, &map, p_offset);
 		}
 
+		/*
+		 * First case, allocate space for delalloc buffer head
+		 * we can return EAGAIN here in the release page case.
+		 */
 		if (buffer_delay(bh)) {
 			if (!mp) {
 				err = map_blocks(inode, offset, len, &map,
-						PBF_FILE_ALLOCATE);
+					PBF_FILE_ALLOCATE | flags);
 				if (err) {
 					goto error;
 				}
@@ -422,14 +430,17 @@
 				if (startio) {
 					bh_arr[cnt++] = bh;
 				} else {
+					set_buffer_dirty(bh);
 					unlock_buffer(bh);
 				}
+				page_dirty = 0;
 			}
 		} else if ((buffer_uptodate(bh) || PageUptodate(page)) &&
-			   (allocate_space || startio)) {
+			   (unmapped || startio)) {
+
 			if (!buffer_mapped(bh)) {
 				int	size;
-				
+
 				/*
 				 * Getting here implies an unmapped buffer
 				 * was found, and we are in a path where we
@@ -454,13 +465,16 @@
 					if (startio) {
 						bh_arr[cnt++] = bh;
 					} else {
+						set_buffer_dirty(bh);
 						unlock_buffer(bh);
 					}
+					page_dirty = 0;
 				}
-			} else if (startio && buffer_mapped(bh)) {
-				if (buffer_uptodate(bh) && allocate_space) {
+			} else if (startio) {
+				if (buffer_uptodate(bh)) {
 					lock_buffer(bh);
 					bh_arr[cnt++] = bh;
+					page_dirty = 0;
 				}
 			}
 		}
@@ -482,10 +496,10 @@
 
 	if (mp) {
 		cluster_write(inode, page->index + 1, mp,
-				startio, allocate_space);
+				startio, unmapped);
 	}
 
-	return 0;
+	return page_dirty;
 
 error:
 	for (i = 0; i < cnt; i++) {
@@ -494,12 +508,15 @@
 	
 	/*
 	 * If it's delalloc and we have nowhere to put it,
-	 * throw it away.
+	 * throw it away, unless the lower layers told
+	 * us to try again.
 	 */
-	if (!allocate_space) {
-		block_invalidatepage(page, 0);
+	if (err != -EAGAIN) {
+		if (!unmapped) {
+			block_invalidatepage(page, 0);
+		}
+		ClearPageUptodate(page);
 	}
-	ClearPageUptodate(page);
 	return err;
 }
 
@@ -679,109 +696,172 @@
 }
 
 
-STATIC int
+STATIC void
 count_page_state(
 	struct page		*page,
-	int			*nr_delalloc,
-	int			*nr_unmapped)
+	int			*delalloc,
+	int			*unmapped)
 {
-	*nr_delalloc = *nr_unmapped = 0;
-
-	if (page_has_buffers(page)) {
-		struct buffer_head	*bh, *head;
+	struct buffer_head	*bh, *head;
 
-		bh = head = page_buffers(page);
-		do {
-			if (buffer_uptodate(bh) && !buffer_mapped(bh))
-				(*nr_unmapped)++;
-			else if (buffer_delay(bh))
-				(*nr_delalloc)++;
-		} while ((bh = bh->b_this_page) != head);
+	*delalloc = *unmapped = 0;
 
-		return 1;
-	}
-
-	return 0;
+	bh = head = page_buffers(page);
+	do {
+		if (buffer_uptodate(bh) && !buffer_mapped(bh))
+			(*unmapped) = 1;
+		else if (buffer_delay(bh))
+			(*delalloc) = 1;
+	} while ((bh = bh->b_this_page) != head);
 }
 
+
+/*
+ * writepage: Called from one of two places:
+ *
+ * 1. we are flushing a delalloc buffer head.
+ *
+ * 2. we are writing out a dirty page. Typically the page dirty
+ *    state is cleared before we get here. In this case is it
+ *    conceivable we have no buffer heads.
+ *
+ * For delalloc space on the page we need to allocate space and
+ * flush it. For unmapped buffer heads on the page we should
+ * allocate space if the page is uptodate. For any other dirty
+ * buffer heads on the page we should flush them.
+ *
+ * If we detect that a transaction would be required to flush
+ * the page, we have to check the process flags first, if we
+ * are already in a transaction or disk I/O during allocations
+ * is off, we need to fail the writepage and redirty the page.
+ * We also need to set PF_NOIO ourselves.
+ */
 STATIC int
 linvfs_writepage(
 	struct page		*page,
 	struct writeback_control *wbc)
 {
 	int			error;
-	int			need_trans = 1;
-	int			nr_delalloc, nr_unmapped;
+	int			need_trans;
+	int			delalloc, unmapped;
+	struct inode		*inode = page->mapping->host;
 
-	if (count_page_state(page, &nr_delalloc, &nr_unmapped))
-		need_trans = nr_delalloc + nr_unmapped;
+	/*
+	 * We need a transaction if:
+	 *  1. There are delalloc buffers on the page
+	 *  2. The page is upto date and we have unmapped buffers
+	 *  3. The page is upto date and we have no buffers
+	 */
+	if (!page_has_buffers(page)) {
+		unmapped = 1;
+		need_trans = 1;
+	} else {
+		count_page_state(page, &delalloc, &unmapped);
+		if (!PageUptodate(page))
+			unmapped = 0;
+		need_trans = delalloc + unmapped;
+	}
 
+	/*
+	 * If we need a transaction and the process flags say
+	 * we are already in a transaction, or no IO is allowed
+	 * then mark the page dirty again and leave the page
+	 * as is.
+	 */
 	if ((current->flags & (PF_FSTRANS)) && need_trans)
 		goto out_fail;
 
 	/*
+	 * Delay hooking up buffer heads until we have
+	 * made our go/no-go decision.
+	 */
+	if (!page_has_buffers(page)) {
+		create_empty_buffers(page, 1 << inode->i_blkbits, 0);
+	}
+
+	/*
 	 * Convert delalloc or unmapped space to real space and flush out
 	 * to disk.
 	 */
-	error = delalloc_convert(page, 1, nr_delalloc == 0);
-	if (unlikely(error))
-		unlock_page(page);
-	return error;
+	error = delalloc_convert(page, 1, unmapped);
+	if (error == -EAGAIN)
+		goto out_fail;
+	if (unlikely(error < 0))
+		goto out_unlock;
+
+	return 0;
 
 out_fail:
 	set_page_dirty(page);
 	unlock_page(page);
 	return 0;
-}
-
-STATIC int
-linvfs_prepare_write(
-	struct file		*file,
-	struct page		*page,
-	unsigned int		from,
-	unsigned int		to)
-{
-	if (file && (file->f_flags & O_SYNC)) {
-		return block_prepare_write(page, from, to,
-						linvfs_get_block_sync);
-	} else {
-		return block_prepare_write(page, from, to,
-						linvfs_get_block);
-	}
+out_unlock:
+	unlock_page(page);
+	return error;
 }
 
 /*
- * This gets a page into cleanable state - page locked on entry
- * kept locked on exit. If the page is marked dirty we should
- * not come this way.
+ * Called to move a page into cleanable state - and from there
+ * to be released. Possibly the page is already clean. We always
+ * have buffer heads in this call.
+ *
+ * Returns 0 if the page is ok to release, 1 otherwise.
+ *
+ * Possible scenarios are:
+ *
+ * 1. We are being called to release a page which has been written
+ *    to via regular I/O. buffer heads will be dirty and possibly
+ *    delalloc. If no delalloc buffer heads in this case then we
+ *    can just return zero.
+ *
+ * 2. We are called to release a page which has been written via
+ *    mmap, all we need to do is ensure there is no delalloc
+ *    state in the buffer heads, if not we can let the caller
+ *    free them and we should come back later via writepage.
  */
 STATIC int
 linvfs_release_page(
 	struct page		*page,
 	int			gfp_mask)
 {
-	int			nr_delalloc, nr_unmapped;
+	int			delalloc, unmapped;
 
-	if (count_page_state(page, &nr_delalloc, &nr_unmapped)) {
-		if (!nr_delalloc)
-			goto free_buffers;
-	} 
+	count_page_state(page, &delalloc, &unmapped);
+	if (!delalloc)
+		goto free_buffers;
 
-	if (gfp_mask & __GFP_FS) {
-		/*
-		 * Convert delalloc space to real space, do not flush the
-		 * data out to disk, that will be done by the caller.
-		 */
-		if (delalloc_convert(page, 0, 0) == 0)
-			goto free_buffers;
-	}
+	if (!(gfp_mask & __GFP_FS))
+		return 0;
 
+	/*
+	 * Convert delalloc space to real space, do not flush the
+	 * data out to disk, that will be done by the caller.
+	 * Never need to allocate space here - we will always
+	 * come back to writepage in that case.
+	 */
+	if (delalloc_convert(page, 0, 0) == 0)
+		goto free_buffers;
 	return 0;
 
 free_buffers:
 	return try_to_free_buffers(page);
 }
 
+STATIC int
+linvfs_prepare_write(
+	struct file		*file,
+	struct page		*page,
+	unsigned int		from,
+	unsigned int		to)
+{
+	if (file && (file->f_flags & O_SYNC)) {
+		return block_prepare_write(page, from, to,
+						linvfs_get_block_sync);
+	} else {
+		return block_prepare_write(page, from, to,
+						linvfs_get_block);
+	}
+}
 
 struct address_space_operations linvfs_aops = {
 	.readpage		= linvfs_readpage,
diff -Nru a/fs/xfs/linux/xfs_iomap.c b/fs/xfs/linux/xfs_iomap.c
--- a/fs/xfs/linux/xfs_iomap.c	Sun Feb 23 22:25:24 2003
+++ b/fs/xfs/linux/xfs_iomap.c	Sun Feb 23 22:25:24 2003
@@ -120,7 +120,13 @@
 	case PBF_FILE_ALLOCATE:
 		lockmode = XFS_ILOCK_SHARED|XFS_EXTSIZE_RD;
 		bmap_flags = XFS_BMAPI_ENTIRE;
-		XFS_ILOCK(mp, io, lockmode);
+		/* Attempt non-blocking lock */
+		if (flags & PBF_TRYLOCK) {
+			if (!XFS_ILOCK_NOWAIT(mp, io, lockmode))
+				return XFS_ERROR(EAGAIN);
+		} else {
+			XFS_ILOCK(mp, io, lockmode);
+		}
 		break;
 	case PBF_FILE_UNWRITTEN:
 		lockmode = XFS_ILOCK_EXCL|XFS_EXTSIZE_WR;
diff -Nru a/fs/xfs/linux/xfs_super.c b/fs/xfs/linux/xfs_super.c
--- a/fs/xfs/linux/xfs_super.c	Sun Feb 23 22:25:26 2003
+++ b/fs/xfs/linux/xfs_super.c	Sun Feb 23 22:25:26 2003
@@ -1009,12 +1009,12 @@
 	if (error < 0)
 		return error;
 
+	si_meminfo(&si);
+	xfs_physmem = si.totalram;
+
 	error = pagebuf_init();
 	if (error < 0)
 		goto out;
-
-	si_meminfo(&si);
-	xfs_physmem = si.totalram;
 
 	vn_init();
 	xfs_init();
diff -Nru a/fs/xfs/pagebuf/page_buf.c b/fs/xfs/pagebuf/page_buf.c
--- a/fs/xfs/pagebuf/page_buf.c	Sun Feb 23 22:25:21 2003
+++ b/fs/xfs/pagebuf/page_buf.c	Sun Feb 23 22:25:21 2003
@@ -119,9 +119,9 @@
 
 STATIC kmem_cache_t *pagebuf_cache;
 STATIC void pagebuf_daemon_wakeup(int);
+STATIC void pagebuf_delwri_queue(page_buf_t *, int);
 STATIC struct workqueue_struct *pagebuf_workqueue;
 
-
 /*
  * Pagebuf module configuration parameters, exported via
  * /proc/sys/vm/pagebuf
@@ -155,35 +155,37 @@
  * Pagebuf hashing
  */
 
-#define NBITS	5
-#define NHASH	(1<<NBITS)
-
+/* This structure must be a power of 2 long for the hash to work */
 typedef struct {
 	struct list_head	pb_hash;
 	int			pb_count;
 	spinlock_t		pb_hash_lock;
 } pb_hash_t;
 
-STATIC pb_hash_t	pbhash[NHASH];
+static pb_hash_t	*pbhash;
+static unsigned int	pb_hash_mask;
+static unsigned int	pb_hash_shift;
+static unsigned int	pb_order;
 #define pb_hash(pb)	&pbhash[pb->pb_hash_index]
 
-STATIC int
+/*
+ * This hash is the same one as used on the Linux buffer cache,
+ * see fs/buffer.c
+ */
+
+#define _hashfn(dev,block)      \
+        ((((dev)<<(pb_hash_shift - 6)) ^ ((dev)<<(pb_hash_shift - 9))) ^ \
+         (((block)<<(pb_hash_shift - 6)) ^ ((block) >> 13) ^ \
+          ((block) << (pb_hash_shift - 12))))
+
+static inline int
 _bhash(
 	dev_t		dev,
 	loff_t		base)
 {
-	int		bit, hval;
-
 	base >>= 9;
-	/*
-	 * dev_t is 16 bits, loff_t is always 64 bits
-	 */
-	base ^= dev;
-	for (bit = hval = 0; base != 0 && bit < sizeof(base) * 8; bit += NBITS) {
-		hval ^= (int)base & (NHASH-1);
-		base >>= NBITS;
-	}
-	return hval;
+	
+	return (_hashfn(dev, base) & pb_hash_mask);
 }
 
 /*
@@ -1516,7 +1518,7 @@
 STATIC LIST_HEAD(pbd_delwrite_queue);
 STATIC spinlock_t pbd_delwrite_lock = SPIN_LOCK_UNLOCKED;
 
-void
+STATIC void
 pagebuf_delwri_queue(
 	page_buf_t		*pb,
 	int			unlock)
@@ -1862,7 +1864,39 @@
 int __init
 pagebuf_init(void)
 {
-	int			i;
+	int		order, mempages, i;
+	unsigned int	nr_hash;
+	extern int	xfs_physmem;
+
+	mempages = xfs_physmem >>= 16;
+	mempages *= sizeof(pb_hash_t);
+	for (order = 0; (1 << order) < mempages; order++)
+		;
+
+	if (order > 3) order = 3;	/* cap us at 2K buckets */
+
+	do {
+		unsigned long tmp;
+
+		nr_hash = (PAGE_SIZE << order) / sizeof(pb_hash_t);	
+		nr_hash = 1 << (ffs(nr_hash) - 1);
+		pb_hash_mask =  (nr_hash - 1);
+		tmp = nr_hash;
+		pb_hash_shift = 0;
+		while((tmp >>= 1UL) != 0UL)
+			pb_hash_shift++;
+
+		pbhash = (pb_hash_t *)
+			__get_free_pages(GFP_KERNEL, order);
+		pb_order = order;
+	} while (pbhash == NULL && --order > 0);
+	printk("pagebuf cache hash table entries: %d (order: %d, %ld bytes)\n",
+		nr_hash, order, (PAGE_SIZE << order));
+
+	for(i = 0; i < nr_hash; i++) {
+		spin_lock_init(&pbhash[i].pb_hash_lock);
+		INIT_LIST_HEAD(&pbhash[i].pb_hash);
+	} 
 
 	pagebuf_table_header = register_sysctl_table(pagebuf_root_table, 1);
 
@@ -1880,11 +1914,6 @@
 		return -ENOMEM;
 	}
 
-	for (i = 0; i < NHASH; i++) {
-		spin_lock_init(&pbhash[i].pb_hash_lock);
-		INIT_LIST_HEAD(&pbhash[i].pb_hash);
-	}
-
 #ifdef PAGEBUF_TRACE
 	pb_trace.buf = (pagebuf_trace_t *)kmalloc(
 			PB_TRACE_BUFSIZE * sizeof(pagebuf_trace_t), GFP_KERNEL);
@@ -1911,6 +1940,7 @@
 
 	kmem_cache_destroy(pagebuf_cache);
 	kmem_shake_deregister(pagebuf_shaker);
+	free_pages((unsigned long)pbhash, pb_order);
 
 	unregister_sysctl_table(pagebuf_table_header);
 #ifdef	CONFIG_PROC_FS
diff -Nru a/fs/xfs/pagebuf/page_buf.h b/fs/xfs/pagebuf/page_buf.h
--- a/fs/xfs/pagebuf/page_buf.h	Sun Feb 23 22:25:25 2003
+++ b/fs/xfs/pagebuf/page_buf.h	Sun Feb 23 22:25:25 2003
@@ -215,8 +215,8 @@
 	unsigned short		pb_error;	/* error code on I/O */
 	unsigned short		pb_page_count;	/* size of page array */
 	unsigned short		pb_offset;	/* page offset in first page */
+	unsigned short		pb_hash_index;	/* hash table index	*/
 	unsigned char		pb_locked;	/* page array is locked */
-	unsigned char		pb_hash_index;	/* hash table index	*/
 	struct page		**pb_pages;	/* array of page pointers */
 	struct page		*pb_page_array[PB_PAGES]; /* inline pages */
 #ifdef PAGEBUF_LOCK_TRACKING
@@ -350,7 +350,6 @@
 
 /* Reading and writing pages */
 
-extern void pagebuf_delwri_queue(page_buf_t *, int);
 extern void pagebuf_delwri_dequeue(page_buf_t *);
 
 #define PBDF_WAIT    0x01
diff -Nru a/fs/xfs/support/debug.c b/fs/xfs/support/debug.c
--- a/fs/xfs/support/debug.c	Sun Feb 23 22:25:22 2003
+++ b/fs/xfs/support/debug.c	Sun Feb 23 22:25:22 2003
@@ -86,7 +86,7 @@
 {
 	char	*fp = fmt;
 	int	len;
-	int	flags;
+	unsigned long flags;
 	va_list	ap;
 
 	level &= XFS_ERR_MASK;
diff -Nru a/fs/xfs/support/qsort.c b/fs/xfs/support/qsort.c
--- a/fs/xfs/support/qsort.c	Sun Feb 23 22:25:26 2003
+++ b/fs/xfs/support/qsort.c	Sun Feb 23 22:25:26 2003
@@ -199,7 +199,7 @@
   {
     char *const end_ptr = &base_ptr[size * (total_elems - 1)];
     char *tmp_ptr = base_ptr;
-    char *thresh = min(end_ptr, base_ptr + max_thresh);
+    char *const thresh = min_t(char *const, end_ptr, base_ptr + max_thresh);
     register char *run_ptr;
 
     /* Find smallest element in first threshold and place it at the
diff -Nru a/fs/xfs/support/spin.h b/fs/xfs/support/spin.h
--- a/fs/xfs/support/spin.h	Sun Feb 23 22:25:24 2003
+++ b/fs/xfs/support/spin.h	Sun Feb 23 22:25:24 2003
@@ -46,7 +46,6 @@
 typedef spinlock_t lock_t;
 
 #define spinlock_init(lock, name)	spin_lock_init(lock)
-#define init_spinlock(lock, name, ll)	spin_lock_init(lock)
 #define spinlock_destroy(lock)
 
 static inline unsigned long mutex_spinlock(lock_t *lock)
diff -Nru a/fs/xfs/xfs_dir_leaf.c b/fs/xfs/xfs_dir_leaf.c
--- a/fs/xfs/xfs_dir_leaf.c	Sun Feb 23 22:25:26 2003
+++ b/fs/xfs/xfs_dir_leaf.c	Sun Feb 23 22:25:26 2003
@@ -648,7 +648,7 @@
 	retval = xfs_da_read_buf(iargs->trans, iargs->dp, 0, -1, &bp,
 					       XFS_DATA_FORK);
 	if (retval)
-		return(retval);
+		goto out;
 	ASSERT(bp != NULL);
 	memcpy(tmpbuffer, bp->data, XFS_LBSIZE(dp->i_mount));
 	leaf = (xfs_dir_leafblock_t *)tmpbuffer;
diff -Nru a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
--- a/fs/xfs/xfs_error.h	Sun Feb 23 22:25:25 2003
+++ b/fs/xfs/xfs_error.h	Sun Feb 23 22:25:25 2003
@@ -33,7 +33,7 @@
 #define __XFS_ERROR_H__
 
 #define prdev(fmt,dev,args...) \
-	printk("XFS: device 0x%x- " fmt "\n", dev, ## args)
+	printk("XFS: device 0x%x- " fmt "\n", (unsigned)dev, ## args)
 
 #define XFS_ERECOVER	1	/* Failure to recover log */
 #define XFS_ELOGSTAT	2	/* Failure to stat log in user space */
diff -Nru a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
--- a/fs/xfs/xfs_log.c	Sun Feb 23 22:25:27 2003
+++ b/fs/xfs/xfs_log.c	Sun Feb 23 22:25:27 2003
@@ -378,17 +378,26 @@
 		iclog->ic_callback_tail = &(cb->cb_next);
 	}
 	LOG_UNLOCK(log, spl);
-	if (!abortflg) {
-		if (xlog_state_release_iclog(log, iclog)) {
-			xfs_force_shutdown(mp, XFS_LOG_IO_ERROR);
-			return EIO;
-		}
-	} else {
+	if (abortflg) {
 		cb->cb_func(cb->cb_arg, abortflg);
 	}
 	return 0;
 }	/* xfs_log_notify */
 
+int
+xfs_log_release_iclog(xfs_mount_t *mp,
+		      void	  *iclog_hndl)
+{
+	xlog_t *log = mp->m_log;
+	xlog_in_core_t	  *iclog = (xlog_in_core_t *)iclog_hndl;
+
+	if (xlog_state_release_iclog(log, iclog)) {
+		xfs_force_shutdown(mp, XFS_LOG_IO_ERROR);
+		return(EIO);
+	}
+
+	return 0;
+}
 
 /*
  * Initialize log manager data.	 This routine is intended to be called when
diff -Nru a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
--- a/fs/xfs/xfs_log.h	Sun Feb 23 22:25:27 2003
+++ b/fs/xfs/xfs_log.h	Sun Feb 23 22:25:27 2003
@@ -164,6 +164,8 @@
 int	  xfs_log_notify(struct xfs_mount	*mp,
 			 void			*iclog,
 			 xfs_log_callback_t	*callback_entry);
+int	  xfs_log_release_iclog(struct xfs_mount *mp,
+			 void			 *iclog_hndl);
 int	  xfs_log_reserve(struct xfs_mount *mp,
 			  int		   length,
 			  int		   count,
diff -Nru a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
--- a/fs/xfs/xfs_log_recover.c	Sun Feb 23 22:25:24 2003
+++ b/fs/xfs/xfs_log_recover.c	Sun Feb 23 22:25:24 2003
@@ -1287,10 +1287,6 @@
 
 	if (!len)
 		return 0;
-	ptr = kmem_zalloc(len, 0);
-	memcpy(ptr, dp, len);
-
-	in_f = (xfs_inode_log_format_t *)ptr;
 	item = trans->r_itemq;
 	if (item == 0) {
 		ASSERT(*(uint *)dp == XFS_TRANS_HEADER_MAGIC);
@@ -1299,6 +1295,11 @@
 		memcpy(&trans->r_theader, dp, len); /* d, s, l */
 		return 0;
 	}
+
+	ptr = kmem_alloc(len, 0);
+	memcpy(ptr, dp, len);
+	in_f = (xfs_inode_log_format_t *)ptr;
+
 	if (item->ri_prev->ri_total != 0 &&
 	     item->ri_prev->ri_total == item->ri_prev->ri_cnt) {
 		xlog_recover_add_item(&trans->r_itemq);
diff -Nru a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
--- a/fs/xfs/xfs_mount.c	Sun Feb 23 22:25:23 2003
+++ b/fs/xfs/xfs_mount.c	Sun Feb 23 22:25:23 2003
@@ -272,7 +272,7 @@
 		cmn_err(CE_WARN,
 		"XFS: Only page-sized (%d) or less blocksizes currently work.",
 			PAGE_SIZE);
-		return XFS_ERROR(EWRONGFS);
+		return XFS_ERROR(ENOSYS);
 	}
 
 	return 0;
@@ -459,10 +459,22 @@
 	}
 
 	/*
-	 * Re-read the superblock so that our buffer is correctly sized.
-	 * We only need to do this if sector size on-disk is different.
+	 * We must be able to do sector-sized and sector-aligned IO.
 	 */
-	if (sector_size != mp->m_sb.sb_sectsize) {
+	if (sector_size > mp->m_sb.sb_sectsize) {
+		cmn_err(CE_WARN,
+			"XFS: device supports only %u byte sectors (not %u)",
+			sector_size, mp->m_sb.sb_sectsize);
+		XFS_BUF_UNMANAGE(bp);
+		xfs_buf_relse(bp);
+		return XFS_ERROR(ENOSYS);
+	}
+
+	/*
+	 * If device sector size is smaller than the superblock size,
+	 * re-read the superblock so the buffer is correctly sized.
+	 */
+	if (sector_size < mp->m_sb.sb_sectsize) {
 		XFS_BUF_UNMANAGE(bp);
 		xfs_buf_relse(bp);
 		sector_size = mp->m_sb.sb_sectsize;
diff -Nru a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
--- a/fs/xfs/xfs_trans.c	Sun Feb 23 22:25:24 2003
+++ b/fs/xfs/xfs_trans.c	Sun Feb 23 22:25:24 2003
@@ -809,19 +809,6 @@
 	}
 
 	/*
-	 * Once all the items of the transaction have been copied
-	 * to the in core log we can release them.  Do that here.
-	 * This will free descriptors pointing to items which were
-	 * not logged since there is nothing more to do with them.
-	 * For items which were logged, we will keep pointers to them
-	 * so they can be unpinned after the transaction commits to disk.
-	 * This will also stamp each modified meta-data item with
-	 * the commit lsn of this transaction for dependency tracking
-	 * purposes.
-	 */
-	xfs_trans_unlock_items(tp, commit_lsn);
-
-	/*
 	 * Once the transaction has committed, unused
 	 * reservations need to be released and changes to
 	 * the superblock need to be reflected in the in-core
@@ -856,12 +843,36 @@
 	tp->t_logcb.cb_arg = tp;
 
 	/* We need to pass the iclog buffer which was used for the
-	 * transaction commit record into this function, attach
-	 * the callback to it, and then release it. This will guarantee
-	 * that we do callbacks on the transaction in the correct order.
+	 * transaction commit record into this function, and attach
+	 * the callback to it. The callback must be attached before
+	 * the items are unlocked to avoid racing with other threads
+	 * waiting for an item to unlock.
 	 */
 	error = xfs_log_notify(mp, commit_iclog, &(tp->t_logcb));
 #endif
+
+	/*
+	 * Once all the items of the transaction have been copied
+	 * to the in core log and the callback is attached, the
+	 * items can be unlocked.
+	 *
+	 * This will free descriptors pointing to items which were
+	 * not logged since there is nothing more to do with them.
+	 * For items which were logged, we will keep pointers to them
+	 * so they can be unpinned after the transaction commits to disk.
+	 * This will also stamp each modified meta-data item with
+	 * the commit lsn of this transaction for dependency tracking
+	 * purposes.
+	 */
+	xfs_trans_unlock_items(tp, commit_lsn);
+
+	/*
+	 * Now that the xfs_trans_committed callback has been attached,
+	 * and the items are released we can finally allow the iclog to
+	 * go to disk.
+	 */
+	error = xfs_log_release_iclog(mp, commit_iclog);
+
 	/*
 	 * If the transaction needs to be synchronous, then force the
 	 * log out now and wait for it.
diff -Nru a/fs/xfs/xfsidbg.c b/fs/xfs/xfsidbg.c
--- a/fs/xfs/xfsidbg.c	Sun Feb 23 22:25:25 2003
+++ b/fs/xfs/xfsidbg.c	Sun Feb 23 22:25:25 2003
@@ -44,7 +44,6 @@
 MODULE_AUTHOR("SGI <sgi.com>");
 MODULE_DESCRIPTION("Additional kdb commands for debugging XFS");
 MODULE_LICENSE("GPL");
-EXPORT_NO_SYMBOLS;
 
 /*
  * Command table functions.
diff -Nru a/include/acpi/acconfig.h b/include/acpi/acconfig.h
--- a/include/acpi/acconfig.h	Sun Feb 23 22:25:25 2003
+++ b/include/acpi/acconfig.h	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef _ACCONFIG_H
diff -Nru a/include/acpi/acdebug.h b/include/acpi/acdebug.h
--- a/include/acpi/acdebug.h	Sun Feb 23 22:25:22 2003
+++ b/include/acpi/acdebug.h	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACDEBUG_H__
diff -Nru a/include/acpi/acdispat.h b/include/acpi/acdispat.h
--- a/include/acpi/acdispat.h	Sun Feb 23 22:25:25 2003
+++ b/include/acpi/acdispat.h	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/include/acpi/acevents.h b/include/acpi/acevents.h
--- a/include/acpi/acevents.h	Sun Feb 23 22:25:24 2003
+++ b/include/acpi/acevents.h	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACEVENTS_H__
@@ -72,8 +91,12 @@
 acpi_ev_init_global_lock_handler (
 	void);
 
-u32
-acpi_ev_get_gpe_register_index (
+struct acpi_gpe_register_info *
+acpi_ev_get_gpe_register_info (
+	u32                             gpe_number);
+
+struct acpi_gpe_number_info *
+acpi_ev_get_gpe_number_info (
 	u32                             gpe_number);
 
 u32
diff -Nru a/include/acpi/acexcep.h b/include/acpi/acexcep.h
--- a/include/acpi/acexcep.h	Sun Feb 23 22:25:21 2003
+++ b/include/acpi/acexcep.h	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACEXCEP_H__
diff -Nru a/include/acpi/acglobal.h b/include/acpi/acglobal.h
--- a/include/acpi/acglobal.h	Sun Feb 23 22:25:21 2003
+++ b/include/acpi/acglobal.h	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACGLOBAL_H__
diff -Nru a/include/acpi/achware.h b/include/acpi/achware.h
--- a/include/acpi/achware.h	Sun Feb 23 22:25:25 2003
+++ b/include/acpi/achware.h	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACHWARE_H__
diff -Nru a/include/acpi/acinterp.h b/include/acpi/acinterp.h
--- a/include/acpi/acinterp.h	Sun Feb 23 22:25:26 2003
+++ b/include/acpi/acinterp.h	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACINTERP_H__
diff -Nru a/include/acpi/aclocal.h b/include/acpi/aclocal.h
--- a/include/acpi/aclocal.h	Sun Feb 23 22:25:25 2003
+++ b/include/acpi/aclocal.h	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACLOCAL_H__
diff -Nru a/include/acpi/acmacros.h b/include/acpi/acmacros.h
--- a/include/acpi/acmacros.h	Sun Feb 23 22:25:24 2003
+++ b/include/acpi/acmacros.h	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACMACROS_H__
diff -Nru a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h
--- a/include/acpi/acnamesp.h	Sun Feb 23 22:25:22 2003
+++ b/include/acpi/acnamesp.h	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACNAMESP_H__
diff -Nru a/include/acpi/acobject.h b/include/acpi/acobject.h
--- a/include/acpi/acobject.h	Sun Feb 23 22:25:22 2003
+++ b/include/acpi/acobject.h	Sun Feb 23 22:25:22 2003
@@ -6,21 +6,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef _ACOBJECT_H
diff -Nru a/include/acpi/acoutput.h b/include/acpi/acoutput.h
--- a/include/acpi/acoutput.h	Sun Feb 23 22:25:23 2003
+++ b/include/acpi/acoutput.h	Sun Feb 23 22:25:23 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACOUTPUT_H__
diff -Nru a/include/acpi/acparser.h b/include/acpi/acparser.h
--- a/include/acpi/acparser.h	Sun Feb 23 22:25:25 2003
+++ b/include/acpi/acparser.h	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
diff -Nru a/include/acpi/acpi.h b/include/acpi/acpi.h
--- a/include/acpi/acpi.h	Sun Feb 23 22:25:24 2003
+++ b/include/acpi/acpi.h	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACPI_H__
@@ -30,21 +49,21 @@
  * We put them here because we don't want to duplicate them
  * in the rest of the source code again and again.
  */
-#include <acpi/acconfig.h>           /* Configuration constants */
-#include <acpi/platform/acenv.h>     /* Target environment specific items */
-#include <acpi/actypes.h>            /* Fundamental common data types */
-#include <acpi/acexcep.h>            /* ACPI exception codes */
-#include <acpi/acmacros.h>           /* C macros */
-#include <acpi/actbl.h>              /* ACPI table definitions */
-#include <acpi/aclocal.h>            /* Internal data types */
-#include <acpi/acoutput.h>           /* Error output and Debug macros */
-#include <acpi/acpiosxf.h>           /* Interfaces to the ACPI-to-OS layer*/
-#include <acpi/acpixf.h>             /* ACPI core subsystem external interfaces */
-#include <acpi/acobject.h>           /* ACPI internal object */
-#include <acpi/acstruct.h>           /* Common structures */
-#include <acpi/acglobal.h>           /* All global variables */
-#include <acpi/achware.h>            /* Hardware defines and interfaces */
-#include <acpi/acutils.h>            /* Utility interfaces */
+#include "acconfig.h"           /* Configuration constants */
+#include "platform/acenv.h"     /* Target environment specific items */
+#include "actypes.h"            /* Fundamental common data types */
+#include "acexcep.h"            /* ACPI exception codes */
+#include "acmacros.h"           /* C macros */
+#include "actbl.h"              /* ACPI table definitions */
+#include "aclocal.h"            /* Internal data types */
+#include "acoutput.h"           /* Error output and Debug macros */
+#include "acpiosxf.h"           /* Interfaces to the ACPI-to-OS layer*/
+#include "acpixf.h"             /* ACPI core subsystem external interfaces */
+#include "acobject.h"           /* ACPI internal object */
+#include "acstruct.h"           /* Common structures */
+#include "acglobal.h"           /* All global variables */
+#include "achware.h"            /* Hardware defines and interfaces */
+#include "acutils.h"            /* Utility interfaces */
 
 
 #endif /* __ACPI_H__ */
diff -Nru a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
--- a/include/acpi/acpiosxf.h	Sun Feb 23 22:25:21 2003
+++ b/include/acpi/acpiosxf.h	Sun Feb 23 22:25:21 2003
@@ -9,28 +9,47 @@
 
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACPIOSXF_H__
 #define __ACPIOSXF_H__
 
-#include <acpi/platform/acenv.h>
-#include <acpi/actypes.h>
+#include "platform/acenv.h"
+#include "actypes.h"
 
 
 /* Priorities for acpi_os_queue_for_execution */
@@ -91,6 +110,11 @@
 acpi_os_get_root_pointer (
 	u32                             flags,
 	struct acpi_pointer             *address);
+
+acpi_status
+acpi_os_predefined_override (
+	const struct acpi_predefined_names *init_val,
+	acpi_string                         *new_val);
 
 acpi_status
 acpi_os_table_override (
diff -Nru a/include/acpi/acpixf.h b/include/acpi/acpixf.h
--- a/include/acpi/acpixf.h	Sun Feb 23 22:25:21 2003
+++ b/include/acpi/acpixf.h	Sun Feb 23 22:25:21 2003
@@ -6,29 +6,48 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
 #ifndef __ACXFACE_H__
 #define __ACXFACE_H__
 
-#include <acpi/actypes.h>
-#include <acpi/actbl.h>
+#include "actypes.h"
+#include "actbl.h"
 
 
  /*
diff -Nru a/include/acpi/acresrc.h b/include/acpi/acresrc.h
--- a/include/acpi/acresrc.h	Sun Feb 23 22:25:22 2003
+++ b/include/acpi/acresrc.h	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACRESRC_H__
diff -Nru a/include/acpi/acstruct.h b/include/acpi/acstruct.h
--- a/include/acpi/acstruct.h	Sun Feb 23 22:25:22 2003
+++ b/include/acpi/acstruct.h	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACSTRUCT_H__
diff -Nru a/include/acpi/actables.h b/include/acpi/actables.h
--- a/include/acpi/actables.h	Sun Feb 23 22:25:22 2003
+++ b/include/acpi/actables.h	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACTABLES_H__
diff -Nru a/include/acpi/actbl.h b/include/acpi/actbl.h
--- a/include/acpi/actbl.h	Sun Feb 23 22:25:24 2003
+++ b/include/acpi/actbl.h	Sun Feb 23 22:25:24 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACTBL_H__
diff -Nru a/include/acpi/actbl1.h b/include/acpi/actbl1.h
--- a/include/acpi/actbl1.h	Sun Feb 23 22:25:22 2003
+++ b/include/acpi/actbl1.h	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACTBL1_H__
diff -Nru a/include/acpi/actbl2.h b/include/acpi/actbl2.h
--- a/include/acpi/actbl2.h	Sun Feb 23 22:25:25 2003
+++ b/include/acpi/actbl2.h	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACTBL2_H__
diff -Nru a/include/acpi/actypes.h b/include/acpi/actypes.h
--- a/include/acpi/actypes.h	Sun Feb 23 22:25:25 2003
+++ b/include/acpi/actypes.h	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACTYPES_H__
@@ -877,6 +896,8 @@
 #define ACPI_ISA_ONLY_RANGES            (u8) 0x02
 #define ACPI_ENTIRE_RANGE               (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
 
+#define ACPI_SPARSE_TRANSLATION         (u8) 0x03
+
 /*
  *  IO Port Descriptor Decode
  */
@@ -1026,7 +1047,7 @@
 struct acpi_io_attribute
 {
 	u16                                 range_attribute;
-	u16                                 reserved;
+	u16                                 translation_attribute;
 };
 
 struct acpi_bus_attribute
diff -Nru a/include/acpi/acutils.h b/include/acpi/acutils.h
--- a/include/acpi/acutils.h	Sun Feb 23 22:25:21 2003
+++ b/include/acpi/acutils.h	Sun Feb 23 22:25:21 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef _ACUTILS_H
diff -Nru a/include/acpi/amlcode.h b/include/acpi/amlcode.h
--- a/include/acpi/amlcode.h	Sun Feb 23 22:25:25 2003
+++ b/include/acpi/amlcode.h	Sun Feb 23 22:25:25 2003
@@ -7,21 +7,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __AMLCODE_H__
@@ -192,6 +211,7 @@
  * Argument types for the AML Parser
  * Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
  * There can be up to 31 unique argument types
+ * Zero is reserved as end-of-list indicator
  */
 
 #define ARGP_BYTEDATA               0x01
@@ -218,38 +238,47 @@
  * Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
  * There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
  *
- * Note: If and when 5 bits becomes insufficient, it would probably be best
+ * Note1: These values are completely independent from the ACPI_TYPEs
+ *        i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER
+ *
+ * Note2: If and when 5 bits becomes insufficient, it would probably be best
  * to convert to a 6-byte array of argument types, allowing 8 bits per argument.
  */
 
-/* "Standard" ACPI types are 1-15 (0x0F) */
+/* Single, simple types */
+
+#define ARGI_ANYTYPE                0x01    /* Don't care */
+#define ARGI_PACKAGE                0x02
+#define ARGI_EVENT                  0x03
+#define ARGI_MUTEX                  0x04
+#define ARGI_DDBHANDLE              0x05
+
+/* Interchangeable types (via implicit conversion) */
+
+#define ARGI_INTEGER                0x06
+#define ARGI_STRING                 0x07
+#define ARGI_BUFFER                 0x08
+#define ARGI_BUFFER_OR_STRING       0x09    /* Used by MID op only */
+#define ARGI_COMPUTEDATA            0x0A    /* Buffer, String, or Integer */
+
+/* Reference objects */
+
+#define ARGI_INTEGER_REF            0x0B
+#define ARGI_OBJECT_REF             0x0C
+#define ARGI_DEVICE_REF             0x0D
+#define ARGI_REFERENCE              0x0E
+#define ARGI_TARGETREF              0x0F    /* Target, subject to implicit conversion */
+#define ARGI_FIXED_TARGET           0x10    /* Target, no implicit conversion */
+#define ARGI_SIMPLE_TARGET          0x11    /* Name, Local, Arg -- no implicit conversion */
+
+/* Multiple/complex types */
+
+#define ARGI_DATAOBJECT             0x12    /* Buffer, String, package or reference to a Node - Used only by size_of operator*/
+#define ARGI_COMPLEXOBJ             0x13    /* Buffer, String, or package (Used by INDEX op only) */
+#define ARGI_REF_OR_STRING          0x14    /* Reference or String (Used by DEREFOF op only) */
+#define ARGI_REGION_OR_FIELD        0x15    /* Used by LOAD op only */
 
-#define ARGI_INTEGER                ACPI_TYPE_INTEGER       /* 1 */
-#define ARGI_STRING                 ACPI_TYPE_STRING        /* 2 */
-#define ARGI_BUFFER                 ACPI_TYPE_BUFFER        /* 3 */
-#define ARGI_PACKAGE                ACPI_TYPE_PACKAGE       /* 4 */
-#define ARGI_EVENT                  ACPI_TYPE_EVENT
-#define ARGI_MUTEX                  ACPI_TYPE_MUTEX
-#define ARGI_REGION                 ACPI_TYPE_REGION
-#define ARGI_DDBHANDLE              ACPI_TYPE_DDB_HANDLE
-
-/* Custom types are 0x10 through 0x1F */
-
-#define ARGI_IF                     0x10
-#define ARGI_ANYOBJECT              0x11
-#define ARGI_ANYTYPE                0x12
-#define ARGI_COMPUTEDATA            0x13     /* Buffer, String, or Integer */
-#define ARGI_DATAOBJECT             0x14     /* Buffer, String, package or reference to a Node - Used only by size_of operator*/
-#define ARGI_COMPLEXOBJ             0x15     /* Buffer, String, or package (Used by INDEX op only) */
-#define ARGI_INTEGER_REF            0x16
-#define ARGI_OBJECT_REF             0x17
-#define ARGI_DEVICE_REF             0x18
-#define ARGI_REFERENCE              0x19
-#define ARGI_TARGETREF              0x1A     /* Target, subject to implicit conversion */
-#define ARGI_FIXED_TARGET           0x1B     /* Target, no implicit conversion */
-#define ARGI_SIMPLE_TARGET          0x1C     /* Name, Local, Arg -- no implicit conversion */
-#define ARGI_BUFFERSTRING           0x1D
-#define ARGI_REF_OR_STRING          0x1E     /* Reference or String (Used by DEREFOF op only) */
+/* Note: types above can expand to 0x1F maximum */
 
 #define ARGI_INVALID_OPCODE         0xFFFFFFFF
 
diff -Nru a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
--- a/include/acpi/platform/acenv.h	Sun Feb 23 22:25:22 2003
+++ b/include/acpi/platform/acenv.h	Sun Feb 23 22:25:22 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACENV_H__
@@ -98,7 +117,7 @@
 /*! [Begin] no source code translation */
 
 #if defined(__linux__)
-#include <acpi/platform/aclinux.h>
+#include "aclinux.h"
 
 #elif defined(_AED_EFI)
 #include "acefi.h"
diff -Nru a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
--- a/include/acpi/platform/acgcc.h	Sun Feb 23 22:25:26 2003
+++ b/include/acpi/platform/acgcc.h	Sun Feb 23 22:25:26 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACGCC_H__
diff -Nru a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
--- a/include/acpi/platform/aclinux.h	Sun Feb 23 22:25:25 2003
+++ b/include/acpi/platform/aclinux.h	Sun Feb 23 22:25:25 2003
@@ -5,21 +5,40 @@
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000 - 2003, R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #ifndef __ACLINUX_H__
@@ -54,11 +73,11 @@
 #include <unistd.h>
 
 #if defined(__ia64__) || defined(__x86_64__)
-#define ACPI_MACHINE_WIDTH	    64
+#define ACPI_MACHINE_WIDTH          64
 #define COMPILER_DEPENDENT_INT64    long
 #define COMPILER_DEPENDENT_UINT64   unsigned long
 #else
-#define ACPI_MACHINE_WIDTH	    32
+#define ACPI_MACHINE_WIDTH          32
 #define COMPILER_DEPENDENT_INT64    long long
 #define COMPILER_DEPENDENT_UINT64   unsigned long long
 #define ACPI_USE_NATIVE_DIVIDE
diff -Nru a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h
--- a/include/asm-alpha/bitops.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-alpha/bitops.h	Sun Feb 23 22:25:24 2003
@@ -264,13 +264,11 @@
 {
 #if defined(__alpha_cix__) && defined(__alpha_fix__)
 	/* Whee.  EV67 can calculate it directly.  */
-	unsigned long result;
-	__asm__("cttz %1,%0" : "=r"(result) : "r"(~word));
-	return result;
+	return __kernel_cttz(~word);
 #else
 	unsigned long bits, qofs, bofs;
 
-	__asm__("cmpbge %1,%2,%0" : "=r"(bits) : "r"(word), "r"(~0UL));
+	bits = __kernel_cmpbge(word, ~0UL);
 	qofs = ffz_b(bits);
 	bits = __kernel_extbl(word, qofs);
 	bofs = ffz_b(bits);
@@ -286,13 +284,11 @@
 {
 #if defined(__alpha_cix__) && defined(__alpha_fix__)
 	/* Whee.  EV67 can calculate it directly.  */
-	unsigned long result;
-	__asm__("cttz %1,%0" : "=r"(result) : "r"(word));
-	return result;
+	return __kernel_cttz(word);
 #else
 	unsigned long bits, qofs, bofs;
 
-	__asm__("cmpbge $31,%1,%0" : "=r"(bits) : "r"(word));
+	bits = __kernel_cmpbge(word, 0);
 	qofs = ffz_b(bits);
 	bits = __kernel_extbl(word, qofs);
 	bofs = ffz_b(~bits);
@@ -311,8 +307,8 @@
 
 static inline int ffs(int word)
 {
-	int result = __ffs(word);
-	return word ? result+1 : 0;
+	int result = __ffs(word) + 1;
+	return word ? result : 0;
 }
 
 /*
@@ -321,9 +317,7 @@
 #if defined(__alpha_cix__) && defined(__alpha_fix__)
 static inline int fls(int word)
 {
-	long result;
-	__asm__("ctlz %1,%0" : "=r"(result) : "r"(word & 0xffffffff));
-	return 64 - result;
+	return 64 - __kernel_ctlz(word & 0xffffffff);
 }
 #else
 #define fls	generic_fls
@@ -332,11 +326,10 @@
 /* Compute powers of two for the given integer.  */
 static inline int floor_log2(unsigned long word)
 {
-	long bit;
 #if defined(__alpha_cix__) && defined(__alpha_fix__)
-	__asm__("ctlz %1,%0" : "=r"(bit) : "r"(word));
-	return 63 - bit;
+	return 63 - __kernel_ctlz(word);
 #else
+	long bit;
 	for (bit = -1; word ; bit++)
 		word >>= 1;
 	return bit;
@@ -358,9 +351,7 @@
 /* Whee.  EV67 can calculate it directly.  */
 static inline unsigned long hweight64(unsigned long w)
 {
-	unsigned long result;
-	__asm__("ctpop %1,%0" : "=r"(result) : "r"(w));
-	return result;
+	return __kernel_ctpop(w);
 }
 
 #define hweight32(x) hweight64((x) & 0xfffffffful)
@@ -415,11 +406,11 @@
 	if (!size)
 		return result;
 	tmp = *p;
-found_first:
+ found_first:
 	tmp |= ~0UL << size;
 	if (tmp == ~0UL)        /* Are any bits zero? */
 		return result + size; /* Nope. */
-found_middle:
+ found_middle:
 	return result + ffz(tmp);
 }
 
@@ -456,11 +447,11 @@
 	if (!size)
 		return result;
 	tmp = *p;
-found_first:
+ found_first:
 	tmp &= ~0UL >> (64 - size);
 	if (!tmp)
 		return result + size;
-found_middle:
+ found_middle:
 	return result + __ffs(tmp);
 }
 
diff -Nru a/include/asm-alpha/byteorder.h b/include/asm-alpha/byteorder.h
--- a/include/asm-alpha/byteorder.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-alpha/byteorder.h	Sun Feb 23 22:25:26 2003
@@ -2,6 +2,7 @@
 #define _ALPHA_BYTEORDER_H
 
 #include <asm/types.h>
+#include <asm/compiler.h>
 
 #ifdef __GNUC__
 
@@ -23,11 +24,8 @@
 
 	__u64 t0, t1, t2, t3;
 
-	__asm__("inslh %1, 7, %0"	/* t0 : 0000000000AABBCC */
-		: "=r"(t0) : "r"(x));
-	__asm__("inswl %1, 3, %0"	/* t1 : 000000CCDD000000 */
-		: "=r"(t1) : "r"(x));
-
+	t0 = __kernel_inslh(x, 7);	/* t0 : 0000000000AABBCC */
+	t1 = __kernel_inswl(x, 3);	/* t1 : 000000CCDD000000 */
 	t1 |= t0;			/* t1 : 000000CCDDAABBCC */
 	t2 = t1 >> 16;			/* t2 : 0000000000CCDDAA */
 	t0 = t1 & 0xFF00FF00;		/* t0 : 00000000DD00BB00 */
diff -Nru a/include/asm-alpha/compiler.h b/include/asm-alpha/compiler.h
--- a/include/asm-alpha/compiler.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-alpha/compiler.h	Sun Feb 23 22:25:25 2003
@@ -9,39 +9,57 @@
  * these tests and macros.
  */
 
-#if 0
-#define __kernel_insbl(val, shift) \
-  (((unsigned long)(val) & 0xfful) << ((shift) * 8))
-#define __kernel_inswl(val, shift) \
-  (((unsigned long)(val) & 0xfffful) << ((shift) * 8))
-#define __kernel_insql(val, shift) \
-  ((unsigned long)(val) << ((shift) * 8))
+#if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
+# define __kernel_insbl(val, shift)	__builtin_alpha_insbl(val, shift)
+# define __kernel_inswl(val, shift)	__builtin_alpha_inswl(val, shift)
+# define __kernel_insql(val, shift)	__builtin_alpha_insql(val, shift)
+# define __kernel_inslh(val, shift)	__builtin_alpha_inslh(val, shift)
+# define __kernel_extbl(val, shift)	__builtin_alpha_extbl(val, shift)
+# define __kernel_extwl(val, shift)	__builtin_alpha_extwl(val, shift)
+# define __kernel_cmpbge(a, b)		__builtin_alpha_cmpbge(a, b)
+# define __kernel_cttz(x)		__builtin_ctz(x)
+# define __kernel_ctlz(x)		__builtin_clz(x)
+# define __kernel_ctpop(x)		__builtin_popcount(x)
 #else
-#define __kernel_insbl(val, shift)					\
+# define __kernel_insbl(val, shift)					\
   ({ unsigned long __kir;						\
      __asm__("insbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));	\
      __kir; })
-#define __kernel_inswl(val, shift)					\
+# define __kernel_inswl(val, shift)					\
   ({ unsigned long __kir;						\
      __asm__("inswl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));	\
      __kir; })
-#define __kernel_insql(val, shift)					\
+# define __kernel_insql(val, shift)					\
   ({ unsigned long __kir;						\
      __asm__("insql %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));	\
      __kir; })
-#endif
-
-#if 0 && (__GNUC__ > 2 || __GNUC_MINOR__ >= 92)
-#define __kernel_extbl(val, shift)  (((val) >> (((shift) & 7) * 8)) & 0xfful)
-#define __kernel_extwl(val, shift)  (((val) >> (((shift) & 7) * 8)) & 0xfffful)
-#else
-#define __kernel_extbl(val, shift)					\
+# define __kernel_inslh(val, shift)					\
+  ({ unsigned long __kir;						\
+     __asm__("inslh %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));	\
+     __kir; })
+# define __kernel_extbl(val, shift)					\
   ({ unsigned long __kir;						\
      __asm__("extbl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));	\
      __kir; })
-#define __kernel_extwl(val, shift)					\
+# define __kernel_extwl(val, shift)					\
   ({ unsigned long __kir;						\
      __asm__("extwl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val));	\
+     __kir; })
+# define __kernel_cmpbge(a, b)						\
+  ({ unsigned long __kir;						\
+     __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a));	\
+     __kir; })
+# define __kernel_cttz(x)						\
+  ({ unsigned long __kir;						\
+     __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x));			\
+     __kir; })
+# define __kernel_ctlz(x)						\
+  ({ unsigned long __kir;						\
+     __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x));			\
+     __kir; })
+# define __kernel_ctpop(x)						\
+  ({ unsigned long __kir;						\
+     __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x));			\
      __kir; })
 #endif
 
diff -Nru a/include/asm-alpha/core_marvel.h b/include/asm-alpha/core_marvel.h
--- a/include/asm-alpha/core_marvel.h	Sun Feb 23 22:25:22 2003
+++ b/include/asm-alpha/core_marvel.h	Sun Feb 23 22:25:22 2003
@@ -222,7 +222,7 @@
 /*
  * IO7 IID (Interrupt IDentifier) format
  *
- * For level-sensative interupts, int_num is encoded as:
+ * For level-sensative interrupts, int_num is encoded as:
  *
  *	bus/port	slot/device	INTx
  *	<7:5>		<4:2>		<1:0>
diff -Nru a/include/asm-alpha/delay.h b/include/asm-alpha/delay.h
--- a/include/asm-alpha/delay.h	Sun Feb 23 22:25:23 2003
+++ b/include/asm-alpha/delay.h	Sun Feb 23 22:25:23 2003
@@ -2,7 +2,9 @@
 #define __ALPHA_DELAY_H
 
 extern void __delay(int loops);
-extern void __udelay(unsigned long usecs, unsigned long lpj);
 extern void udelay(unsigned long usecs);
+
+extern void ndelay(unsigned long nsecs);
+#define ndelay ndelay
 
 #endif /* defined(__ALPHA_DELAY_H) */
diff -Nru a/include/asm-alpha/ide.h b/include/asm-alpha/ide.h
--- a/include/asm-alpha/ide.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-alpha/ide.h	Sun Feb 23 22:25:26 2003
@@ -80,6 +80,8 @@
 #endif
 }
 
+#include <asm-generic/ide_iops.h>
+
 #endif /* __KERNEL__ */
 
 #endif /* __ASMalpha_IDE_H */
diff -Nru a/include/asm-alpha/machvec.h b/include/asm-alpha/machvec.h
--- a/include/asm-alpha/machvec.h	Sun Feb 23 22:25:22 2003
+++ b/include/asm-alpha/machvec.h	Sun Feb 23 22:25:22 2003
@@ -34,7 +34,7 @@
 
 	int nr_irqs;
 	int rtc_port;
-	int max_asn;
+	unsigned int max_asn;
 	unsigned long max_isa_dma_address;
 	unsigned long irq_probe_mask;
 	unsigned long iack_sc;
diff -Nru a/include/asm-alpha/posix_types.h b/include/asm-alpha/posix_types.h
--- a/include/asm-alpha/posix_types.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-alpha/posix_types.h	Sun Feb 23 22:25:25 2003
@@ -28,6 +28,8 @@
 typedef unsigned long	__kernel_sigset_t;	/* at least 32 bits */
 typedef unsigned short	__kernel_uid16_t;
 typedef unsigned short	__kernel_gid16_t;
+typedef int		__kernel_clockid_t;
+typedef int		__kernel_timer_t;
 
 typedef struct {
 	int	val[2];
diff -Nru a/include/asm-alpha/system.h b/include/asm-alpha/system.h
--- a/include/asm-alpha/system.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-alpha/system.h	Sun Feb 23 22:25:25 2003
@@ -131,17 +131,14 @@
 extern void halt(void) __attribute__((noreturn));
 #define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt))
 
-#define prepare_arch_schedule(prev)		do { } while(0)
-#define finish_arch_schedule(prev)		do { } while(0)
-
-#define switch_to(prev,next,last)						  \
-do {									  \
-	alpha_switch_to(virt_to_phys(&(next)->thread_info->pcb), (prev)); \
-	check_mmu_context();						  \
-} while (0)
+#define switch_to(P,N,L)						\
+  do {									\
+    (L) = alpha_switch_to(virt_to_phys(&(N)->thread_info->pcb), (P));	\
+    check_mmu_context();						\
+  } while (0)
 
 struct task_struct;
-extern void alpha_switch_to(unsigned long, struct task_struct*);
+extern struct task_struct *alpha_switch_to(unsigned long, struct task_struct*);
 
 #define mb() \
 __asm__ __volatile__("mb": : :"memory")
@@ -206,6 +203,7 @@
 enum amask_enum {
 	AMASK_BWX = (1UL << 0),
 	AMASK_FIX = (1UL << 1),
+	AMASK_CIX = (1UL << 2),
 	AMASK_MAX = (1UL << 8),
 	AMASK_PRECISE_TRAP = (1UL << 9),
 };
diff -Nru a/include/asm-arm/arch-integrator/platform.h b/include/asm-arm/arch-integrator/platform.h
--- a/include/asm-arm/arch-integrator/platform.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-arm/arch-integrator/platform.h	Sun Feb 23 22:25:24 2003
@@ -466,7 +466,7 @@
 #define MAXSWINUM                       31
  
 /* ------------------------------------------------------------------------
- *  LED's - The header LED is not accessable via the uHAL API
+ *  LED's - The header LED is not accessible via the uHAL API
  * ------------------------------------------------------------------------
  * 
  */
diff -Nru a/include/asm-arm/arch-iop310/dma.h b/include/asm-arm/arch-iop310/dma.h
--- a/include/asm-arm/arch-iop310/dma.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-arm/arch-iop310/dma.h	Sun Feb 23 22:25:25 2003
@@ -69,7 +69,7 @@
  */
 typedef struct _dma_desc
 {
-	u32 NDAR;					/* next descriptor adress */
+	u32 NDAR;					/* next descriptor address */
 	u32 PDAR;					/* PCI address */
 	u32 PUADR;					/* upper PCI address */
 	u32 LADR;					/* local address */
diff -Nru a/include/asm-arm/hardware/iomd.h b/include/asm-arm/hardware/iomd.h
--- a/include/asm-arm/hardware/iomd.h	Sun Feb 23 22:25:27 2003
+++ b/include/asm-arm/hardware/iomd.h	Sun Feb 23 22:25:27 2003
@@ -203,7 +203,7 @@
 #define DMA_ST_AB	1
 
 /*
- * DMA (MEMC) compatability
+ * DMA (MEMC) compatibility
  */
 #define HALF_SAM	vram_half_sam
 #define VDMA_ALIGNMENT	(HALF_SAM * 2)
diff -Nru a/include/asm-generic/ide_iops.h b/include/asm-generic/ide_iops.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-generic/ide_iops.h	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,38 @@
+/* Generic I/O and MEMIO string operations.  */
+
+#define __ide_insw	insw
+#define __ide_insl	insl
+#define __ide_outsw	outsw
+#define __ide_outsl	outsl
+
+static __inline__ void __ide_mm_insw(unsigned long port, void *addr, u32 count)
+{
+	while (count--) {
+		*(u16 *)addr = readw(port);
+		addr += 2;
+	}
+}
+
+static __inline__ void __ide_mm_insl(unsigned long port, void *addr, u32 count)
+{
+	while (count--) {
+		*(u32 *)addr = readl(port);
+		addr += 4;
+	}
+}
+
+static __inline__ void __ide_mm_outsw(unsigned long port, void *addr, u32 count)
+{
+	while (count--) {
+		writew(*(u16 *)addr, port);
+		addr += 2;
+	}
+}
+
+static __inline__ void __ide_mm_outsl(unsigned long port, void *addr, u32 count)
+{
+	while (count--) {
+		writel(*(u32 *)addr, port);
+		addr += 4;
+	}
+}
diff -Nru a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
--- a/include/asm-generic/siginfo.h	Sun Feb 23 22:25:23 2003
+++ b/include/asm-generic/siginfo.h	Sun Feb 23 22:25:23 2003
@@ -43,8 +43,11 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _overrun;		/* overrun count */
+			char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
+			sigval_t _sigval;	/* same as below */
+			int _sys_private;       /* not to be passed to user */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -86,8 +89,9 @@
  */
 #define si_pid		_sifields._kill._pid
 #define si_uid		_sifields._kill._uid
-#define si_timer1	_sifields._timer._timer1
-#define si_timer2	_sifields._timer._timer2
+#define si_tid		_sifields._timer._tid
+#define si_overrun	_sifields._timer._overrun
+#define si_sys_private  _sifields._timer._sys_private
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime
@@ -221,6 +225,7 @@
 #define SIGEV_SIGNAL	0	/* notify via signal */
 #define SIGEV_NONE	1	/* other notification: meaningless */
 #define SIGEV_THREAD	2	/* deliver via thread creation */
+#define SIGEV_THREAD_ID 4	/* deliver to thread */
 
 #define SIGEV_MAX_SIZE	64
 #ifndef SIGEV_PAD_SIZE
@@ -235,6 +240,7 @@
 	int sigev_notify;
 	union {
 		int _pad[SIGEV_PAD_SIZE];
+		 int _tid;
 
 		struct {
 			void (*_function)(sigval_t);
@@ -247,10 +253,12 @@
 
 #define sigev_notify_function	_sigev_un._sigev_thread._function
 #define sigev_notify_attributes	_sigev_un._sigev_thread._attribute
+#define sigev_notify_thread_id	 _sigev_un._tid
 
 #ifdef __KERNEL__
 
 struct siginfo;
+void do_schedule_next_timer(struct siginfo *info);
 
 #ifndef HAVE_ARCH_COPY_SIGINFO
 
diff -Nru a/include/asm-i386/cobalt.h b/include/asm-i386/cobalt.h
--- a/include/asm-i386/cobalt.h	Sun Feb 23 22:25:22 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,117 +0,0 @@
-#include <linux/config.h>
-#ifndef __I386_COBALT_H
-#define __I386_COBALT_H
-
-/*
- * Cobalt is the system ASIC on the SGI 320 and 540 Visual Workstations
- */ 
-
-#define	CO_CPU_PHYS		0xc2000000
-#define	CO_APIC_PHYS		0xc4000000
-
-/* see set_fixmap() and asm/fixmap.h */
-#define	CO_CPU_VADDR		(fix_to_virt(FIX_CO_CPU))
-#define	CO_APIC_VADDR		(fix_to_virt(FIX_CO_APIC))
-
-/* Cobalt CPU registers -- relative to CO_CPU_VADDR, use co_cpu_*() */
-#define	CO_CPU_REV		0x08
-#define	CO_CPU_CTRL		0x10
-#define	CO_CPU_STAT		0x20
-#define	CO_CPU_TIMEVAL		0x30
-
-/* CO_CPU_CTRL bits */
-#define	CO_CTRL_TIMERUN		0x04	/* 0 == disabled */
-#define	CO_CTRL_TIMEMASK	0x08	/* 0 == unmasked */
-
-/* CO_CPU_STATUS bits */
-#define	CO_STAT_TIMEINTR	0x02	/* (r) 1 == int pend, (w) 0 == clear */
-
-/* CO_CPU_TIMEVAL value */
-#define	CO_TIME_HZ		100000000 /* Cobalt core rate */
-
-/* Cobalt APIC registers -- relative to CO_APIC_VADDR, use co_apic_*() */
-#define	CO_APIC_HI(n)		(((n) * 0x10) + 4)
-#define	CO_APIC_LO(n)		((n) * 0x10)
-#define	CO_APIC_ID		0x0ffc
-
-/* CO_APIC_ID bits */
-#define	CO_APIC_ENABLE		0x00000100
-
-/* CO_APIC_LO bits */
-#define	CO_APIC_LEVEL		0x08000		/* 0 = edge */
-
-/*
- * Where things are physically wired to Cobalt
- * #defines with no board _<type>_<rev>_ are common to all (thus far)
- */
-#define CO_APIC_0_5_IDE0	5
-#define	CO_APIC_0_5_SERIAL	13	 /* XXX not really...h/w bug! */
-#define CO_APIC_0_5_PARLL	4
-#define CO_APIC_0_5_FLOPPY	6
-
-#define	CO_APIC_0_6_IDE0	4
-#define	CO_APIC_0_6_USB	7	/* PIIX4 USB */
-
-#define	CO_APIC_1_2_IDE0	4
-
-#define CO_APIC_0_5_IDE1	2
-#define CO_APIC_0_6_IDE1	2
-
-/* XXX */
-#define	CO_APIC_IDE0	CO_APIC_0_5_IDE0
-#define	CO_APIC_IDE1	CO_APIC_0_5_IDE1
-#define	CO_APIC_SERIAL	CO_APIC_0_5_SERIAL
-/* XXX */
-
-#define CO_APIC_ENET	3	/* Lithium PCI Bridge A, Device 3 */
-#define	CO_APIC_8259	12	/* serial, floppy, par-l-l, audio */
-
-#define	CO_APIC_VIDOUT0	16
-#define	CO_APIC_VIDOUT1	17
-#define	CO_APIC_VIDIN0	18
-#define	CO_APIC_VIDIN1	19
-
-#define CO_APIC_CPU	28	/* Timer and Cache interrupt */
-
-/*
- * This is the "irq" arg to request_irq(), just a unique cookie.
- */
-#define	CO_IRQ_TIMER	0
-#define CO_IRQ_ENET	3
-#define CO_IRQ_SERIAL	4
-#define CO_IRQ_FLOPPY	6	/* Same as drivers/block/floppy.c:FLOPPY_IRQ */
-#define	CO_IRQ_PARLL	7
-#define	CO_IRQ_POWER	9
-#define CO_IRQ_IDE	14
-#define	CO_IRQ_8259	12
-
-#ifdef CONFIG_X86_VISWS_APIC
-static __inline void co_cpu_write(unsigned long reg, unsigned long v)
-{
-	*((volatile unsigned long *)(CO_CPU_VADDR+reg))=v;
-}
-
-static __inline unsigned long co_cpu_read(unsigned long reg)
-{
-	return *((volatile unsigned long *)(CO_CPU_VADDR+reg));
-}            
-             
-static __inline void co_apic_write(unsigned long reg, unsigned long v)
-{
-	*((volatile unsigned long *)(CO_APIC_VADDR+reg))=v;
-}            
-             
-static __inline unsigned long co_apic_read(unsigned long reg)
-{
-	return *((volatile unsigned long *)(CO_APIC_VADDR+reg));
-}
-#endif
-
-extern char visws_board_type;
-
-#define	VISWS_320	0
-#define	VISWS_540	1
-
-extern char visws_board_rev;
-
-#endif
diff -Nru a/include/asm-i386/delay.h b/include/asm-i386/delay.h
--- a/include/asm-i386/delay.h	Sun Feb 23 22:25:21 2003
+++ b/include/asm-i386/delay.h	Sun Feb 23 22:25:21 2003
@@ -8,13 +8,19 @@
  */
  
 extern void __bad_udelay(void);
+extern void __bad_ndelay(void);
 
 extern void __udelay(unsigned long usecs);
+extern void __ndelay(unsigned long nsecs);
 extern void __const_udelay(unsigned long usecs);
 extern void __delay(unsigned long loops);
 
 #define udelay(n) (__builtin_constant_p(n) ? \
 	((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \
 	__udelay(n))
+	
+#define ndelay(n) (__builtin_constant_p(n) ? \
+	((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
+	__ndelay(n))
 
 #endif /* defined(_I386_DELAY_H) */
diff -Nru a/include/asm-i386/desc.h b/include/asm-i386/desc.h
--- a/include/asm-i386/desc.h	Sun Feb 23 22:25:21 2003
+++ b/include/asm-i386/desc.h	Sun Feb 23 22:25:21 2003
@@ -42,10 +42,12 @@
 	"rorl $16,%%eax" \
 	: "=m"(*(n)) : "a" (addr), "r"(n), "ir"(limit), "i"(type))
 
-static inline void set_tss_desc(unsigned int cpu, void *addr)
+static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr)
 {
-	_set_tssldt_desc(&cpu_gdt_table[cpu][GDT_ENTRY_TSS], (int)addr, 235, 0x89);
+	_set_tssldt_desc(&cpu_gdt_table[cpu][entry], (int)addr, 235, 0x89);
 }
+
+#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)
 
 static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size)
 {
diff -Nru a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h
--- a/include/asm-i386/hw_irq.h	Sun Feb 23 22:25:27 2003
+++ b/include/asm-i386/hw_irq.h	Sun Feb 23 22:25:27 2003
@@ -76,11 +76,8 @@
 {
 	unsigned long eip;
 	extern unsigned long prof_cpu_mask;
-#ifdef CONFIG_PROFILING
-	extern void x86_profile_hook(struct pt_regs *);
  
-	x86_profile_hook(regs);
-#endif
+	profile_hook(regs);
  
 	if (user_mode(regs))
 		return;
@@ -108,27 +105,6 @@
 		eip = prof_len-1;
 	atomic_inc((atomic_t *)&prof_buffer[eip]);
 }
- 
-struct notifier_block;
- 
-#ifdef CONFIG_PROFILING
- 
-int register_profile_notifier(struct notifier_block * nb);
-int unregister_profile_notifier(struct notifier_block * nb);
-
-#else
-
-static inline int register_profile_notifier(struct notifier_block * nb)
-{
-	return -ENOSYS;
-}
-
-static inline int unregister_profile_notifier(struct notifier_block * nb)
-{
-	return -ENOSYS;
-}
-
-#endif /* CONFIG_PROFILING */
  
 #if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP)
 static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
diff -Nru a/include/asm-i386/i8259.h b/include/asm-i386/i8259.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-i386/i8259.h	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,17 @@
+#ifndef __ASM_I8259_H__
+#define __ASM_I8259_H__
+
+extern unsigned int cached_irq_mask;
+
+#define __byte(x,y) 	(((unsigned char *) &(y))[x])
+#define cached_21	(__byte(0, cached_irq_mask))
+#define cached_A1	(__byte(1, cached_irq_mask))
+
+extern spinlock_t i8259A_lock;
+
+extern void init_8259A(int auto_eoi);
+extern void enable_8259A_irq(unsigned int irq);
+extern void disable_8259A_irq(unsigned int irq);
+extern unsigned int startup_8259A_irq(unsigned int irq);
+
+#endif	/* __ASM_I8259_H__ */
diff -Nru a/include/asm-i386/ide.h b/include/asm-i386/ide.h
--- a/include/asm-i386/ide.h	Sun Feb 23 22:25:21 2003
+++ b/include/asm-i386/ide.h	Sun Feb 23 22:25:21 2003
@@ -16,14 +16,14 @@
 #include <linux/config.h>
 
 #ifndef MAX_HWIFS
-# ifdef CONFIG_PCI
+# ifdef CONFIG_BLK_DEV_IDEPCI
 #define MAX_HWIFS	10
 # else
 #define MAX_HWIFS	6
 # endif
 #endif
 
-static __inline__ int ide_default_irq(ide_ioreg_t base)
+static __inline__ int ide_default_irq(unsigned long base)
 {
 	switch (base) {
 		case 0x1f0: return 14;
@@ -37,16 +37,24 @@
 	}
 }
 
-static __inline__ ide_ioreg_t ide_default_io_base(int index)
+static __inline__ unsigned long ide_default_io_base(int index)
 {
-	static unsigned long ata_io_base[MAX_HWIFS] = { 0x1f0, 0x170, 0x1e8, 0x168, 0x1e0, 0x160 };
-
-	return ata_io_base[index];
+	switch (index) {
+		case 0:	return 0x1f0;
+		case 1:	return 0x170;
+		case 2: return 0x1e8;
+		case 3: return 0x168;
+		case 4: return 0x1e0;
+		case 5: return 0x160;
+		default:
+			return 0;
+	}
 }
 
-static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
+static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
+	 unsigned long ctrl_port, int *irq)
 {
-	ide_ioreg_t reg = data_port;
+	unsigned long reg = data_port;
 	int i;
 
 	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
@@ -65,7 +73,7 @@
 
 static __inline__ void ide_init_default_hwifs(void)
 {
-#ifndef CONFIG_PCI
+#ifndef CONFIG_BLK_DEV_IDEPCI
 	hw_regs_t hw;
 	int index;
 
@@ -75,8 +83,10 @@
 		hw.irq = ide_default_irq(ide_default_io_base(index));
 		ide_register_hw(&hw, NULL);
 	}
-#endif
+#endif /* CONFIG_BLK_DEV_IDEPCI */
 }
+
+#include <asm-generic/ide_iops.h>
 
 #endif /* __KERNEL__ */
 
diff -Nru a/include/asm-i386/lithium.h b/include/asm-i386/lithium.h
--- a/include/asm-i386/lithium.h	Sun Feb 23 22:25:26 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,45 +0,0 @@
-#ifndef __I386_LITHIUM_H
-#define __I386_LITHIUM_H
-
-#include <linux/config.h>
-
-/*
- * Lithium is the I/O ASIC on the SGI 320 and 540 Visual Workstations
- */
-
-#define	LI_PCI_A_PHYS		0xfc000000	/* Enet is dev 3 */
-#define	LI_PCI_B_PHYS		0xfd000000	/* PIIX4 is here */
-
-/* see set_fixmap() and asm/fixmap.h */
-#define LI_PCIA_VADDR   (fix_to_virt(FIX_LI_PCIA))
-#define LI_PCIB_VADDR   (fix_to_virt(FIX_LI_PCIB))
-
-/* Not a standard PCI? (not in linux/pci.h) */
-#define	LI_PCI_BUSNUM	0x44			/* lo8: primary, hi8: sub */
-#define LI_PCI_INTEN    0x46
-
-#ifdef CONFIG_X86_VISWS_APIC
-/* More special purpose macros... */
-static __inline void li_pcia_write16(unsigned long reg, unsigned short v)
-{
-	*((volatile unsigned short *)(LI_PCIA_VADDR+reg))=v;
-}
-
-static __inline unsigned short li_pcia_read16(unsigned long reg)
-{
-	 return *((volatile unsigned short *)(LI_PCIA_VADDR+reg));
-}
-
-static __inline void li_pcib_write16(unsigned long reg, unsigned short v)
-{
-	*((volatile unsigned short *)(LI_PCIB_VADDR+reg))=v;
-}
-
-static __inline unsigned short li_pcib_read16(unsigned long reg)
-{
-	return *((volatile unsigned short *)(LI_PCIB_VADDR+reg));
-}
-#endif
-
-#endif
-
diff -Nru a/include/asm-i386/mach-visws/cobalt.h b/include/asm-i386/mach-visws/cobalt.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-i386/mach-visws/cobalt.h	Sun Feb 23 22:25:22 2003
@@ -0,0 +1,125 @@
+#ifndef __I386_SGI_COBALT_H
+#define __I386_SGI_COBALT_H
+
+#include <asm/fixmap.h>
+
+/*
+ * Cobalt SGI Visual Workstation system ASIC
+ */ 
+
+#define CO_CPU_NUM_PHYS 0x1e00
+#define CO_CPU_TAB_PHYS (CO_CPU_NUM_PHYS + 2)
+
+#define CO_CPU_MAX 4
+
+#define	CO_CPU_PHYS		0xc2000000
+#define	CO_APIC_PHYS		0xc4000000
+
+/* see set_fixmap() and asm/fixmap.h */
+#define	CO_CPU_VADDR		(fix_to_virt(FIX_CO_CPU))
+#define	CO_APIC_VADDR		(fix_to_virt(FIX_CO_APIC))
+
+/* Cobalt CPU registers -- relative to CO_CPU_VADDR, use co_cpu_*() */
+#define	CO_CPU_REV		0x08
+#define	CO_CPU_CTRL		0x10
+#define	CO_CPU_STAT		0x20
+#define	CO_CPU_TIMEVAL		0x30
+
+/* CO_CPU_CTRL bits */
+#define	CO_CTRL_TIMERUN		0x04		/* 0 == disabled */
+#define	CO_CTRL_TIMEMASK	0x08		/* 0 == unmasked */
+
+/* CO_CPU_STATUS bits */
+#define	CO_STAT_TIMEINTR	0x02	/* (r) 1 == int pend, (w) 0 == clear */
+
+/* CO_CPU_TIMEVAL value */
+#define	CO_TIME_HZ		100000000	/* Cobalt core rate */
+
+/* Cobalt APIC registers -- relative to CO_APIC_VADDR, use co_apic_*() */
+#define	CO_APIC_HI(n)		(((n) * 0x10) + 4)
+#define	CO_APIC_LO(n)		((n) * 0x10)
+#define	CO_APIC_ID		0x0ffc
+
+/* CO_APIC_ID bits */
+#define	CO_APIC_ENABLE		0x00000100
+
+/* CO_APIC_LO bits */
+#define	CO_APIC_MASK		0x00010000	/* 0 = enabled */
+#define	CO_APIC_LEVEL		0x00008000	/* 0 = edge */
+
+/*
+ * Where things are physically wired to Cobalt
+ * #defines with no board _<type>_<rev>_ are common to all (thus far)
+ */
+#define	CO_APIC_IDE0		4
+#define CO_APIC_IDE1		2		/* Only on 320 */
+
+#define	CO_APIC_8259		12		/* serial, floppy, par-l-l */
+
+/* Lithium PCI Bridge A -- "the one with 82557 Ethernet" */
+#define	CO_APIC_PCIA_BASE0	0 /* and 1 */	/* slot 0, line 0 */
+#define	CO_APIC_PCIA_BASE123	5 /* and 6 */	/* slot 0, line 1 */
+
+#define	CO_APIC_PIIX4_USB	7		/* this one is wierd */
+
+/* Lithium PCI Bridge B -- "the one with PIIX4" */
+#define	CO_APIC_PCIB_BASE0	8 /* and 9-12 *//* slot 0, line 0 */
+#define	CO_APIC_PCIB_BASE123	13 /* 14.15 */	/* slot 0, line 1 */
+
+#define	CO_APIC_VIDOUT0		16
+#define	CO_APIC_VIDOUT1		17
+#define	CO_APIC_VIDIN0		18
+#define	CO_APIC_VIDIN1		19
+
+#define	CO_APIC_LI_AUDIO	22
+
+#define	CO_APIC_AS		24
+#define	CO_APIC_RE		25
+
+#define CO_APIC_CPU		28		/* Timer and Cache interrupt */
+#define	CO_APIC_NMI		29
+#define	CO_APIC_LAST		CO_APIC_NMI
+
+/*
+ * This is how irqs are assigned on the Visual Workstation.
+ * Legacy devices get irq's 1-15 (system clock is 0 and is CO_APIC_CPU).
+ * All other devices (including PCI) go to Cobalt and are irq's 16 on up.
+ */
+#define	CO_IRQ_APIC0	16			/* irq of apic entry 0 */
+#define	IS_CO_APIC(irq)	((irq) >= CO_IRQ_APIC0)
+#define	CO_IRQ(apic)	(CO_IRQ_APIC0 + (apic))	/* apic ent to irq */
+#define	CO_APIC(irq)	((irq) - CO_IRQ_APIC0)	/* irq to apic ent */
+#define CO_IRQ_IDE0	14			/* knowledge of... */
+#define CO_IRQ_IDE1	15			/* ... ide driver defaults! */
+#define	CO_IRQ_8259	CO_IRQ(CO_APIC_8259)
+
+#ifdef CONFIG_X86_VISWS_APIC
+extern __inline void co_cpu_write(unsigned long reg, unsigned long v)
+{
+	*((volatile unsigned long *)(CO_CPU_VADDR+reg))=v;
+}
+
+extern __inline unsigned long co_cpu_read(unsigned long reg)
+{
+	return *((volatile unsigned long *)(CO_CPU_VADDR+reg));
+}            
+             
+extern __inline void co_apic_write(unsigned long reg, unsigned long v)
+{
+	*((volatile unsigned long *)(CO_APIC_VADDR+reg))=v;
+}            
+             
+extern __inline unsigned long co_apic_read(unsigned long reg)
+{
+	return *((volatile unsigned long *)(CO_APIC_VADDR+reg));
+}
+#endif
+
+extern char visws_board_type;
+
+#define	VISWS_320	0
+#define	VISWS_540	1
+
+extern char visws_board_rev;
+
+#endif /* __I386_SGI_COBALT_H */
diff -Nru a/include/asm-i386/mach-visws/do_timer.h b/include/asm-i386/mach-visws/do_timer.h
--- a/include/asm-i386/mach-visws/do_timer.h	Sun Feb 23 22:25:23 2003
+++ b/include/asm-i386/mach-visws/do_timer.h	Sun Feb 23 22:25:23 2003
@@ -1,7 +1,7 @@
 /* defines for inline arch setup functions */
 
 #include <asm/fixmap.h>
-#include <asm/cobalt.h>
+#include "cobalt.h"
 
 static inline void do_timer_interrupt_hook(struct pt_regs *regs)
 {
diff -Nru a/include/asm-i386/mach-visws/irq_vectors.h b/include/asm-i386/mach-visws/irq_vectors.h
--- a/include/asm-i386/mach-visws/irq_vectors.h	Sun Feb 23 22:25:22 2003
+++ b/include/asm-i386/mach-visws/irq_vectors.h	Sun Feb 23 22:25:22 2003
@@ -47,18 +47,8 @@
 #define TIMER_IRQ 0
 
 /*
- * 16 8259A IRQ's, 208 potential APIC interrupt sources.
- * Right now the APIC is mostly only used for SMP.
- * 256 vectors is an architectural limit. (we can have
- * more than 256 devices theoretically, but they will
- * have to use shared interrupts)
- * Since vectors 0x00-0x1f are used/reserved for the CPU,
- * the usable vector space is 0x20-0xff (224 vectors)
+ * 
  */
-#ifdef CONFIG_X86_IO_APIC
 #define NR_IRQS 224
-#else
-#define NR_IRQS 16
-#endif
 
 #endif /* _ASM_IRQ_VECTORS_H */
diff -Nru a/include/asm-i386/mach-visws/lithium.h b/include/asm-i386/mach-visws/lithium.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-i386/mach-visws/lithium.h	Sun Feb 23 22:25:26 2003
@@ -0,0 +1,53 @@
+#ifndef __I386_SGI_LITHIUM_H
+#define __I386_SGI_LITHIUM_H
+
+#include <asm/fixmap.h>
+
+/*
+ * Lithium is the SGI Visual Workstation I/O ASIC
+ */
+
+#define	LI_PCI_A_PHYS		0xfc000000	/* Enet is dev 3 */
+#define	LI_PCI_B_PHYS		0xfd000000	/* PIIX4 is here */
+
+/* see set_fixmap() and asm/fixmap.h */
+#define LI_PCIA_VADDR   (fix_to_virt(FIX_LI_PCIA))
+#define LI_PCIB_VADDR   (fix_to_virt(FIX_LI_PCIB))
+
+/* Not a standard PCI? (not in linux/pci.h) */
+#define	LI_PCI_BUSNUM	0x44			/* lo8: primary, hi8: sub */
+#define LI_PCI_INTEN    0x46
+
+/* LI_PCI_INTENT bits */
+#define	LI_INTA_0	0x0001
+#define	LI_INTA_1	0x0002
+#define	LI_INTA_2	0x0004
+#define	LI_INTA_3	0x0008
+#define	LI_INTA_4	0x0010
+#define	LI_INTB		0x0020
+#define	LI_INTC		0x0040
+#define	LI_INTD		0x0080
+
+/* More special purpose macros... */
+extern __inline void li_pcia_write16(unsigned long reg, unsigned short v)
+{
+	*((volatile unsigned short *)(LI_PCIA_VADDR+reg))=v;
+}
+
+extern __inline unsigned short li_pcia_read16(unsigned long reg)
+{
+	 return *((volatile unsigned short *)(LI_PCIA_VADDR+reg));
+}
+
+extern __inline void li_pcib_write16(unsigned long reg, unsigned short v)
+{
+	*((volatile unsigned short *)(LI_PCIB_VADDR+reg))=v;
+}
+
+extern __inline unsigned short li_pcib_read16(unsigned long reg)
+{
+	return *((volatile unsigned short *)(LI_PCIB_VADDR+reg));
+}
+
+#endif
+
diff -Nru a/include/asm-i386/mach-visws/mach_apic.h b/include/asm-i386/mach-visws/mach_apic.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-i386/mach-visws/mach_apic.h	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,80 @@
+#ifndef __ASM_MACH_APIC_H
+#define __ASM_MACH_APIC_H
+
+#define APIC_DFR_VALUE	(APIC_DFR_FLAT)
+
+#define no_balance_irq (0)
+#define esr_disable (0)
+
+#define INT_DELIVERY_MODE dest_LowestPrio
+#define INT_DEST_MODE 1     /* logical delivery broadcast to all procs */
+
+#ifdef CONFIG_SMP
+ #define TARGET_CPUS cpu_online_map
+#else
+ #define TARGET_CPUS 0x01
+#endif
+
+#define APIC_BROADCAST_ID      0x0F
+#define check_apicid_used(bitmap, apicid) (bitmap & (1 << apicid))
+#define check_apicid_present(bit) (phys_cpu_present_map & (1 << bit))
+
+static inline int apic_id_registered(void)
+{
+	return (test_bit(GET_APIC_ID(apic_read(APIC_ID)), 
+						&phys_cpu_present_map));
+}
+
+/*
+ * Set up the logical destination ID.
+ *
+ * Intel recommends to set DFR, LDR and TPR before enabling
+ * an APIC.  See e.g. "AP-388 82489DX User's Manual" (Intel
+ * document number 292116).  So here it goes...
+ */
+static inline void init_apic_ldr(void)
+{
+	unsigned long val;
+
+	apic_write_around(APIC_DFR, APIC_DFR_VALUE);
+	val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
+	val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id());
+	apic_write_around(APIC_LDR, val);
+}
+
+static inline void summit_check(char *oem, char *productid) 
+{
+}
+
+static inline void clustered_apic_check(void)
+{
+}
+
+/* Mapping from cpu number to logical apicid */
+static inline int cpu_to_logical_apicid(int cpu)
+{
+	return 1 << cpu;
+}
+
+static inline int cpu_present_to_apicid(int mps_cpu)
+{
+	return mps_cpu;
+}
+
+static inline unsigned long apicid_to_cpu_present(int apicid)
+{
+	return (1ul << apicid);
+}
+
+#define WAKE_SECONDARY_VIA_INIT
+
+static inline void setup_portio_remap(void)
+{
+}
+
+static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
+{
+	return test_bit(boot_cpu_physical_apicid, &phys_cpu_present_map);
+}
+
+#endif /* __ASM_MACH_APIC_H */
diff -Nru a/include/asm-i386/mach-visws/piix4.h b/include/asm-i386/mach-visws/piix4.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-i386/mach-visws/piix4.h	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,107 @@
+#ifndef __I386_SGI_PIIX_H
+#define __I386_SGI_PIIX_H
+
+/*
+ * PIIX4 as used on SGI Visual Workstations
+ */
+
+#define	PIIX_PM_START		0x0F80
+
+#define	SIO_GPIO_START		0x0FC0
+
+#define	SIO_PM_START		0x0FC8
+
+#define	PMBASE			PIIX_PM_START
+#define	GPIREG0			(PMBASE+0x30)
+#define	GPIREG(x)		(GPIREG0+((x)/8))
+#define	GPIBIT(x)		(1 << ((x)%8))
+
+#define	PIIX_GPI_BD_ID1		18
+#define	PIIX_GPI_BD_ID2		19
+#define	PIIX_GPI_BD_ID3		20
+#define	PIIX_GPI_BD_ID4		21
+#define	PIIX_GPI_BD_REG		GPIREG(PIIX_GPI_BD_ID1)
+#define	PIIX_GPI_BD_MASK	(GPIBIT(PIIX_GPI_BD_ID1) | \
+				GPIBIT(PIIX_GPI_BD_ID2) | \
+				GPIBIT(PIIX_GPI_BD_ID3) | \
+				GPIBIT(PIIX_GPI_BD_ID4) )
+
+#define	PIIX_GPI_BD_SHIFT	(PIIX_GPI_BD_ID1 % 8)
+
+#define	SIO_INDEX		0x2e
+#define	SIO_DATA		0x2f
+
+#define	SIO_DEV_SEL		0x7
+#define	SIO_DEV_ENB		0x30
+#define	SIO_DEV_MSB		0x60
+#define	SIO_DEV_LSB		0x61
+
+#define	SIO_GP_DEV		0x7
+
+#define	SIO_GP_BASE		SIO_GPIO_START
+#define	SIO_GP_MSB		(SIO_GP_BASE>>8)
+#define	SIO_GP_LSB		(SIO_GP_BASE&0xff)
+
+#define	SIO_GP_DATA1		(SIO_GP_BASE+0)
+
+#define	SIO_PM_DEV		0x8
+
+#define	SIO_PM_BASE		SIO_PM_START
+#define	SIO_PM_MSB		(SIO_PM_BASE>>8)
+#define	SIO_PM_LSB		(SIO_PM_BASE&0xff)
+#define	SIO_PM_INDEX		(SIO_PM_BASE+0)
+#define	SIO_PM_DATA		(SIO_PM_BASE+1)
+
+#define	SIO_PM_FER2		0x1
+
+#define	SIO_PM_GP_EN		0x80
+
+
+
+/*
+ * This is the dev/reg where generating a config cycle will
+ * result in a PCI special cycle.
+ */
+#define SPECIAL_DEV		0xff
+#define SPECIAL_REG		0x00
+
+/*
+ * PIIX4 needs to see a special cycle with the following data
+ * to be convinced the processor has gone into the stop grant
+ * state.  PIIX4 insists on seeing this before it will power
+ * down a system.
+ */
+#define PIIX_SPECIAL_STOP		0x00120002
+
+#define PIIX4_RESET_PORT	0xcf9
+#define PIIX4_RESET_VAL		0x6
+
+#define PMSTS_PORT		0xf80	// 2 bytes	PM Status
+#define PMEN_PORT		0xf82	// 2 bytes	PM Enable
+#define	PMCNTRL_PORT		0xf84	// 2 bytes	PM Control
+
+#define PM_SUSPEND_ENABLE	0x2000	// start sequence to suspend state
+
+/*
+ * PMSTS and PMEN I/O bit definitions.
+ * (Bits are the same in both registers)
+ */
+#define PM_STS_RSM		(1<<15)	// Resume Status
+#define PM_STS_PWRBTNOR		(1<<11)	// Power Button Override
+#define PM_STS_RTC		(1<<10)	// RTC status
+#define PM_STS_PWRBTN		(1<<8)	// Power Button Pressed?
+#define PM_STS_GBL		(1<<5)	// Global Status
+#define PM_STS_BM		(1<<4)	// Bus Master Status
+#define PM_STS_TMROF		(1<<0)	// Timer Overflow Status.
+
+/*
+ * Stop clock GPI register
+ */
+#define PIIX_GPIREG0			(0xf80 + 0x30)
+
+/*
+ * Stop clock GPI bit in GPIREG0
+ */
+#define	PIIX_GPI_STPCLK		0x4	// STPCLK signal routed back in
+
+#endif
diff -Nru a/include/asm-i386/mach-visws/setup_arch_post.h b/include/asm-i386/mach-visws/setup_arch_post.h
--- a/include/asm-i386/mach-visws/setup_arch_post.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-i386/mach-visws/setup_arch_post.h	Sun Feb 23 22:25:24 2003
@@ -3,35 +3,47 @@
  * This is included late in kernel/setup.c so that it can make use of all of
  * the static functions. */
 
+#define MB (1024 * 1024)
+
+unsigned long sgivwfb_mem_phys;
+unsigned long sgivwfb_mem_size;
+
+long long mem_size __initdata = 0;
+
 static inline char * __init machine_specific_memory_setup(void)
 {
-	char *who;
+	long long gfx_mem_size = 8 * MB;
 
+	mem_size = ALT_MEM_K;
 
-	who = "BIOS-e820";
+	if (!mem_size) {
+		printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n");
+		mem_size = 128 * MB;
+	}
 
 	/*
-	 * Try to copy the BIOS-supplied E820-map.
-	 *
-	 * Otherwise fake a memory map; one section from 0k->640k,
-	 * the next section from 1mb->appropriate_mem_k
+	 * this hardcodes the graphics memory to 8 MB
+	 * it really should be sized dynamically (or at least
+	 * set as a boot param)
 	 */
-	sanitize_e820_map(E820_MAP, &E820_MAP_NR);
-	if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) {
-		unsigned long mem_size;
-
-		/* compare results from other methods and take the greater */
-		if (ALT_MEM_K < EXT_MEM_K) {
-			mem_size = EXT_MEM_K;
-			who = "BIOS-88";
-		} else {
-			mem_size = ALT_MEM_K;
-			who = "BIOS-e801";
-		}
-
-		e820.nr_map = 0;
-		add_memory_region(0, LOWMEMSIZE(), E820_RAM);
-		add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
-  	}
-	return who;
+	if (!sgivwfb_mem_size) {
+		printk(KERN_WARNING "Defaulting to 8 MB framebuffer size\n");
+		sgivwfb_mem_size = 8 * MB;
+	}
+
+	/*
+	 * Trim to nearest MB
+	 */
+	sgivwfb_mem_size &= ~((1 << 20) - 1);
+	sgivwfb_mem_phys = mem_size - gfx_mem_size;
+
+	add_memory_region(0, LOWMEMSIZE(), E820_RAM);
+	add_memory_region(HIGH_MEMORY, mem_size - sgivwfb_mem_size - HIGH_MEMORY, E820_RAM);
+	add_memory_region(sgivwfb_mem_phys, sgivwfb_mem_size, E820_RESERVED);
+
+	return "PROM";
+
+	/* Remove gcc warnings */
+	(void) sanitize_e820_map(NULL, NULL);
+	(void) copy_e820_map(NULL, 0);
 }
diff -Nru a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
--- a/include/asm-i386/mmu_context.h	Sun Feb 23 22:25:21 2003
+++ b/include/asm-i386/mmu_context.h	Sun Feb 23 22:25:21 2003
@@ -13,18 +13,14 @@
 int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
 void destroy_context(struct mm_struct *mm);
 
-#ifdef CONFIG_SMP
 
 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
 {
+#ifdef CONFIG_SMP
 	if (cpu_tlbstate[cpu].state == TLBSTATE_OK)
 		cpu_tlbstate[cpu].state = TLBSTATE_LAZY;	
-}
-#else
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
-{
-}
 #endif
+}
 
 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu)
 {
diff -Nru a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
--- a/include/asm-i386/pgtable.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-i386/pgtable.h	Sun Feb 23 22:25:25 2003
@@ -212,6 +212,7 @@
  */
 
 #define mk_pte(page, pgprot)	pfn_pte(page_to_pfn(page), (pgprot))
+#define mk_pte_huge(entry) ((entry).pte_low |= _PAGE_PRESENT | _PAGE_PSE)
 
 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 {
diff -Nru a/include/asm-i386/posix_types.h b/include/asm-i386/posix_types.h
--- a/include/asm-i386/posix_types.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-i386/posix_types.h	Sun Feb 23 22:25:26 2003
@@ -22,6 +22,8 @@
 typedef long		__kernel_time_t;
 typedef long		__kernel_suseconds_t;
 typedef long		__kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
 typedef int		__kernel_daddr_t;
 typedef char *		__kernel_caddr_t;
 typedef unsigned short	__kernel_uid16_t;
diff -Nru a/include/asm-i386/processor.h b/include/asm-i386/processor.h
--- a/include/asm-i386/processor.h	Sun Feb 23 22:25:21 2003
+++ b/include/asm-i386/processor.h	Sun Feb 23 22:25:21 2003
@@ -83,6 +83,7 @@
 extern struct cpuinfo_x86 boot_cpu_data;
 extern struct cpuinfo_x86 new_cpu_data;
 extern struct tss_struct init_tss[NR_CPUS];
+extern struct tss_struct doublefault_tss;
 
 #ifdef CONFIG_SMP
 extern struct cpuinfo_x86 cpu_data[];
diff -Nru a/include/asm-i386/segment.h b/include/asm-i386/segment.h
--- a/include/asm-i386/segment.h	Sun Feb 23 22:25:22 2003
+++ b/include/asm-i386/segment.h	Sun Feb 23 22:25:22 2003
@@ -37,6 +37,13 @@
  *  23 - APM BIOS support
  *  24 - APM BIOS support
  *  25 - APM BIOS support 
+ *
+ *  26 - unused
+ *  27 - unused
+ *  28 - unused
+ *  29 - unused
+ *  30 - unused
+ *  31 - TSS for double fault handler
  */
 #define GDT_ENTRY_TLS_ENTRIES	3
 #define GDT_ENTRY_TLS_MIN	6
@@ -64,10 +71,12 @@
 #define GDT_ENTRY_PNPBIOS_BASE		(GDT_ENTRY_KERNEL_BASE + 6)
 #define GDT_ENTRY_APMBIOS_BASE		(GDT_ENTRY_KERNEL_BASE + 11)
 
+#define GDT_ENTRY_DOUBLEFAULT_TSS	31
+
 /*
- * The GDT has 25 entries but we pad it to cacheline boundary:
+ * The GDT has 32 entries
  */
-#define GDT_ENTRIES 28
+#define GDT_ENTRIES 32
 
 #define GDT_SIZE (GDT_ENTRIES * 8)
 
diff -Nru a/include/asm-i386/signal.h b/include/asm-i386/signal.h
--- a/include/asm-i386/signal.h	Sun Feb 23 22:25:22 2003
+++ b/include/asm-i386/signal.h	Sun Feb 23 22:25:22 2003
@@ -3,6 +3,7 @@
 
 #include <linux/types.h>
 #include <linux/linkage.h>
+#include <linux/time.h>
 
 /* Avoid too many header ordering problems.  */
 struct siginfo;
diff -Nru a/include/asm-i386/system.h b/include/asm-i386/system.h
--- a/include/asm-i386/system.h	Sun Feb 23 22:25:21 2003
+++ b/include/asm-i386/system.h	Sun Feb 23 22:25:21 2003
@@ -9,26 +9,24 @@
 #ifdef __KERNEL__
 
 struct task_struct;	/* one of the stranger aspects of C forward declarations.. */
-extern void FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
+extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
 
 #define switch_to(prev,next,last) do {					\
+	unsigned long esi,edi;						\
 	asm volatile("pushfl\n\t"					\
-		     "pushl %%esi\n\t"					\
-		     "pushl %%edi\n\t"					\
 		     "pushl %%ebp\n\t"					\
 		     "movl %%esp,%0\n\t"	/* save ESP */		\
-		     "movl %2,%%esp\n\t"	/* restore ESP */	\
+		     "movl %5,%%esp\n\t"	/* restore ESP */	\
 		     "movl $1f,%1\n\t"		/* save EIP */		\
-		     "pushl %3\n\t"		/* restore EIP */	\
+		     "pushl %6\n\t"		/* restore EIP */	\
 		     "jmp __switch_to\n"				\
 		     "1:\t"						\
 		     "popl %%ebp\n\t"					\
-		     "popl %%edi\n\t"					\
-		     "popl %%esi\n\t"					\
-		     "popfl\n\t"					\
-		     :"=m" (prev->thread.esp),"=m" (prev->thread.eip)	\
+		     "popfl"						\
+		     :"=m" (prev->thread.esp),"=m" (prev->thread.eip),	\
+		      "=a" (last),"=S" (esi),"=D" (edi)			\
 		     :"m" (next->thread.esp),"m" (next->thread.eip),	\
-		      "a" (prev), "d" (next));				\
+		      "2" (prev), "d" (next));				\
 } while (0)
 
 #define _set_base(addr,base) do { unsigned long __pr; \
diff -Nru a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
--- a/include/asm-i386/unistd.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-i386/unistd.h	Sun Feb 23 22:25:25 2003
@@ -264,7 +264,17 @@
 #define __NR_epoll_wait		256
 #define __NR_remap_file_pages	257
 #define __NR_set_tid_address	258
+#define __NR_timer_create	259
+#define __NR_timer_settime	(__NR_timer_create+1)
+#define __NR_timer_gettime	(__NR_timer_create+2)
+#define __NR_timer_getoverrun	(__NR_timer_create+3)
+#define __NR_timer_delete	(__NR_timer_create+4)
+#define __NR_clock_settime	(__NR_timer_create+5)
+#define __NR_clock_gettime	(__NR_timer_create+6)
+#define __NR_clock_getres	(__NR_timer_create+7)
+#define __NR_clock_nanosleep	(__NR_timer_create+8)
 
+#define NR_syscalls 268
 
 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
 
diff -Nru a/include/asm-ia64/sn/eeprom.h b/include/asm-ia64/sn/eeprom.h
--- a/include/asm-ia64/sn/eeprom.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-ia64/sn/eeprom.h	Sun Feb 23 22:25:24 2003
@@ -371,7 +371,7 @@
 
 
 
-/* macros for NIC compatability */
+/* macros for NIC compatibility */
 /* always invoked on "this" cbrick */
 #define HUB_VERTEX_MFG_INFO(v) \
     eeprom_vertex_info_set( C_BRICK, get_nasid(), (v), 0 )
diff -Nru a/include/asm-ia64/sn/pci/bridge.h b/include/asm-ia64/sn/pci/bridge.h
--- a/include/asm-ia64/sn/pci/bridge.h	Sun Feb 23 22:25:22 2003
+++ b/include/asm-ia64/sn/pci/bridge.h	Sun Feb 23 22:25:22 2003
@@ -186,8 +186,8 @@
 
 /*
  * BRIDGE, XBRIDGE, PIC register definitions.  NOTE: Prior to PIC, registers
- * were a 32bit quantity and double word aligned (and only accessable as a
- * 32bit word.  PIC registers are 64bits and accessable as words or double
+ * were a 32bit quantity and double word aligned (and only accessible as a
+ * 32bit word.  PIC registers are 64bits and accessible as words or double
  * words.  PIC registers that have valid bits (ie. not just reserved) in the
  * upper 32bits are defined as a union of one 64bit picreg_t and two 32bit
  * bridgereg_t so we can access them both ways.
diff -Nru a/include/asm-ia64/sn/sn2/shub_md.h b/include/asm-ia64/sn/sn2/shub_md.h
--- a/include/asm-ia64/sn/sn2/shub_md.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-ia64/sn/sn2/shub_md.h	Sun Feb 23 22:25:26 2003
@@ -133,7 +133,7 @@
 #define MD_DIMM_SIZE_MBYTES(_size, _2bk) (				 \
 	 	( (_size) == 7 ? 0 : ( 0x40L << (_size) ) << (_2bk)))  	 \
 
-/* The top 1/32 of each bank is directory memory, and not accessable
+/* The top 1/32 of each bank is directory memory, and not accessible
  * via normal reads and writes */
 #define MD_DIMM_USER_SIZE(_size)	((_size) * 31 / 32)
 
diff -Nru a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h
--- a/include/asm-m68knommu/cacheflush.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-m68knommu/cacheflush.h	Sun Feb 23 22:25:26 2003
@@ -4,14 +4,19 @@
 /*
  * (C) Copyright 2000-2002, Greg Ungerer <gerg@snapgear.com>
  */
+#include <linux/mm.h>
 
-#include <asm/io.h>
+#define flush_cache_all()			__flush_cache_all()
+#define flush_cache_mm(mm)			do { } while (0)
+#define flush_cache_range(vma, start, end)	do { } while (0)
+#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_page_to_ram(page)			do { } while (0)
+#define flush_dcache_range(start,len)		do { } while (0)
+#define flush_dcache_page(page)			do { } while (0)
+#define flush_icache_range(start,len)		__flush_cache_all()
+#define flush_icache_page(vma,pg)		do { } while (0)
+#define flush_icache_user_range(vma,pg,adr,len)	do { } while (0)
 
-/*
- * Cache handling functions
- */
-
-#define flush_cache_all() __flush_cache_all()
 
 extern inline void __flush_cache_all(void)
 {
@@ -57,26 +62,5 @@
 		: : : "d0" );
 #endif /* CONFIG_M5249 */
 }
-
-/*
- *	FIXME: we could do better than an entire flush in most cases.
- *	But this will always work :-)
- */
-#define	flush_cache_all()		__flush_cache_all()
-#define	flush_cache_mm(mm)		__flush_cache_all()
-#define	flush_cache_range(vma,a,b)	__flush_cache_all()
-#define	flush_cache_page(vma,p)		__flush_cache_all()
-#define	flush_page_to_ram(page)		__flush_cache_all()
-#define	flush_dcache_page(page)		__flush_cache_all()
-#define	flush_icache()			__flush_cache_all()
-#define	flush_icache_page(page)		__flush_cache_all()
-#define	flush_icache_range(start,len)	__flush_cache_all()
-#define	cache_push_v(vaddr,len)		__flush_cache_all()
-#define	cache_push(paddr,len)		__flush_cache_all()
-#define	cache_clear(paddr,len)		__flush_cache_all()
-
-#define	flush_dcache_range(a,b)
-
-#define	flush_icache_user_range(vma,page,addr,len)	__flush_cache_all()
 
 #endif /* _M68KNOMMU_CACHEFLUSH_H */
diff -Nru a/include/asm-m68knommu/flat.h b/include/asm-m68knommu/flat.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-m68knommu/flat.h	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,10 @@
+/*
+ * include/asm-m68knommu/flat.h -- uClinux flat-format executables
+ */
+
+#ifndef __M68KNOMMU_FLAT_H__
+#define __M68KNOMMU_FLAT_H__
+
+#define flat_argvp_envp_on_stack()	1
+
+#endif /* __M68KNOMMU_FLAT_H__ */
diff -Nru a/include/asm-m68knommu/m68360_enet.h b/include/asm-m68knommu/m68360_enet.h
--- a/include/asm-m68knommu/m68360_enet.h	Sun Feb 23 22:25:23 2003
+++ b/include/asm-m68knommu/m68360_enet.h	Sun Feb 23 22:25:23 2003
@@ -93,7 +93,7 @@
 #define ALEC     0x00000000
 #define DISFC    0x00000000
 #define PADS     0x00000000
-#define RET_LIM  0x000f     /* retry 15 times to send a frame before interupt */
+#define RET_LIM  0x000f     /* retry 15 times to send a frame before interrupt */
 #define ETH_MFLR 0x05ee     /* 1518 max frame size */
 #define MINFLR   0x0040     /* Minimum frame size 64 */
 #define MAXD1    0x05ee     /* Max dma count 1518 */
diff -Nru a/include/asm-m68knommu/machdep.h b/include/asm-m68knommu/machdep.h
--- a/include/asm-m68knommu/machdep.h	Sun Feb 23 22:25:23 2003
+++ b/include/asm-m68knommu/machdep.h	Sun Feb 23 22:25:23 2003
@@ -1,6 +1,8 @@
 #ifndef _M68KNOMMU_MACHDEP_H
 #define _M68KNOMMU_MACHDEP_H
 
+#include <linux/seq_file.h>
+
 struct pt_regs;
 struct kbd_repeat;
 struct mktime;
diff -Nru a/include/asm-m68knommu/mcfmbus.h b/include/asm-m68knommu/mcfmbus.h
--- a/include/asm-m68knommu/mcfmbus.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-m68knommu/mcfmbus.h	Sun Feb 23 22:25:24 2003
@@ -23,7 +23,7 @@
 
 
 /*
-*	Define the 5307 MBUS register set adresses
+*	Define the 5307 MBUS register set addresses
 */
 
 #define MCFMBUS_MADR	0x00
diff -Nru a/include/asm-m68knommu/mcfpci.h b/include/asm-m68knommu/mcfpci.h
--- a/include/asm-m68knommu/mcfpci.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-m68knommu/mcfpci.h	Sun Feb 23 22:25:25 2003
@@ -17,7 +17,7 @@
 #ifdef CONFIG_PCI
 
 /*
- *	Address regions in the PCI addres space are not mapped into the
+ *	Address regions in the PCI address space are not mapped into the
  *	normal memory space of the ColdFire. They must be accessed via
  *	handler routines. This is easy for I/O space (inb/outb/etc) but
  *	needs some code changes to support ordinary memory. Interrupts
diff -Nru a/include/asm-parisc/irq.h b/include/asm-parisc/irq.h
--- a/include/asm-parisc/irq.h	Sun Feb 23 22:25:23 2003
+++ b/include/asm-parisc/irq.h	Sun Feb 23 22:25:23 2003
@@ -95,21 +95,4 @@
 /* soft power switch support (power.c) */
 extern struct tasklet_struct power_tasklet;
 
-struct notifier_block;
-
-#ifdef CONFIG_PROFILING
-int register_profile_notifier(struct notifier_block *nb);
-int unregister_profile_notifier(struct notifier_block *nb);
-#else
-static inline int register_profile_notifier(struct notifier_block *nb)
-{
-    return -ENOSYS;
-}
-
-static inline int unregister_profile_notifier(struct notifier_block *nb)
-{
-    return -ENOSYS;
-}
-#endif
-
 #endif	/* _ASM_PARISC_IRQ_H */
diff -Nru a/include/asm-parisc/pdcpat.h b/include/asm-parisc/pdcpat.h
--- a/include/asm-parisc/pdcpat.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-parisc/pdcpat.h	Sun Feb 23 22:25:26 2003
@@ -99,7 +99,7 @@
 				       ** Monarch Processor */
 #define PDC_PAT_HPMC_RENDEZ_CPU     0L /* go into spin loop */
 #define PDC_PAT_HPMC_SET_PARAMS     1L /* Allows OS to specify intr which PDC 
-                                        * will use to interupt OS during machine
+                                        * will use to interrupt OS during machine
                                         * check rendezvous */
 
 /* parameters for PDC_PAT_HPMC_SET_PARAMS: */
diff -Nru a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h
--- a/include/asm-parisc/pgtable.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-parisc/pgtable.h	Sun Feb 23 22:25:26 2003
@@ -128,7 +128,7 @@
 #define _PAGE_PRESENT_BIT  22   /* (0x200) Software: translation valid */
 #define _PAGE_FLUSH_BIT    21   /* (0x400) Software: translation valid */
 				/*             for cache flushing only */
-#define _PAGE_USER_BIT     20   /* (0x800) Software: User accessable page */
+#define _PAGE_USER_BIT     20   /* (0x800) Software: User accessible page */
 
 /* N.B. The bits are defined in terms of a 32 bit word above, so the */
 /*      following macro is ok for both 32 and 64 bit.                */
diff -Nru a/include/asm-ppc/delay.h b/include/asm-ppc/delay.h
--- a/include/asm-ppc/delay.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-ppc/delay.h	Sun Feb 23 22:25:25 2003
@@ -31,21 +31,36 @@
  *  -- paulus
  */
 #define __MAX_UDELAY	(226050910/HZ)	/* maximum udelay argument */
+#define __MAX_NDELAY	(4294967295/HZ)	/* maximum ndelay argument */
 
-extern __inline__ void __udelay(unsigned int usecs)
+extern __inline__ void __udelay(unsigned int x)
 {
 	unsigned int loops;
 
 	__asm__("mulhwu %0,%1,%2" : "=r" (loops) :
-		"r" (usecs * (19 * HZ)), "r" (loops_per_jiffy * 226));
+		"r" (x), "r" (loops_per_jiffy * 226));
+	__delay(loops);
+}
+
+extern __inline__ void __ndelay(unsigned int x)
+{
+	unsigned int loops;
+
+	__asm__("mulhwu %0,%1,%2" : "=r" (loops) :
+		"r" (x), "r" (loops_per_jiffy * 5));
 	__delay(loops);
 }
 
 extern void __bad_udelay(void);		/* deliberately undefined */
+extern void __bad_ndelay(void);		/* deliberately undefined */
 
 #define udelay(n) (__builtin_constant_p(n)? \
-		   ((n) > __MAX_UDELAY? __bad_udelay(): __udelay((n))) : \
-		   __udelay(n))
+	((n) > __MAX_UDELAY? __bad_udelay(): __udelay((n) * (19 * HZ))) : \
+	__udelay((n) * (19 * HZ)))
+
+#define ndelay(n) (__builtin_constant_p(n)? \
+	((n) > __MAX_NDELAY? __bad_ndelay(): __ndelay((n) * HZ)) : \
+	__ndelay((n) * HZ))
 
 #endif /* defined(_PPC_DELAY_H) */
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-ppc/ide.h b/include/asm-ppc/ide.h
--- a/include/asm-ppc/ide.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-ppc/ide.h	Sun Feb 23 22:25:26 2003
@@ -27,6 +27,11 @@
 #include <linux/ioport.h>
 #include <asm/io.h>
 
+extern void __ide_mm_insw(unsigned long port, void *addr, u32 count);
+extern void __ide_mm_outsw(unsigned long port, void *addr, u32 count);
+extern void __ide_mm_insl(unsigned long port, void *addr, u32 count);
+extern void __ide_mm_outsl(unsigned long port, void *addr, u32 count);
+
 struct ide_machdep_calls {
         int         (*default_irq)(ide_ioreg_t base);
         ide_ioreg_t (*default_io_base)(int index);
diff -Nru a/include/asm-ppc/posix_types.h b/include/asm-ppc/posix_types.h
--- a/include/asm-ppc/posix_types.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-ppc/posix_types.h	Sun Feb 23 22:25:24 2003
@@ -21,6 +21,8 @@
 typedef long		__kernel_time_t;
 typedef long		__kernel_suseconds_t;
 typedef long		__kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
 typedef int		__kernel_daddr_t;
 typedef char *		__kernel_caddr_t;
 typedef short             __kernel_ipc_pid_t;
diff -Nru a/include/asm-ppc/ppcboot.h b/include/asm-ppc/ppcboot.h
--- a/include/asm-ppc/ppcboot.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-ppc/ppcboot.h	Sun Feb 23 22:25:26 2003
@@ -57,7 +57,7 @@
 #endif
 	unsigned long	bi_bootflags;	/* boot / reboot flag (for LynxOS) */
 	unsigned long	bi_ip_addr;	/* IP Address */
-	unsigned char	bi_enetaddr[6];	/* Ethernet adress */
+	unsigned char	bi_enetaddr[6];	/* Ethernet address */
 	unsigned short	bi_ethspeed;	/* Ethernet speed in Mbps */
 	unsigned long	bi_intfreq;	/* Internal Freq, in MHz */
 	unsigned long	bi_busfreq;	/* Bus Freq, in MHz */
diff -Nru a/include/asm-ppc/system.h b/include/asm-ppc/system.h
--- a/include/asm-ppc/system.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-ppc/system.h	Sun Feb 23 22:25:24 2003
@@ -86,8 +86,9 @@
 extern void note_scsi_host(struct device_node *, void *);
 
 struct task_struct;
-extern void __switch_to(struct task_struct *, struct task_struct *);
-#define switch_to(prev, next, last)	__switch_to((prev), (next))
+extern struct task_struct *__switch_to(struct task_struct *,
+	struct task_struct *);
+#define switch_to(prev, next, last)	((last) = __switch_to((prev), (next)))
 
 struct thread_struct;
 extern struct task_struct *_switch(struct thread_struct *prev,
diff -Nru a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h
--- a/include/asm-ppc/unistd.h	Sun Feb 23 22:25:22 2003
+++ b/include/asm-ppc/unistd.h	Sun Feb 23 22:25:22 2003
@@ -244,6 +244,17 @@
 #define __NR_epoll_ctl		237
 #define __NR_epoll_wait		238
 #define __NR_remap_file_pages	239
+#define __NR_timer_create	240
+#define __NR_timer_settime	241
+#define __NR_timer_gettime	242
+#define __NR_timer_getoverrun	243
+#define __NR_timer_delete	244
+#define __NR_clock_settime	245
+#define __NR_clock_gettime	246
+#define __NR_clock_getres	247
+#define __NR_clock_nanosleep	248
+
+#define __NR_syscalls		249
 
 #define __NR(n)	#n
 
@@ -418,6 +429,7 @@
 #ifdef __KERNEL__
 
 #define __NR__exit __NR_exit
+#define NR_syscalls	__NR_syscalls
 
 /*
  * Forking from kernel space will result in the child getting a new,
diff -Nru a/include/asm-ppc64/elf.h b/include/asm-ppc64/elf.h
--- a/include/asm-ppc64/elf.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-ppc64/elf.h	Sun Feb 23 22:25:25 2003
@@ -84,6 +84,11 @@
 
 #define ELF_PLATFORM	(NULL)
 
+#define ELF_PLAT_INIT(_r)	do { \
+	memset(_r->gpr, 0, sizeof(_r->gpr)); \
+	_r->ctr = _r->link = _r->xer = _r->ccr = 0; \
+} while (0)
+
 #ifdef __KERNEL__
 #define SET_PERSONALITY(ex, ibcs2)				\
 do {								\
diff -Nru a/include/asm-ppc64/hardirq.h b/include/asm-ppc64/hardirq.h
--- a/include/asm-ppc64/hardirq.h	Sun Feb 23 22:25:22 2003
+++ b/include/asm-ppc64/hardirq.h	Sun Feb 23 22:25:22 2003
@@ -82,7 +82,7 @@
 
 #define irq_enter()		(preempt_count() += HARDIRQ_OFFSET)
 
-#if CONFIG_PREEMPT
+#ifdef CONFIG_PREEMPT
 # define in_atomic()	((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
 # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
 #else
diff -Nru a/include/asm-ppc64/hw_irq.h b/include/asm-ppc64/hw_irq.h
--- a/include/asm-ppc64/hw_irq.h	Sun Feb 23 22:25:27 2003
+++ b/include/asm-ppc64/hw_irq.h	Sun Feb 23 22:25:27 2003
@@ -81,26 +81,5 @@
 struct hw_interrupt_type;
 static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
  
-struct notifier_block;
- 
-#ifdef CONFIG_PROFILING
- 
-int register_profile_notifier(struct notifier_block * nb);
-int unregister_profile_notifier(struct notifier_block * nb);
-
-#else
-
-static inline int register_profile_notifier(struct notifier_block * nb)
-{
-	return -ENOSYS;
-}
-
-static inline int unregister_profile_notifier(struct notifier_block * nb)
-{
-	return -ENOSYS;
-}
-
-#endif /* CONFIG_PROFILING */
- 
 #endif /* _PPC64_HW_IRQ_H */
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-ppc64/iSeries/ItLpNaca.h b/include/asm-ppc64/iSeries/ItLpNaca.h
--- a/include/asm-ppc64/iSeries/ItLpNaca.h	Sun Feb 23 22:25:21 2003
+++ b/include/asm-ppc64/iSeries/ItLpNaca.h	Sun Feb 23 22:25:21 2003
@@ -57,7 +57,7 @@
 	u16	xRsvd1_3;		// Reserved			x20-x21
 	u16	xPlicVrmIndex;		// VRM index of PLIC		x22-x23
 	u16	xMinSupportedSlicVrmInd;// Min supported OS VRM index	x24-x25
-	u16	xMinCompatableSlicVrmInd;// Min compatable OS VRM index x26-x27
+	u16	xMinCompatableSlicVrmInd;// Min compatible OS VRM index x26-x27
 	u64	xLoadAreaAddr;		// ER address of load area	x28-x2F
 	u32	xLoadAreaChunks;	// Chunks for the load area	x30-x33
 	u32	xPaseSysCallCRMask;	// Mask used to test CR before  x34-x37
diff -Nru a/include/asm-ppc64/posix_types.h b/include/asm-ppc64/posix_types.h
--- a/include/asm-ppc64/posix_types.h	Sun Feb 23 22:25:27 2003
+++ b/include/asm-ppc64/posix_types.h	Sun Feb 23 22:25:27 2003
@@ -26,6 +26,8 @@
 typedef long		__kernel_ssize_t;
 typedef long		__kernel_ptrdiff_t;
 typedef long		__kernel_time_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
 typedef long		__kernel_suseconds_t;
 typedef long		__kernel_clock_t;
 typedef int		__kernel_daddr_t;
diff -Nru a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h
--- a/include/asm-ppc64/processor.h	Sun Feb 23 22:25:21 2003
+++ b/include/asm-ppc64/processor.h	Sun Feb 23 22:25:21 2003
@@ -598,7 +598,7 @@
 extern int have_of;
 
 struct task_struct;
-void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
+void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp);
 void release_thread(struct task_struct *);
 
 /*
diff -Nru a/include/asm-ppc64/semaphore.h b/include/asm-ppc64/semaphore.h
--- a/include/asm-ppc64/semaphore.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-ppc64/semaphore.h	Sun Feb 23 22:25:24 2003
@@ -23,12 +23,12 @@
 	 */
 	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
@@ -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
 }
@@ -74,7 +74,7 @@
 
 static inline void down(struct semaphore * sem)
 {
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 	might_sleep();
@@ -91,7 +91,7 @@
 {
 	int ret = 0;
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 	might_sleep();
@@ -106,7 +106,7 @@
 {
 	int ret;
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 
@@ -117,7 +117,7 @@
 
 static inline void up(struct semaphore * sem)
 {
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 
diff -Nru a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h
--- a/include/asm-ppc64/system.h	Sun Feb 23 22:25:27 2003
+++ b/include/asm-ppc64/system.h	Sun Feb 23 22:25:27 2003
@@ -89,11 +89,13 @@
 extern int abs(int);
 
 struct task_struct;
-extern void __switch_to(struct task_struct *, struct task_struct *);
-#define switch_to(prev, next, last) __switch_to((prev), (next))
+extern struct task_struct *__switch_to(struct task_struct *,
+				       struct task_struct *);
+#define switch_to(prev, next, last)	((last) = __switch_to((prev), (next)))
 
 struct thread_struct;
-extern void _switch(struct thread_struct *prev, struct thread_struct *next);
+extern struct task_struct * _switch(struct thread_struct *prev,
+				    struct thread_struct *next);
 
 struct pt_regs;
 extern void dump_regs(struct pt_regs *);
diff -Nru a/include/asm-ppc64/unistd.h b/include/asm-ppc64/unistd.h
--- a/include/asm-ppc64/unistd.h	Sun Feb 23 22:25:21 2003
+++ b/include/asm-ppc64/unistd.h	Sun Feb 23 22:25:21 2003
@@ -250,6 +250,22 @@
 #define __NR_sys_epoll_ctl	237
 #define __NR_sys_epoll_wait	238
 #define __NR_remap_file_pages	239
+#define __NR_timer_create	240
+#define __NR_timer_settime	241
+#define __NR_timer_gettime	242
+#define __NR_timer_getoverrun	243
+#define __NR_timer_delete	244
+#define __NR_clock_settime	245
+#define __NR_clock_gettime	246
+#define __NR_clock_getres	247
+#define __NR_clock_nanosleep	248
+
+#define __NR_syscalls		249
+#ifdef __KERNEL__
+#define NR_syscalls	__NR_syscalls
+#endif
+
+#ifndef __ASSEMBLY__
 
 #ifdef __KERNEL_SYSCALLS__
 
@@ -283,5 +299,7 @@
  * but it doesn't work on all toolchains, so we just do it by hand
  */
 #define cond_syscall(x) asm(".weak\t." #x "\n\t.set\t." #x ",.sys_ni_syscall");
+
+#endif		/* __ASSEMBLY__ */
 
 #endif /* _ASM_PPC_UNISTD_H_ */
diff -Nru a/include/asm-s390/cio.h b/include/asm-s390/cio.h
--- a/include/asm-s390/cio.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-s390/cio.h	Sun Feb 23 22:25:26 2003
@@ -111,7 +111,7 @@
 
 struct ccw1 {
 	__u8  cmd_code;		/* command code */
-	__u8  flags;   		/* flags, like IDA adressing, etc. */
+	__u8  flags;   		/* flags, like IDA addressing, etc. */
 	__u16 count;   		/* byte count */
 	__u32 cda;     		/* data address */
 } __attribute__ ((packed,aligned(8)));
diff -Nru a/include/asm-s390x/cio.h b/include/asm-s390x/cio.h
--- a/include/asm-s390x/cio.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-s390x/cio.h	Sun Feb 23 22:25:24 2003
@@ -111,7 +111,7 @@
 
 struct ccw1 {
 	__u8  cmd_code;		/* command code */
-	__u8  flags;   		/* flags, like IDA adressing, etc. */
+	__u8  flags;   		/* flags, like IDA addressing, etc. */
 	__u16 count;   		/* byte count */
 	__u32 cda;     		/* data address */
 } __attribute__ ((packed,aligned(8)));
diff -Nru a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h
--- a/include/asm-sparc/ide.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-sparc/ide.h	Sun Feb 23 22:25:24 2003
@@ -20,12 +20,12 @@
 #undef  MAX_HWIFS
 #define MAX_HWIFS	2
 
-static __inline__ int ide_default_irq(ide_ioreg_t base)
+static __inline__ int ide_default_irq(unsigned long base)
 {
 	return 0;
 }
 
-static __inline__ ide_ioreg_t ide_default_io_base(int index)
+static __inline__ unsigned long ide_default_io_base(int index)
 {
 	return 0;
 }
@@ -34,9 +34,9 @@
  * Doing any sort of ioremap() here does not work
  * because this function may be called with null aguments.
  */
-static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
+static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq)
 {
-	ide_ioreg_t reg =  data_port;
+	unsigned long reg = data_port;
 	int i;
 
 	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
@@ -46,7 +46,7 @@
 	if (ctrl_port) {
 		hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
 	} else {
-		hw->io_ports[IDE_CONTROL_OFFSET] = 0;
+		hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206;
 	}
 	if (irq != NULL)
 		*irq = 0;
@@ -64,6 +64,7 @@
 	int index;
 
 	for (index = 0; index < MAX_HWIFS; index++) {
+		memset(&hw, 0, sizeof hw);
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
 		ide_register_hw(&hw, NULL);
@@ -71,38 +72,78 @@
 #endif
 }
 
-#define ide_request_irq(irq,hand,flg,dev,id)	request_irq((irq),(hand),(flg),(dev),(id))
-#define ide_free_irq(irq,dev_id)		free_irq((irq), (dev_id))
-#define ide_check_region(from,extent)		check_region((from), (extent))
-#define ide_request_region(from,extent,name)	request_region((from), (extent), (name))
-#define ide_release_region(from,extent)		release_region((from), (extent))
+#define __ide_insl(data_reg, buffer, wcount) \
+	__ide_insw(data_reg, buffer, (wcount)<<1)
+#define __ide_outsl(data_reg, buffer, wcount) \
+	__ide_outsw(data_reg, buffer, (wcount)<<1)
+
+/* On sparc, I/O ports and MMIO registers are accessed identically.  */
+#define __ide_mm_insw	__ide_insw
+#define __ide_mm_insl	__ide_insl
+#define __ide_mm_outsw	__ide_outsw
+#define __ide_mm_outsl	__ide_outsl
+
+static __inline__ void __ide_insw(unsigned long port,
+				  void *dst,
+				  unsigned long count)
+{
+	volatile unsigned short *data_port;
+	/* unsigned long end = (unsigned long)dst + (count << 1); */ /* P3 */
+	u16 *ps = dst;
+	u32 *pi;
+
+	data_port = (volatile unsigned short *)port;
+
+	if(((unsigned long)ps) & 0x2) {
+		*ps++ = *data_port;
+		count--;
+	}
+	pi = (u32 *)ps;
+	while(count >= 2) {
+		u32 w;
+
+		w  = (*data_port) << 16;
+		w |= (*data_port);
+		*pi++ = w;
+		count -= 2;
+	}
+	ps = (u16 *)pi;
+	if(count)
+		*ps++ = *data_port;
 
-/*
- * The following is not needed for the non-m68k ports
- */
-#define ide_ack_intr(hwif)		(1)
+	/* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */
+}
 
-/* XXX Known to be broken.  Axboe will fix the problems this
- * XXX has by making separate IN/OUT macros for IDE_DATA
- * XXX register and rest of IDE regs and also using
- * XXX ide_ioreg_t instead of u32 for ports. -DaveM
- */
+static __inline__ void __ide_outsw(unsigned long port,
+				   const void *src,
+				   unsigned long count)
+{
+	volatile unsigned short *data_port;
+	/* unsigned long end = (unsigned long)src + (count << 1); */
+	const u16 *ps = src;
+	const u32 *pi;
+
+	data_port = (volatile unsigned short *)port;
+
+	if(((unsigned long)src) & 0x2) {
+		*data_port = *ps++;
+		count--;
+	}
+	pi = (const u32 *)ps;
+	while(count >= 2) {
+		u32 w;
+
+		w = *pi++;
+		*data_port = (w >> 16);
+		*data_port = w;
+		count -= 2;
+	}
+	ps = (const u16 *)pi;
+	if(count)
+		*data_port = *ps;
 
-#define HAVE_ARCH_IN_BYTE
-#define IN_BYTE(p)		(*((volatile u8 *)(p)))
-#define IN_WORD(p)		(*((volatile u16 *)(p)))
-#define IN_LONG(p)		(*((volatile u32 *)(p)))
-#define IN_BYTE_P		IN_BYTE
-#define IN_WORD_P		IN_WORD
-#define IN_LONG_P		IN_LONG
-
-#define HAVE_ARCH_OUT_BYTE
-#define OUT_BYTE(b,p)		((*((volatile u8 *)(p))) = (b))
-#define OUT_WORD(w,p)		((*((volatile u16 *)(p))) = (w))
-#define OUT_LONG(l,p)		((*((volatile u32 *)(p))) = (l))
-#define OUT_BYTE_P		OUT_BYTE
-#define OUT_WORD_P		OUT_WORD
-#define OUT_LONG_P		OUT_LONG
+	/* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */
+}
 
 #endif /* __KERNEL__ */
 
diff -Nru a/include/asm-sparc/posix_types.h b/include/asm-sparc/posix_types.h
--- a/include/asm-sparc/posix_types.h	Sun Feb 23 22:25:23 2003
+++ b/include/asm-sparc/posix_types.h	Sun Feb 23 22:25:23 2003
@@ -31,6 +31,8 @@
 typedef unsigned int	       __kernel_gid32_t;
 typedef unsigned short	       __kernel_old_uid_t;
 typedef unsigned short	       __kernel_old_gid_t;
+typedef int                    __kernel_clockid_t;
+typedef int                    __kernel_timer_t;
 
 #ifdef __GNUC__
 typedef long long	__kernel_loff_t;
diff -Nru a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h
--- a/include/asm-sparc64/ide.h	Sun Feb 23 22:25:23 2003
+++ b/include/asm-sparc64/ide.h	Sun Feb 23 22:25:23 2003
@@ -1,4 +1,4 @@
-/* $Id: ide.h,v 1.22 2002/01/16 20:58:40 davem Exp $
+/* $Id: ide.h,v 1.21 2001/09/25 20:21:48 kanoj Exp $
  * ide.h: Ultra/PCI specific IDE glue.
  *
  * Copyright (C) 1997  David S. Miller (davem@caip.rutgers.edu)
@@ -20,19 +20,19 @@
 #undef  MAX_HWIFS
 #define MAX_HWIFS	2
 
-static __inline__ int ide_default_irq(ide_ioreg_t base)
+static __inline__ int ide_default_irq(unsigned long base)
 {
 	return 0;
 }
 
-static __inline__ ide_ioreg_t ide_default_io_base(int index)
+static __inline__ unsigned long ide_default_io_base(int index)
 {
 	return 0;
 }
 
-static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
+static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq)
 {
-	ide_ioreg_t reg =  data_port;
+	unsigned long reg = data_port;
 	int i;
 
 	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
@@ -42,7 +42,7 @@
 	if (ctrl_port) {
 		hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
 	} else {
-		hw->io_ports[IDE_CONTROL_OFFSET] = 0;
+		hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206;
 	}
 	if (irq != NULL)
 		*irq = 0;
@@ -55,84 +55,111 @@
  */
 static __inline__ void ide_init_default_hwifs(void)
 {
-#ifndef CONFIG_PCI
+#ifndef CONFIG_BLK_DEV_IDEPCI
 	hw_regs_t hw;
 	int index;
 
 	for (index = 0; index < MAX_HWIFS; index++) {
+		memset(&hw, 0, sizeof hw);
 		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 		hw.irq = ide_default_irq(ide_default_io_base(index));
 		ide_register_hw(&hw, NULL);
 	}
-#endif
+#endif /* CONFIG_BLK_DEV_IDEPCI */
 }
 
+#define __ide_insl(data_reg, buffer, wcount) \
+	__ide_insw(data_reg, buffer, (wcount)<<1)
+#define __ide_outsl(data_reg, buffer, wcount) \
+	__ide_outsw(data_reg, buffer, (wcount)<<1)
 
-#define ide_request_irq(irq,hand,flg,dev,id)	request_irq((irq),(hand),(flg),(dev),(id))
-#define ide_free_irq(irq,dev_id)		free_irq((irq), (dev_id))
-#define ide_check_region(from,extent)		check_region((from), (extent))
-#define ide_request_region(from,extent,name)	request_region((from), (extent), (name))
-#define ide_release_region(from,extent)		release_region((from), (extent))
-
-/*
- * The following is not needed for the non-m68k ports
- */
-#define ide_ack_intr(hwif)		(1)
+/* On sparc64, I/O ports and MMIO registers are accessed identically.  */
+#define __ide_mm_insw	__ide_insw
+#define __ide_mm_insl	__ide_insl
+#define __ide_mm_outsw	__ide_outsw
+#define __ide_mm_outsl	__ide_outsl
 
-/* XXX Known to be broken.  Axboe will fix the problems this
- * XXX has by making separate IN/OUT macros for IDE_DATA
- * XXX register and rest of IDE regs and also using
- * XXX ide_ioreg_t instead of u32 for ports. -DaveM
- */
+static __inline__ unsigned int inw_be(unsigned long addr)
+{
+	unsigned int ret;
 
-#define HAVE_ARCH_IN_BYTE
-static __inline__ u8 IN_BYTE(ide_ioreg_t addr)
-{	u8 ret;
-	 __asm__ __volatile__("lduba [%1] %2, %0\t/* ide_in_byte */"
-			     : "=r" (ret)
-			     : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
-	return ret;
-}
-static __inline__ u16 IN_WORD(ide_ioreg_t addr)
-{	u16 ret;
-	__asm__ __volatile__("lduha [%1] %2, %0\t/* ide_in_word */"
-			     : "=r" (ret)
-			     : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
-	return ret;
-}
-static __inline__ u16 IN_LONG(ide_ioreg_t addr)
-{	u32 ret;
-	__asm__ __volatile__("lduwa [%1] %2, %0\t/* ide_in_long */"
+	__asm__ __volatile__("lduha [%1] %2, %0"
 			     : "=r" (ret)
 			     : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
+
 	return ret;
 }
-#define IN_BYTE_P		IN_BYTE
-#define IN_WORD_P		IN_WORD
-#define IN_LONG_P		IN_LONG
 
-#define HAVE_ARCH_OUT_BYTE
-static __inline__ void OUT_BYTE(u8 byte, ide_ioreg_t addr)
+static __inline__ void __ide_insw(unsigned long port,
+				  void *dst,
+				  u32 count)
 {
-	__asm__ __volatile__("stba %r0, [%1] %2\t/* ide_out_byte */"
-			     : /* no outputs */
-			     : "Jr" (byte), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
+#if (L1DCACHE_SIZE > PAGE_SIZE)		/* is there D$ aliasing problem */
+	unsigned long end = (unsigned long)dst + (count << 1);
+#endif
+	u16 *ps = dst;
+	u32 *pi;
+
+	if(((u64)ps) & 0x2) {
+		*ps++ = inw_be(port);
+		count--;
+	}
+	pi = (u32 *)ps;
+	while(count >= 2) {
+		u32 w;
+
+		w  = inw_be(port) << 16;
+		w |= inw_be(port);
+		*pi++ = w;
+		count -= 2;
+	}
+	ps = (u16 *)pi;
+	if(count)
+		*ps++ = inw_be(port);
+
+#if (L1DCACHE_SIZE > PAGE_SIZE)		/* is there D$ aliasing problem */
+	__flush_dcache_range((unsigned long)dst, end);
+#endif
 }
-static __inline__ void OUT_WORD(u16 word, ide_ioreg_t addr)
+
+static __inline__ void outw_be(unsigned short w, unsigned long addr)
 {
-	__asm__ __volatile__("stha %r0, [%1] %2\t/* ide_out_word */"
+	__asm__ __volatile__("stha %0, [%1] %2"
 			     : /* no outputs */
-			     : "Jr" (word), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
+			     : "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
 }
-static __inline__ void OUT_LONG(u32 _long, ide_ioreg_t addr)
+
+static __inline__ void __ide_outsw(unsigned long port,
+				   void *src,
+				   u32 count)
 {
-	__asm__ __volatile__("stwa %r0, [%1] %2\t/* ide_out_long */"
-			     : /* no outputs */
-			     : "Jr" (_long), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
+#if (L1DCACHE_SIZE > PAGE_SIZE)		/* is there D$ aliasing problem */
+	unsigned long end = (unsigned long)src + (count << 1);
+#endif
+	const u16 *ps = src;
+	const u32 *pi;
+
+	if(((u64)src) & 0x2) {
+		outw_be(*ps++, port);
+		count--;
+	}
+	pi = (const u32 *)ps;
+	while(count >= 2) {
+		u32 w;
+
+		w = *pi++;
+		outw_be((w >> 16), port);
+		outw_be(w, port);
+		count -= 2;
+	}
+	ps = (const u16 *)pi;
+	if(count)
+		outw_be(*ps, port);
+
+#if (L1DCACHE_SIZE > PAGE_SIZE)		/* is there D$ aliasing problem */
+	__flush_dcache_range((unsigned long)src, end);
+#endif
 }
-#define OUT_BYTE_P		OUT_BYTE
-#define OUT_WORD_P		OUT_WORD
-#define OUT_LONG_P		OUT_LONG
 
 #endif /* __KERNEL__ */
 
diff -Nru a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h
--- a/include/asm-sparc64/irq.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-sparc64/irq.h	Sun Feb 23 22:25:24 2003
@@ -157,25 +157,4 @@
 	return retval;
 }
 
-struct notifier_block;
- 
-#ifdef CONFIG_PROFILING
- 
-int register_profile_notifier(struct notifier_block *nb);
-int unregister_profile_notifier(struct notifier_block *nb);
-
-#else
-
-static inline int register_profile_notifier(struct notifier_block *nb)
-{
-	return -ENOSYS;
-}
-
-static inline int unregister_profile_notifier(struct notifier_block *nb)
-{
-	return -ENOSYS;
-}
-
-#endif /* CONFIG_PROFILING */
-
 #endif
diff -Nru a/include/asm-sparc64/posix_types.h b/include/asm-sparc64/posix_types.h
--- a/include/asm-sparc64/posix_types.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-sparc64/posix_types.h	Sun Feb 23 22:25:26 2003
@@ -26,6 +26,8 @@
 typedef char *                 __kernel_caddr_t;
 typedef unsigned short	       __kernel_uid16_t;
 typedef unsigned short	       __kernel_gid16_t;
+typedef int                    __kernel_clockid_t;
+typedef int                    __kernel_timer_t;
 
 typedef __kernel_uid_t 	       __kernel_old_uid_t;
 typedef __kernel_gid_t         __kernel_old_gid_t;
diff -Nru a/include/asm-sparc64/psrcompat.h b/include/asm-sparc64/psrcompat.h
--- a/include/asm-sparc64/psrcompat.h	Sun Feb 23 22:25:21 2003
+++ b/include/asm-sparc64/psrcompat.h	Sun Feb 23 22:25:21 2003
@@ -4,7 +4,7 @@
 
 #include <asm/pstate.h>
 
-/* Old 32-bit PSR fields for the compatability conversion code. */
+/* Old 32-bit PSR fields for the compatibility conversion code. */
 #define PSR_CWP     0x0000001f         /* current window pointer     */
 #define PSR_ET      0x00000020         /* enable traps field         */
 #define PSR_PS      0x00000040         /* previous privilege level   */
diff -Nru a/include/asm-v850/asm.h b/include/asm-v850/asm.h
--- a/include/asm-v850/asm.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-v850/asm.h	Sun Feb 23 22:25:24 2003
@@ -1,8 +1,8 @@
 /*
  * include/asm-v850/asm.h -- Macros for writing assembly code
  *
- *  Copyright (C) 2001,02  NEC Corporation
- *  Copyright (C) 2001,02  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2001,02,03  NEC Corporation
+ *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
  *
  * This file is subject to the terms and conditions of the GNU General
  * Public License.  See the file COPYING in the main directory of this
@@ -12,7 +12,7 @@
  */
 
 #define G_ENTRY(name)							      \
-   .align 4;								      \
+   .balign 4;								      \
    .globl name;								      \
    .type  name,@function;						      \
    name
@@ -24,7 +24,7 @@
    .size  name,.-name
 
 #define L_ENTRY(name)							      \
-   .align 4;								      \
+   .balign 4;								      \
    .type  name,@function;						      \
    name
 #define L_DATA(name)							      \
diff -Nru a/include/asm-v850/bug.h b/include/asm-v850/bug.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-v850/bug.h	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,21 @@
+/*
+ * include/asm-v850/bug.h -- Bug reporting
+ *
+ *  Copyright (C) 2003  NEC Electronics Corporation
+ *  Copyright (C) 2003  Miles Bader <miles@gnu.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License.  See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ * Written by Miles Bader <miles@gnu.org>
+ */
+
+#ifndef __V850_BUG_H__
+#define __V850_BUG_H__
+
+extern void __bug (void) __attribute__ ((noreturn));
+#define BUG()		__bug()
+#define PAGE_BUG(page)	__bug()
+
+#endif /* __V850_BUG_H__ */
diff -Nru a/include/asm-v850/entry.h b/include/asm-v850/entry.h
--- a/include/asm-v850/entry.h	Sun Feb 23 22:25:27 2003
+++ b/include/asm-v850/entry.h	Sun Feb 23 22:25:27 2003
@@ -1,8 +1,8 @@
 /*
  * include/asm-v850/entry.h -- Definitions used by low-level trap handlers
  *
- *  Copyright (C) 2001,02  NEC Corporation
- *  Copyright (C) 2001,02  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2001,02,03  NEC Electronics Corporation
+ *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
  *
  * This file is subject to the terms and conditions of the GNU General
  * Public License.  See the file COPYING in the main directory of this
@@ -17,21 +17,6 @@
 
 #include <asm/ptrace.h>
 #include <asm/machdep.h>
-
-
-/* If true, system calls save and restore all registers (except result
-   registers, of course).  If false, then `call clobbered' registers
-   will not be preserved, on the theory that system calls are basically
-   function calls anyway, and the caller should be able to deal with it.
-   This is a security risk, of course, as `internal' values may leak out
-   after a system call, but that certainly doesn't matter very much for
-   a processor with no MMU protection!  For a protected-mode kernel, it
-   would be faster to just zero those registers before returning.  */
-#define TRAPS_PRESERVE_CALL_CLOBBERED_REGS	0
-
-/* If TRAPS_PRESERVE_CALL_CLOBBERED_REGS is false, then zero `call
-   clobbered' registers before returning from a system call.  */
-#define TRAPS_ZERO_CALL_CLOBBERED_REGS		0
 
 
 /* These are special variables using by the kernel trap/interrupt code
diff -Nru a/include/asm-v850/flat.h b/include/asm-v850/flat.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-v850/flat.h	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,19 @@
+/*
+ * include/asm-v850/flat.h -- uClinux flat-format executables
+ *
+ *  Copyright (C) 2002  NEC Corporation
+ *  Copyright (C) 2002  Miles Bader <miles@gnu.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License.  See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ * Written by Miles Bader <miles@gnu.org>
+ */
+
+#ifndef __V850_FLAT_H__
+#define __V850_FLAT_H__
+
+#define flat_argvp_envp_on_stack()	0
+
+#endif /* __V850_FLAT_H__ */
diff -Nru a/include/asm-v850/page.h b/include/asm-v850/page.h
--- a/include/asm-v850/page.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-v850/page.h	Sun Feb 23 22:25:25 2003
@@ -1,8 +1,8 @@
 /*
  * include/asm-v850/page.h -- VM ops
  *
- *  Copyright (C) 2001, 2002  NEC Corporation
- *  Copyright (C) 2001, 2002  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2001,02,03  NEC Electronics Corporation
+ *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
  *
  * This file is subject to the terms and conditions of the GNU General
  * Public License.  See the file COPYING in the main directory of this
@@ -93,10 +93,6 @@
 
 
 #ifndef __ASSEMBLY__
-
-extern void __bug (void) __attribute__ ((noreturn));
-#define BUG()		__bug()
-#define PAGE_BUG(page)	__bug()
 
 /* Pure 2^n version of get_order */
 extern __inline__ int get_order (unsigned long size)
diff -Nru a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
--- a/include/asm-x86_64/bitops.h	Sun Feb 23 22:25:23 2003
+++ b/include/asm-x86_64/bitops.h	Sun Feb 23 22:25:23 2003
@@ -303,7 +303,7 @@
 {
 	unsigned long * p = ((unsigned long *) addr) + (offset >> 6);
 	unsigned long set = 0;
-	long res, bit = offset&63;
+	unsigned long res, bit = offset&63;
 	
 	if (bit) {
 		/*
diff -Nru a/include/asm-x86_64/delay.h b/include/asm-x86_64/delay.h
--- a/include/asm-x86_64/delay.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-x86_64/delay.h	Sun Feb 23 22:25:25 2003
@@ -8,13 +8,20 @@
  */
  
 extern void __bad_udelay(void);
+extern void __bad_ndelay(void);
 
 extern void __udelay(unsigned long usecs);
+extern void __ndelay(unsigned long usecs);
 extern void __const_udelay(unsigned long usecs);
 extern void __delay(unsigned long loops);
 
 #define udelay(n) (__builtin_constant_p(n) ? \
 	((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \
 	__udelay(n))
+
+#define ndelay(n) (__builtin_constant_p(n) ? \
+       ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
+       __ndelay(n))
+
 
 #endif /* defined(_X8664_DELAY_H) */
diff -Nru a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
--- a/include/asm-x86_64/hw_irq.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-x86_64/hw_irq.h	Sun Feb 23 22:25:26 2003
@@ -135,11 +135,9 @@
 	unsigned long rip;
 	extern unsigned long prof_cpu_mask;
 	extern char _stext;
-#ifdef CONFIG_PROFILING
-	extern void x86_profile_hook(struct pt_regs *);
  
-	x86_profile_hook(regs);
-#endif
+	profile_hook(regs);
+
 	if (user_mode(regs))
 		return;
 	if (!prof_buffer)
@@ -166,26 +164,6 @@
 	atomic_inc((atomic_t *)&prof_buffer[rip]);
 }
 
-struct notifier_block;
- 
-#ifdef CONFIG_PROFILING
-
-int register_profile_notifier(struct notifier_block * nb);
-int unregister_profile_notifier(struct notifier_block * nb);
-
-#else
-
-static inline int register_profile_notifier(struct notifier_block * nb)
-{
-	return -ENOSYS;
-}
-
-static inline int unregister_profile_notifier(struct notifier_block * nb)
-{
-	return -ENOSYS;
-}
-
-#endif /* CONFIG_PROFILING */
 #ifdef CONFIG_SMP /*more of this file should probably be ifdefed SMP */
 static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {
 	if (IO_APIC_IRQ(i))
diff -Nru a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h
--- a/include/asm-x86_64/i387.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-x86_64/i387.h	Sun Feb 23 22:25:24 2003
@@ -27,7 +27,7 @@
 	if (!me->used_math)
 		return 0;
 	me->used_math = 0; 
-	if (!test_thread_flag(TIF_USEDFPU))
+	if (me->thread_info->flags & _TIF_USEDFPU)
 		return 0;
 	return 1;
 } 
@@ -39,14 +39,14 @@
 #define kernel_fpu_end() stts()
 
 #define unlazy_fpu(tsk) do { \
-	if ((tsk)->thread_info->flags & TIF_USEDFPU) \
+	if ((tsk)->thread_info->flags & _TIF_USEDFPU) \
 		save_init_fpu(tsk); \
 } while (0)
 
 #define clear_fpu(tsk) do { \
-	if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) {		\
+	if ((tsk)->thread_info->flags & _TIF_USEDFPU) {		\
 		asm volatile("fwait");				\
-		clear_tsk_thread_flag(tsk,TIF_USEDFPU); 	\
+		(tsk)->thread_info->flags &= ~_TIF_USEDFPU;	\
 		stts();						\
 	}							\
 } while (0)
diff -Nru a/include/asm-x86_64/ide.h b/include/asm-x86_64/ide.h
--- a/include/asm-x86_64/ide.h	Sun Feb 23 22:25:24 2003
+++ b/include/asm-x86_64/ide.h	Sun Feb 23 22:25:24 2003
@@ -16,14 +16,14 @@
 #include <linux/config.h>
 
 #ifndef MAX_HWIFS
-# ifdef CONFIG_PCI
+# ifdef CONFIG_BLK_DEV_IDEPCI
 #define MAX_HWIFS	10
 # else
 #define MAX_HWIFS	6
 # endif
 #endif
 
-static __inline__ int ide_default_irq(ide_ioreg_t base)
+static __inline__ int ide_default_irq(unsigned long base)
 {
 	switch (base) {
 		case 0x1f0: return 14;
@@ -37,16 +37,24 @@
 	}
 }
 
-static __inline__ ide_ioreg_t ide_default_io_base(int index)
+static __inline__ unsigned long ide_default_io_base(int index)
 {
-	static unsigned long ata_io_base[MAX_HWIFS] = { 0x1f0, 0x170, 0x1e8, 0x168, 0x1e0, 0x160 };
-
-	return ata_io_base[index];
+	switch (index) {
+		case 0:	return 0x1f0;
+		case 1:	return 0x170;
+		case 2: return 0x1e8;
+		case 3: return 0x168;
+		case 4: return 0x1e0;
+		case 5: return 0x160;
+		default:
+			return 0;
+	}
 }
 
-static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
+static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
+	 unsigned long ctrl_port, int *irq)
 {
-	ide_ioreg_t reg = data_port;
+	unsigned long reg = data_port;
 	int i;
 
 	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
@@ -65,7 +73,7 @@
 
 static __inline__ void ide_init_default_hwifs(void)
 {
-#ifndef CONFIG_PCI
+#ifndef CONFIG_BLK_DEV_IDEPCI
 	hw_regs_t hw;
 	int index;
 
@@ -75,8 +83,10 @@
 		hw.irq = ide_default_irq(ide_default_io_base(index));
 		ide_register_hw(&hw, NULL);
 	}
-#endif
+#endif /* CONFIG_BLK_DEV_IDEPCI */
 }
+
+#include <asm-generic/ide_iops.h>
 
 #endif /* __KERNEL__ */
 
diff -Nru a/include/asm-x86_64/mtrr.h b/include/asm-x86_64/mtrr.h
--- a/include/asm-x86_64/mtrr.h	Sun Feb 23 22:25:22 2003
+++ b/include/asm-x86_64/mtrr.h	Sun Feb 23 22:25:22 2003
@@ -35,11 +35,15 @@
     unsigned int type;     /*  Type of region   */
 };
 
+/* Warning: this structure has a different order from i386
+   on x86-64. The 32bit emulation code takes care of that.
+   But you need to use this for 64bit, otherwise your X server
+   will break. */
 struct mtrr_gentry
 {
     unsigned long base;    /*  Base address     */
-    unsigned int regnum;   /*  Register number  */
     unsigned int size;    /*  Size of region   */
+    unsigned int regnum;   /*  Register number  */
     unsigned int type;     /*  Type of region   */
 };
 
diff -Nru a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h
--- a/include/asm-x86_64/pda.h	Sun Feb 23 22:25:23 2003
+++ b/include/asm-x86_64/pda.h	Sun Feb 23 22:25:23 2003
@@ -1,6 +1,7 @@
 #ifndef X86_64_PDA_H
 #define X86_64_PDA_H
 
+#ifndef __ASSEMBLY__
 #include <linux/stddef.h>
 #include <linux/types.h>
 #include <linux/cache.h>
@@ -25,7 +26,6 @@
 	unsigned apic_timer_irqs;
 } ____cacheline_aligned;
 
-#define PDA_STACKOFFSET (5*8)
 
 #define IRQSTACK_ORDER 2
 #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) 
@@ -77,5 +77,9 @@
 #define write_pda(field,val) pda_to_op("mov",field,val)
 #define add_pda(field,val) pda_to_op("add",field,val)
 #define sub_pda(field,val) pda_to_op("sub",field,val)
+
+#endif
+
+#define PDA_STACKOFFSET (5*8)
 
 #endif
diff -Nru a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
--- a/include/asm-x86_64/pgtable.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-x86_64/pgtable.h	Sun Feb 23 22:25:25 2003
@@ -334,6 +334,7 @@
 
 /* page, protection -> pte */
 #define mk_pte(page, pgprot)	pfn_pte(page_to_pfn(page), (pgprot))
+#define mk_pte_huge(entry) (pte_val(entry) |= _PAGE_PRESENT | _PAGE_PSE)
  
 /* physical address -> PTE */
 static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
@@ -348,6 +349,7 @@
 { 
 	pte_val(pte) &= _PAGE_CHG_MASK;
 	pte_val(pte) |= pgprot_val(newprot);
+	pte_val(pte) &= __supported_pte_mask;
        return pte; 
 }
 
diff -Nru a/include/asm-x86_64/posix_types.h b/include/asm-x86_64/posix_types.h
--- a/include/asm-x86_64/posix_types.h	Sun Feb 23 22:25:27 2003
+++ b/include/asm-x86_64/posix_types.h	Sun Feb 23 22:25:27 2003
@@ -22,6 +22,8 @@
 typedef long		__kernel_time_t;
 typedef long		__kernel_suseconds_t;
 typedef long		__kernel_clock_t;
+typedef int            __kernel_timer_t;
+typedef int            __kernel_clockid_t;
 typedef int		__kernel_daddr_t;
 typedef char *		__kernel_caddr_t;
 typedef unsigned short	__kernel_uid16_t;
diff -Nru a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
--- a/include/asm-x86_64/processor.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-x86_64/processor.h	Sun Feb 23 22:25:26 2003
@@ -58,6 +58,9 @@
 	char	x86_model_id[64];
 	int 	x86_cache_size;  /* in KB */
 	int	x86_clflush_size;
+	int	x86_tlbsize;	/* number of 4K pages in DTLB/ITLB combined(in pages)*/
+        __u8    x86_virt_bits, x86_phys_bits;
+        __u32   x86_power; 	
 	unsigned long loops_per_jiffy;
 } ____cacheline_aligned;
 
diff -Nru a/include/asm-x86_64/signal.h b/include/asm-x86_64/signal.h
--- a/include/asm-x86_64/signal.h	Sun Feb 23 22:25:21 2003
+++ b/include/asm-x86_64/signal.h	Sun Feb 23 22:25:21 2003
@@ -4,6 +4,7 @@
 #ifndef __ASSEMBLY__
 #include <linux/types.h>
 #include <linux/linkage.h>
+#include <linux/time.h>
 
 /* Avoid too many header ordering problems.  */
 struct siginfo;
diff -Nru a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
--- a/include/asm-x86_64/smp.h	Sun Feb 23 22:25:21 2003
+++ b/include/asm-x86_64/smp.h	Sun Feb 23 22:25:21 2003
@@ -8,6 +8,7 @@
 #include <linux/config.h>
 #include <linux/threads.h>
 #include <linux/bitops.h>
+extern int disable_apic;
 #endif
 
 #ifdef CONFIG_X86_LOCAL_APIC
@@ -92,7 +93,6 @@
 	return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID));
 }
 
-extern int disable_apic;
 extern int slow_smp_processor_id(void);
 
 extern inline int safe_smp_processor_id(void)
diff -Nru a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
--- a/include/asm-x86_64/system.h	Sun Feb 23 22:25:26 2003
+++ b/include/asm-x86_64/system.h	Sun Feb 23 22:25:26 2003
@@ -26,7 +26,6 @@
 	unsigned long rdx;	
 	unsigned long rsi;
 	unsigned long rdi; 
-	unsigned long rax;
 	unsigned long r15;
 	unsigned long r14;
 	unsigned long r13;
@@ -45,7 +44,7 @@
    frame pointer and the scheduler is compiled with frame pointers. -AK */
 #define SAVE_CONTEXT \
 	__PUSH(r8) __PUSH(r9) __PUSH(r10) __PUSH(r11) __PUSH(r12) __PUSH(r13) \
-	__PUSH(r14) __PUSH(r15) __PUSH(rax) \
+	__PUSH(r14) __PUSH(r15) \
 	__PUSH(rdi) __PUSH(rsi) \
 	__PUSH(rdx) __PUSH(rcx) \
 	__PUSH(rbx) __PUSH(rbp) 
@@ -53,7 +52,7 @@
 	__POP(rbp) __POP(rbx) \
 	__POP(rcx) __POP(rdx) \
 	__POP(rsi) __POP(rdi) \
-	__POP(rax) __POP(r15) __POP(r14) __POP(r13) __POP(r12) __POP(r11) __POP(r10) \
+	__POP(r15) __POP(r14) __POP(r13) __POP(r12) __POP(r11) __POP(r10) \
 	__POP(r9) __POP(r8)
 
 /* RED-PEN: pipeline stall on ret because it is not predicted */
@@ -68,9 +67,10 @@
 		     "thread_return:\n\t"					    \
 		     RESTORE_CONTEXT						    \
 		     :[prevrsp] "=m" (prev->thread.rsp), 			    \
-		      [prevrip] "=m" (prev->thread.rip)			    	    \
+		      [prevrip] "=m" (prev->thread.rip),		    	    \
+		      "=a" (last)						    \
 		     :[nextrsp] "m" (next->thread.rsp), 			    \
-		      [nextrip]"m" (next->thread.rip),				    \
+		      [nextrip] "m" (next->thread.rip),				    \
 		      [next] "S" (next), [prev] "D" (prev)  			    \
 	             :"memory")
     
diff -Nru a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h
--- a/include/asm-x86_64/thread_info.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-x86_64/thread_info.h	Sun Feb 23 22:25:25 2003
@@ -11,6 +11,7 @@
 
 #include <asm/page.h>
 #include <asm/types.h>
+#include <asm/pda.h>
 
 /*
  * low level task data that entry.S needs immediate access to
@@ -58,7 +59,15 @@
 static inline struct thread_info *current_thread_info(void)
 { 
 	struct thread_info *ti;
-	asm("andq %%rsp,%0; ":"=r" (ti) : "0" (CURRENT_MASK));
+	ti = (void *)read_pda(kernelstack) + PDA_STACKOFFSET - THREAD_SIZE;
+	return ti; 
+}
+
+/* do not use in interrupt context */
+static inline struct thread_info *stack_thread_info(void)
+{
+	struct thread_info *ti;
+	__asm__("andq %%rsp,%0; ":"=r" (ti) : "0" (~8191UL));
 	return ti;
 }
 
@@ -74,8 +83,8 @@
 /* how to get the thread information struct from ASM */
 /* only works on the process stack. otherwise get it via the PDA. */
 #define GET_THREAD_INFO(reg) \
-	movq $CURRENT_MASK, reg; \
-	andq %rsp, reg
+	movq %gs:pda_kernelstack,reg ; \
+	subq $(THREAD_SIZE-PDA_STACKOFFSET),reg
 
 #endif
 
diff -Nru a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
--- a/include/asm-x86_64/unistd.h	Sun Feb 23 22:25:25 2003
+++ b/include/asm-x86_64/unistd.h	Sun Feb 23 22:25:25 2003
@@ -502,8 +502,26 @@
 __SYSCALL(__NR_semtimedop, sys_semtimedop)
 #define __NR_fadvise64		221
 __SYSCALL(__NR_fadvise64, sys_fadvise64)
+#define __NR_timer_create		222
+__SYSCALL(__NR_timer_create, sys_timer_create)
+#define __NR_timer_settime		223
+__SYSCALL(__NR_timer_settime, sys_timer_settime)
+#define __NR_timer_gettime		224
+__SYSCALL(__NR_timer_gettime, sys_timer_gettime)
+#define __NR_timer_getoverrun		225
+__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
+#define __NR_timer_delete	226
+__SYSCALL(__NR_timer_delete, sys_timer_delete)
+#define __NR_clock_settime	227
+__SYSCALL(__NR_clock_settime, sys_clock_settime)
+#define __NR_clock_gettime	228
+__SYSCALL(__NR_clock_gettime, sys_clock_gettime)
+#define __NR_clock_getres	229
+__SYSCALL(__NR_clock_getres, sys_clock_getres)
+#define __NR_clock_nanosleep	230
+__SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep)
 
-#define __NR_syscall_max __NR_fadvise64
+#define __NR_syscall_max __NR_clock_nanosleep
 #ifndef __NO_STUBS
 
 /* user-visible error numbers are in the range -1 - -4095 */
diff -Nru a/include/linux/atmdev.h b/include/linux/atmdev.h
--- a/include/linux/atmdev.h	Sun Feb 23 22:25:26 2003
+++ b/include/linux/atmdev.h	Sun Feb 23 22:25:26 2003
@@ -297,7 +297,6 @@
 	int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
 	void		*dev_data;	/* per-device data */
 	void		*proto_data;	/* per-protocol data */
-	struct timeval	timestamp;	/* AAL timestamps */
 	struct sk_buff_head recvq;	/* receive queue */
 	struct k_atm_aal_stats *stats;	/* pointer to AAL stats group */
 	wait_queue_head_t sleep;	/* if socket is busy */
diff -Nru a/include/linux/binfmts.h b/include/linux/binfmts.h
--- a/include/linux/binfmts.h	Sun Feb 23 22:25:24 2003
+++ b/include/linux/binfmts.h	Sun Feb 23 22:25:24 2003
@@ -3,6 +3,8 @@
 
 #include <linux/capability.h>
 
+struct pt_regs;
+
 /*
  * MAX_ARG_PAGES defines the number of pages allocated for arguments
  * and envelope for the new program. 32 should suffice, this gives
diff -Nru a/include/linux/blkdev.h b/include/linux/blkdev.h
--- a/include/linux/blkdev.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/blkdev.h	Sun Feb 23 22:25:22 2003
@@ -1,6 +1,7 @@
 #ifndef _LINUX_BLKDEV_H
 #define _LINUX_BLKDEV_H
 
+#include <linux/config.h>
 #include <linux/major.h>
 #include <linux/genhd.h>
 #include <linux/list.h>
@@ -301,8 +302,18 @@
 #define BLK_BOUNCE_ANY		((u64)blk_max_pfn << PAGE_SHIFT)
 #define BLK_BOUNCE_ISA		(ISA_DMA_THRESHOLD)
 
+#if CONFIG_MMU
 extern int init_emergency_isa_pool(void);
 extern void blk_queue_bounce(request_queue_t *q, struct bio **bio);
+#else
+static inline int init_emergency_isa_pool(void)
+{
+	return 0;
+}
+static inline void blk_queue_bounce(request_queue_t *q, struct bio **bio)
+{
+}
+#endif /* CONFIG_MMU */
 
 #define rq_for_each_bio(bio, rq)	\
 	if ((rq->bio))			\
diff -Nru a/include/linux/cdrom.h b/include/linux/cdrom.h
--- a/include/linux/cdrom.h	Sun Feb 23 22:25:21 2003
+++ b/include/linux/cdrom.h	Sun Feb 23 22:25:21 2003
@@ -77,7 +77,7 @@
 #define CDROM_GET_MCN		0x5311 /* Obtain the "Universal Product Code" 
                                            if available (struct cdrom_mcn) */
 #define CDROM_GET_UPC		CDROM_GET_MCN  /* This one is depricated, 
-                                          but here anyway for compatability */
+                                          but here anyway for compatibility */
 #define CDROMRESET		0x5312 /* hard-reset the drive */
 #define CDROMVOLREAD		0x5313 /* Get the drive's volume setting 
                                           (struct cdrom_volctrl) */
diff -Nru a/include/linux/compiler.h b/include/linux/compiler.h
--- a/include/linux/compiler.h	Sun Feb 23 22:25:25 2003
+++ b/include/linux/compiler.h	Sun Feb 23 22:25:25 2003
@@ -25,6 +25,23 @@
 #define __deprecated
 #endif
 
+/*
+ * Allow us to avoid 'defined but not used' warnings on functions and data,
+ * as well as force them to be emitted to the assembly file.
+ *
+ * As of gcc 3.3, static functions that are not marked with attribute((used))
+ * may be elided from the assembly file.  As of gcc 3.3, static data not so
+ * marked will not be elided, but this may change in a future gcc version.
+ *
+ * In prior versions of gcc, such functions and data would be emitted, but
+ * would be warned about except with attribute((unused)).
+ */
+#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || __GNUC__ > 3
+#define __attribute_used__	__attribute__((__used__))
+#else
+#define __attribute_used__	__attribute__((__unused__))
+#endif
+
 /* This macro obfuscates arithmetic on a variable address so that gcc
    shouldn't recognize the original var, and make assumptions about it */
 #define RELOC_HIDE(ptr, off)					\
diff -Nru a/include/linux/delay.h b/include/linux/delay.h
--- a/include/linux/delay.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/delay.h	Sun Feb 23 22:25:22 2003
@@ -34,4 +34,8 @@
 	({unsigned long msec=(n); while (msec--) udelay(1000);}))
 #endif
 
+#ifndef ndelay
+#define ndelay(x)	udelay(((x)+999)/1000)
+#endif
+
 #endif /* defined(_LINUX_DELAY_H) */
diff -Nru a/include/linux/flat.h b/include/linux/flat.h
--- a/include/linux/flat.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/flat.h	Sun Feb 23 22:25:22 2003
@@ -10,6 +10,8 @@
 #ifndef _LINUX_FLAT_H
 #define _LINUX_FLAT_H
 
+#include <asm/flat.h>
+
 #define	FLAT_VERSION			0x00000004L
 
 /*
diff -Nru a/include/linux/fs.h b/include/linux/fs.h
--- a/include/linux/fs.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/fs.h	Sun Feb 23 22:25:22 2003
@@ -1183,6 +1183,7 @@
 
 extern struct file * get_empty_filp(void);
 extern void file_move(struct file *f, struct list_head *list);
+extern void file_kill(struct file *f);
 struct bio;
 extern int submit_bio(int, struct bio *);
 extern int bdev_read_only(struct block_device *);
diff -Nru a/include/linux/genhd.h b/include/linux/genhd.h
--- a/include/linux/genhd.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/genhd.h	Sun Feb 23 22:25:22 2003
@@ -15,7 +15,7 @@
 #include <linux/device.h>
 
 enum {
-/* These three have identical behaviour; use the second one if DOS fdisk gets
+/* These three have identical behaviour; use the second one if DOS FDISK gets
    confused about extended/logical partitions starting past cylinder 1023. */
 	DOS_EXTENDED_PARTITION = 5,
 	LINUX_EXTENDED_PARTITION = 0x85,
@@ -26,20 +26,17 @@
 
 	SOLARIS_X86_PARTITION =	LINUX_SWAP_PARTITION,
 
-	DM6_PARTITION =	0x54,	/* has DDO: use xlated geom & offset */
-	EZD_PARTITION =	0x55,	/* EZ-DRIVE */
 	DM6_AUX1PARTITION = 0x51,	/* no DDO:  use xlated geom */
 	DM6_AUX3PARTITION = 0x53,	/* no DDO:  use xlated geom */
+	DM6_PARTITION =	0x54,		/* has DDO: use xlated geom & offset */
+	EZD_PARTITION =	0x55,		/* EZ-DRIVE */
 
-	FREEBSD_PARTITION = 0xa5,    /* FreeBSD Partition ID */
-	OPENBSD_PARTITION = 0xa6,    /* OpenBSD Partition ID */
-	NETBSD_PARTITION = 0xa9,   /* NetBSD Partition ID */
-	BSDI_PARTITION = 0xb7,    /* BSDI Partition ID */
-/* Ours is not to wonder why.. */
-	BSD_PARTITION =	FREEBSD_PARTITION,
-	MINIX_PARTITION = 0x81,  /* Minix Partition ID */
-	UNIXWARE_PARTITION = 0x63,		/* Partition ID, same as */
-						/* GNU_HURD and SCO Unix */
+	FREEBSD_PARTITION = 0xa5,	/* FreeBSD Partition ID */
+	OPENBSD_PARTITION = 0xa6,	/* OpenBSD Partition ID */
+	NETBSD_PARTITION = 0xa9,	/* NetBSD Partition ID */
+	BSDI_PARTITION = 0xb7,		/* BSDI Partition ID */
+	MINIX_PARTITION = 0x81,		/* Minix Partition ID */
+	UNIXWARE_PARTITION = 0x63,	/* Same as GNU_HURD and SCO Unix */
 };
 
 struct partition {
diff -Nru a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
--- a/include/linux/i2c-algo-bit.h	Sun Feb 23 22:25:26 2003
+++ b/include/linux/i2c-algo-bit.h	Sun Feb 23 22:25:26 2003
@@ -21,12 +21,10 @@
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
 
-/* $Id: i2c-algo-bit.h,v 1.7 1999/12/21 23:45:58 frodo Exp $ */
+/* $Id: i2c-algo-bit.h,v 1.10 2003/01/21 08:08:16 kmalkki Exp $ */
 
-#ifndef I2C_ALGO_BIT_H
-#define I2C_ALGO_BIT_H 1
-
-#include <linux/i2c.h>
+#ifndef _LINUX_I2C_ALGO_BIT_H
+#define _LINUX_I2C_ALGO_BIT_H
 
 /* --- Defines for bit-adapters ---------------------------------------	*/
 /*
@@ -53,4 +51,4 @@
 int i2c_bit_add_bus(struct i2c_adapter *);
 int i2c_bit_del_bus(struct i2c_adapter *);
 
-#endif /* I2C_ALGO_BIT_H */
+#endif /* _LINUX_I2C_ALGO_BIT_H */
diff -Nru a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h
--- a/include/linux/i2c-algo-pcf.h	Sun Feb 23 22:25:27 2003
+++ b/include/linux/i2c-algo-pcf.h	Sun Feb 23 22:25:27 2003
@@ -22,13 +22,10 @@
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
 
-/* $Id: i2c-algo-pcf.h,v 1.7 2000/02/27 23:02:45 frodo Exp $ */
+/* $Id: i2c-algo-pcf.h,v 1.8 2003/01/21 08:08:16 kmalkki Exp $ */
 
-#ifndef I2C_ALGO_PCF_H
-#define I2C_ALGO_PCF_H 1
-
-/* --- Defines for pcf-adapters ---------------------------------------	*/
-#include <linux/i2c.h>
+#ifndef _LINUX_I2C_ALGO_PCF_H
+#define _LINUX_I2C_ALGO_PCF_H
 
 struct i2c_algo_pcf_data {
 	void *data;		/* private data for lolevel routines	*/
@@ -49,4 +46,4 @@
 int i2c_pcf_add_bus(struct i2c_adapter *);
 int i2c_pcf_del_bus(struct i2c_adapter *);
 
-#endif /* I2C_ALGO_PCF_H */
+#endif /* _LINUX_I2C_ALGO_PCF_H */
diff -Nru a/include/linux/i2c-dev.h b/include/linux/i2c-dev.h
--- a/include/linux/i2c-dev.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/i2c-dev.h	Sun Feb 23 22:25:22 2003
@@ -19,13 +19,12 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-/* $Id: i2c-dev.h,v 1.11 2002/07/07 15:42:47 mds Exp $ */
+/* $Id: i2c-dev.h,v 1.13 2003/01/21 08:08:16 kmalkki Exp $ */
 
 #ifndef _LINUX_I2C_DEV_H
 #define _LINUX_I2C_DEV_H
 
 #include <linux/types.h>
-#include <linux/i2c.h>
 
 /* Some IOCTL commands are defined in <linux/i2c.h> */
 /* Note: 10-bit addresses are NOT supported! */
diff -Nru a/include/linux/i2c-id.h b/include/linux/i2c-id.h
--- a/include/linux/i2c-id.h	Sun Feb 23 22:25:21 2003
+++ b/include/linux/i2c-id.h	Sun Feb 23 22:25:21 2003
@@ -20,10 +20,11 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.		     */
 /* ------------------------------------------------------------------------- */
 
-/* $Id: i2c-id.h,v 1.56 2002/10/13 15:50:02 mds Exp $ */
+/* $Id: i2c-id.h,v 1.63 2003/01/21 08:08:16 kmalkki Exp $ */
+
+#ifndef LINUX_I2C_ID_H
+#define LINUX_I2C_ID_H
 
-#ifndef I2C_ID_H
-#define I2C_ID_H
 /*
  * This file is part of the i2c-bus package and contains the identifier
  * values for drivers, adapters and other folk populating these serial
@@ -95,7 +96,8 @@
 #define I2C_DRIVERID_ADV717x	48     /* ADV 7175/7176 video encoder	*/
 #define I2C_DRIVERID_ZR36067	49     /* Zoran 36067 video encoder	*/
 #define I2C_DRIVERID_ZR36120	50     /* Zoran 36120 video encoder	*/
-#define I2C_DRIVERID_24LC32A	51		/* Microchip 24LC32A 32k EEPROM	*/
+#define I2C_DRIVERID_24LC32A	51	/* Microchip 24LC32A 32k EEPROM	*/
+#define I2C_DRIVERID_STM41T00	52	/* real time clock		*/
 
 
 
@@ -147,6 +149,7 @@
 #define I2C_DRIVERID_SMARTBATT 1035
 #define I2C_DRIVERID_BMCSENSORS 1036
 #define I2C_DRIVERID_FS451 1037
+#define I2C_DRIVERID_W83627HF 1038
 
 /*
  * ---- Adapter types ----------------------------------------------------
@@ -172,6 +175,7 @@
 
 #define I2C_ALGO_MPC8XX 0x110000	/* MPC8xx PowerPC I2C algorithm */
 #define I2C_ALGO_OCP    0x120000	/* IBM or otherwise On-chip I2C algorithm */
+#define I2C_ALGO_BITHS	0x130000	/* enhanced bit style adapters	*/
 
 #define I2C_ALGO_EXP	0x800000	/* experimental			*/
 
@@ -250,4 +254,4 @@
 /* --- IPMB adapter						*/
 #define I2C_HW_IPMB 0x00
 
-#endif /* I2C_ID_H */
+#endif /* LINUX_I2C_ID_H */
diff -Nru a/include/linux/i2c-proc.h b/include/linux/i2c-proc.h
--- a/include/linux/i2c-proc.h	Sun Feb 23 22:25:24 2003
+++ b/include/linux/i2c-proc.h	Sun Feb 23 22:25:24 2003
@@ -19,14 +19,9 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#ifndef SENSORS_SENSORS_H
-#define SENSORS_SENSORS_H
+#ifndef _LINUX_I2C_PROC_H
+#define _LINUX_I2C_PROC_H
 
-#ifdef __KERNEL__
-
-/* Next two must be included before sysctl.h can be included, in 2.0 kernels */
-#include <linux/types.h>
-#include <linux/fs.h>
 #include <linux/sysctl.h>
 
 /* The type of callback functions used in sensors_{proc,sysctl}_real */
@@ -388,7 +383,7 @@
 
 /* This macro is used to scale user-input to sensible values in almost all
    chip drivers. */
-extern inline int SENSORS_LIMIT(long value, long low, long high)
+static inline int SENSORS_LIMIT(long value, long low, long high)
 {
 	if (value < low)
 		return low;
@@ -398,8 +393,6 @@
 		return value;
 }
 
-#endif				/* def __KERNEL__ */
-
 
 /* The maximum length of the prefix */
 #define SENSORS_PREFIX_MAX 20
@@ -418,5 +411,5 @@
 	char name[SENSORS_PREFIX_MAX + 13];
 };
 
-#endif				/* def SENSORS_SENSORS_H */
+#endif				/* def _LINUX_I2C_PROC_H */
 
diff -Nru a/include/linux/i2c.h b/include/linux/i2c.h
--- a/include/linux/i2c.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/i2c.h	Sun Feb 23 22:25:22 2003
@@ -23,19 +23,18 @@
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
    Frodo Looijaard <frodol@dds.nl> */
 
-/* $Id: i2c.h,v 1.59 2002/07/19 20:53:45 phil Exp $ */
+/* $Id: i2c.h,v 1.68 2003/01/21 08:08:16 kmalkki Exp $ */
 
 #ifndef _LINUX_I2C_H
 #define _LINUX_I2C_H
 
-#define I2C_DATE "20020719"
-#define I2C_VERSION "2.6.4"
+#define I2C_DATE "20021208"
+#define I2C_VERSION "2.7.0"
 
-#include <linux/i2c-id.h>	/* id values of adapters et. al. 	*/
+#include <linux/module.h>
 #include <linux/types.h>
-#include <linux/config.h>
+#include <linux/i2c-id.h>
 #include <asm/semaphore.h>
-
 
 /* --- General options ------------------------------------------------	*/
 
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	Sun Feb 23 22:25:23 2003
+++ b/include/linux/ide.h	Sun Feb 23 22:25:23 2003
@@ -71,6 +71,13 @@
 #endif
 
 /*
+ * Used to indicate "no IRQ", should be a value that cannot be an IRQ
+ * number.
+ */
+ 
+#define IDE_NO_IRQ		(-1)
+
+/*
  * IDE_DRIVE_CMD is used to implement many features of the hdparm utility
  */
 #define IDE_DRIVE_CMD			99	/* (magic) undef to reduce kernel size*/
@@ -106,6 +113,7 @@
 /*
  * state flags
  */
+
 #define DMA_PIO_RETRY	1	/* retrying in PIO */
 
 /*
@@ -297,36 +305,18 @@
 		ide_pmac,	ide_etrax100,	ide_acorn
 } hwif_chipset_t;
 
-typedef struct ide_io_ops_s {
-	/* insert io operations here! */
-	void (*OUTB)(u8 value, ide_ioreg_t port);
-	void (*OUTW)(u16 value, ide_ioreg_t port);
-	void (*OUTL)(u32 value, ide_ioreg_t port);
-	void (*OUTSW)(ide_ioreg_t port, void *addr, u32 count);
-	void (*OUTSL)(ide_ioreg_t port, void *addr, u32 count);
-
-	u8  (*INB)(ide_ioreg_t port);
-	u16 (*INW)(ide_ioreg_t port);
-	u32 (*INL)(ide_ioreg_t port);
-	void (*INSW)(ide_ioreg_t port, void *addr, u32 count);
-	void (*INSL)(ide_ioreg_t port, void *addr, u32 count);
-} ide_io_ops_t;
-
 /*
  * Structure to hold all information about the location of this port
  */
 typedef struct hw_regs_s {
-	ide_ioreg_t	io_ports[IDE_NR_PORTS];	/* task file registers */
+	unsigned long	io_ports[IDE_NR_PORTS];	/* task file registers */
 	int		irq;			/* our irq number */
 	int		dma;			/* our dma entry */
 	ide_ack_intr_t	*ack_intr;		/* acknowledge interrupt */
 	void		*priv;			/* interface specific data */
 	hwif_chipset_t  chipset;
-#if 0
-	ide_io_ops_t	*iops;			/* */
-#endif
-	sata_ioreg_t	sata_scr[SATA_NR_PORTS];
-	sata_ioreg_t	sata_misc[SATA_NR_PORTS];
+	unsigned long	sata_scr[SATA_NR_PORTS];
+	unsigned long	sata_misc[SATA_NR_PORTS];
 } hw_regs_t;
 
 /*
@@ -338,10 +328,10 @@
  * Set up hw_regs_t structure before calling ide_register_hw (optional)
  */
 void ide_setup_ports(	hw_regs_t *hw,
-			ide_ioreg_t base,
+			unsigned long base,
 			int *offsets,
-			ide_ioreg_t ctrl,
-			ide_ioreg_t intr,
+			unsigned long ctrl,
+			unsigned long intr,
 			ide_ack_intr_t *ack_intr,
 #if 0
 			ide_io_ops_t *iops,
@@ -770,6 +760,7 @@
         u8	quirk_list;	/* considered quirky, set for a specific host */
         u8	suspend_reset;	/* drive suspend mode flag, soft-reset recovers */
         u8	init_speed;	/* transfer rate set at boot */
+        u8	pio_speed;      /* unused by core, used by some drivers for fallback from DMA */
         u8	current_speed;	/* current transfer rate set */
         u8	dn;		/* now wide spread use */
         u8	wcache;		/* status of write cache */
@@ -894,9 +885,9 @@
 	char name[6];			/* name of interface, eg. "ide0" */
 
 		/* task file registers for pata and sata */
-	ide_ioreg_t	io_ports[IDE_NR_PORTS];
-	sata_ioreg_t	sata_scr[SATA_NR_PORTS];
-	sata_ioreg_t	sata_misc[SATA_NR_PORTS];
+	unsigned long	io_ports[IDE_NR_PORTS];
+	unsigned long	sata_scr[SATA_NR_PORTS];
+	unsigned long	sata_misc[SATA_NR_PORTS];
 
 	hw_regs_t	hw;		/* Hardware info */
 	ide_drive_t	drives[MAX_DRIVES];	/* drive info */
@@ -960,9 +951,6 @@
 	void (*atapi_output_bytes)(ide_drive_t *, void *, u32);
 #endif
 
-#if 0
-	ide_dma_ops_t	*dmaops;
-#else
 	int (*ide_dma_read)(ide_drive_t *drive);
 	int (*ide_dma_write)(ide_drive_t *drive);
 	int (*ide_dma_begin)(ide_drive_t *drive);
@@ -988,23 +976,19 @@
 	ide_startstop_t (*ide_dma_queued_read)(ide_drive_t *drive);
 	ide_startstop_t (*ide_dma_queued_write)(ide_drive_t *drive);
 	ide_startstop_t (*ide_dma_queued_start)(ide_drive_t *drive);
-#endif
 
-#if 0
-	ide_io_ops_t	*iops;
-#else
-	void (*OUTB)(u8 addr, ide_ioreg_t port);
-	void (*OUTW)(u16 addr, ide_ioreg_t port);
-	void (*OUTL)(u32 addr, ide_ioreg_t port);
-	void (*OUTSW)(ide_ioreg_t port, void *addr, u32 count);
-	void (*OUTSL)(ide_ioreg_t port, void *addr, u32 count);
-
-	u8  (*INB)(ide_ioreg_t port);
-	u16 (*INW)(ide_ioreg_t port);
-	u32 (*INL)(ide_ioreg_t port);
-	void (*INSW)(ide_ioreg_t port, void *addr, u32 count);
-	void (*INSL)(ide_ioreg_t port, void *addr, u32 count);
-#endif
+	void (*OUTB)(u8 addr, unsigned long port);
+	void (*OUTBSYNC)(u8 addr, unsigned long port);
+	void (*OUTW)(u16 addr, unsigned long port);
+	void (*OUTL)(u32 addr, unsigned long port);
+	void (*OUTSW)(unsigned long port, void *addr, u32 count);
+	void (*OUTSL)(unsigned long port, void *addr, u32 count);
+
+	u8  (*INB)(unsigned long port);
+	u16 (*INW)(unsigned long port);
+	u32 (*INL)(unsigned long port);
+	void (*INSW)(unsigned long port, void *addr, u32 count);
+	void (*INSL)(unsigned long port, void *addr, u32 count);
 
 	/* dma physical region descriptor table (cpu view) */
 	unsigned int	*dmatable_cpu;
@@ -1131,12 +1115,13 @@
 	struct ide_settings_s	*next;
 } ide_settings_t;
 
-void ide_add_setting(ide_drive_t *drive, const char *name, int rw, int read_ioctl, int write_ioctl, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set);
-void ide_remove_setting(ide_drive_t *drive, char *name);
-ide_settings_t *ide_find_setting_by_name(ide_drive_t *drive, char *name);
-int ide_read_setting(ide_drive_t *t, ide_settings_t *setting);
-int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int val);
-void ide_add_generic_settings(ide_drive_t *drive);
+extern struct semaphore ide_setting_sem;
+extern int ide_add_setting(ide_drive_t *drive, const char *name, int rw, int read_ioctl, int write_ioctl, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set);
+extern void ide_remove_setting(ide_drive_t *drive, char *name);
+extern ide_settings_t *ide_find_setting_by_name(ide_drive_t *drive, char *name);
+extern int ide_read_setting(ide_drive_t *t, ide_settings_t *setting);
+extern int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int val);
+extern void ide_add_generic_settings(ide_drive_t *drive);
 
 /*
  * /proc/ide interface
@@ -1270,12 +1255,19 @@
 extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs);
 
 /*
- * This is used on exit from the driver, to designate the next irq handler
+ * This is used on exit from the driver to designate the next irq handler
  * and also to start the safety timer.
  */
 extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry);
 
 /*
+ * This is used on exit from the driver to designate the next irq handler
+ * and start the safety time safely and atomically from the IRQ handler
+ * with respect to the command issue (which it also does)
+ */
+extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *);
+
+/*
  * Error reporting, in human readable form (luxurious, but a memory hog).
  *
  * (drive, msg, status)
@@ -1577,14 +1569,6 @@
  */
 extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
 
-/*
- * CompactFlash cards and their brethern pretend to be removable hard disks,
- * but they never have a slave unit, and they don't have doorlock mechanisms.
- * This test catches them, and is invoked elsewhere when setting appropriate
- * config bits.
- */
-extern int drive_is_flashcard (ide_drive_t *drive);
-
 extern int ide_spin_wait_hwgroup(ide_drive_t *);
 extern void ide_timer_expiry(unsigned long);
 extern void ide_intr(int irq, void *dev_id, struct pt_regs *regs);
@@ -1721,6 +1705,7 @@
 #endif
 
 extern void hwif_unregister(ide_hwif_t *);
+extern void ide_unregister (unsigned int index);
 
 extern void export_ide_init_queue(ide_drive_t *);
 extern u8 export_probe_for_drive(ide_drive_t *);
diff -Nru a/include/linux/idr.h b/include/linux/idr.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/linux/idr.h	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,63 @@
+/*
+ * include/linux/id.h
+ * 
+ * 2002-10-18  written by Jim Houston jim.houston@ccur.com
+ *	Copyright (C) 2002 by Concurrent Computer Corporation
+ *	Distributed under the GNU GPL license version 2.
+ *
+ * Small id to pointer translation service avoiding fixed sized
+ * tables.
+ */
+#include <linux/types.h>
+#include <asm/bitops.h>
+
+#define RESERVED_ID_BITS 8
+
+#if     BITS_PER_LONG == 32
+#define IDR_BITS 5
+#define IDR_FULL 0xffffffff
+#elif BITS_PER_LONG == 64
+#define IDR_BITS 6
+#define IDR_FULL 0xffffffffffffffff
+#else
+#error "BITS_PER_LONG is not 32 or 64"
+#endif
+
+#define IDR_MASK ((1 << IDR_BITS)-1)
+
+/* Leave the possibility of an incomplete final layer */
+#define MAX_LEVEL (BITS_PER_LONG - RESERVED_ID_BITS + IDR_BITS - 1) / IDR_BITS
+#define MAX_ID_SHIFT (BITS_PER_LONG - RESERVED_ID_BITS)
+#define MAX_ID_BIT (1L << MAX_ID_SHIFT)
+#define MAX_ID_MASK (MAX_ID_BIT - 1)
+
+/* Number of id_layer structs to leave in free list */
+#define IDR_FREE_MAX MAX_LEVEL + MAX_LEVEL
+
+struct idr_layer {
+	unsigned long	        bitmap;     // A zero bit means "space here"
+	int                     count;      // When zero, we can release it
+	struct idr_layer       *ary[1<<IDR_BITS];
+};
+
+struct idr {
+	struct idr_layer *top;
+	int		  layers;
+	long		  count;
+	struct idr_layer *id_free;
+	int               id_free_cnt;
+	spinlock_t        lock;
+};
+
+/*
+ * This is what we export.
+ */
+
+void *idr_find(struct idr *idp, int id);
+int idr_pre_get(struct idr *idp);
+int idr_get_new(struct idr *idp, void *ptr);
+void idr_remove(struct idr *idp, int id);
+void idr_init(struct idr *idp);
+
+extern kmem_cache_t *idr_layer_cache;
+
diff -Nru a/include/linux/in6.h b/include/linux/in6.h
--- a/include/linux/in6.h	Sun Feb 23 22:25:25 2003
+++ b/include/linux/in6.h	Sun Feb 23 22:25:25 2003
@@ -40,6 +40,15 @@
 #define s6_addr32		in6_u.u6_addr32
 };
 
+/* IPv6 Wildcard Address (::) and Loopback Address (::1) defined in RFC2553
+ * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
+ * in network byte order, not in host byte order as are the IPv4 equivalents
+ */
+extern const struct in6_addr in6addr_any;
+#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
+extern const struct in6_addr in6addr_loopback;
+#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
+
 struct sockaddr_in6 {
 	unsigned short int	sin6_family;    /* AF_INET6 */
 	__u16			sin6_port;      /* Transport layer port # */
diff -Nru a/include/linux/init.h b/include/linux/init.h
--- a/include/linux/init.h	Sun Feb 23 22:25:21 2003
+++ b/include/linux/init.h	Sun Feb 23 22:25:21 2003
@@ -71,7 +71,7 @@
 /* initcalls are now grouped by functionality into separate 
  * subsections. Ordering inside the subsections is determined
  * by link order. 
- * For backwards compatability, initcall() puts the call in 
+ * For backwards compatibility, initcall() puts the call in 
  * the device init subsection.
  */
 
diff -Nru a/include/linux/init_task.h b/include/linux/init_task.h
--- a/include/linux/init_task.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/init_task.h	Sun Feb 23 22:25:22 2003
@@ -62,6 +62,7 @@
 {									\
 	.state		= 0,						\
 	.thread_info	= &init_thread_info,				\
+	.usage		= ATOMIC_INIT(2),				\
 	.flags		= 0,						\
 	.lock_depth	= -1,						\
 	.prio		= MAX_PRIO-20,					\
@@ -98,6 +99,7 @@
 	.sighand	= &init_sighand,				\
 	.pending	= { NULL, &tsk.pending.head, {{0}}},		\
 	.blocked	= {{0}},					\
+	 .posix_timers	 = LIST_HEAD_INIT(tsk.posix_timers),		   \
 	.alloc_lock	= SPIN_LOCK_UNLOCKED,				\
 	.switch_lock	= SPIN_LOCK_UNLOCKED,				\
 	.journal_info	= NULL,						\
diff -Nru a/include/linux/ioport.h b/include/linux/ioport.h
--- a/include/linux/ioport.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/ioport.h	Sun Feb 23 22:25:22 2003
@@ -77,6 +77,7 @@
 #define IORESOURCE_MEM_8BIT		(0<<3)
 #define IORESOURCE_MEM_16BIT		(1<<3)
 #define IORESOURCE_MEM_8AND16BIT	(2<<3)
+#define IORESOURCE_MEM_32BIT		(3<<3)
 #define IORESOURCE_MEM_SHADOWABLE	(1<<5)	/* dup: IORESOURCE_SHADOWABLE */
 #define IORESOURCE_MEM_EXPANSIONROM	(1<<6)
 
diff -Nru a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
--- a/include/linux/ipmi_smi.h	Sun Feb 23 22:25:25 2003
+++ b/include/linux/ipmi_smi.h	Sun Feb 23 22:25:25 2003
@@ -78,6 +78,8 @@
 
 struct ipmi_smi_handlers
 {
+	struct module *owner;
+
 	/* Called to enqueue an SMI message to be sent.  This
 	   operation is not allowed to fail.  If an error occurs, it
 	   should report back the error in a received message.  It may
@@ -92,15 +94,6 @@
 	/* Called by the upper layer to request that we try to get
 	   events from the BMC we are attached to. */
 	void (*request_events)(void *send_info);
-
-	/* Called when someone is using the interface, so the module can
-	   adjust it's use count.  Return zero if successful, or an
-	   errno if not. */
-	int (*new_user)(void *send_info);
-
-	/* Called when someone is no longer using the interface, so the
-	   module can adjust it's use count. */
-	void (*user_left)(void *send_info);
 
 	/* Called when the interface should go into "run to
 	   completion" mode.  If this call sets the value to true, the
diff -Nru a/include/linux/meye.h b/include/linux/meye.h
--- a/include/linux/meye.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/meye.h	Sun Feb 23 22:25:22 2003
@@ -1,7 +1,7 @@
 /* 
  * Motion Eye video4linux driver for Sony Vaio PictureBook
  *
- * Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
+ * Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
  *
  * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
  *
diff -Nru a/include/linux/module.h b/include/linux/module.h
--- a/include/linux/module.h	Sun Feb 23 22:25:25 2003
+++ b/include/linux/module.h	Sun Feb 23 22:25:25 2003
@@ -469,7 +469,6 @@
 	try_module_get(module);
 #endif
 }
-#define EXPORT_NO_SYMBOLS
 #define __MODULE_STRING(x) __stringify(x)
 
 /*
diff -Nru a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
--- a/include/linux/nfsd/nfsfh.h	Sun Feb 23 22:25:25 2003
+++ b/include/linux/nfsd/nfsfh.h	Sun Feb 23 22:25:25 2003
@@ -165,8 +165,8 @@
 
 	/* Pre-op attributes saved during fh_lock */
 	__u64			fh_pre_size;	/* size before operation */
-	time_t			fh_pre_mtime;	/* mtime before oper */
-	time_t			fh_pre_ctime;	/* ctime before oper */
+	struct timespec		fh_pre_mtime;	/* mtime before oper */
+	struct timespec		fh_pre_ctime;	/* ctime before oper */
 
 	/* Post-op attributes saved in fh_unlock */
 	umode_t			fh_post_mode;	/* i_mode */
@@ -177,9 +177,9 @@
 	unsigned long		fh_post_blocks; /* i_blocks */
 	unsigned long		fh_post_blksize;/* i_blksize */
 	__u32			fh_post_rdev[2];/* i_rdev */
-	time_t			fh_post_atime;	/* i_atime */
-	time_t			fh_post_mtime;	/* i_mtime */
-	time_t			fh_post_ctime;	/* i_ctime */
+	struct timespec		fh_post_atime;	/* i_atime */
+	struct timespec		fh_post_mtime;	/* i_mtime */
+	struct timespec		fh_post_ctime;	/* i_ctime */
 #endif /* CONFIG_NFSD_V3 */
 
 } svc_fh;
@@ -263,8 +263,8 @@
 
 	inode = fhp->fh_dentry->d_inode;
 	if (!fhp->fh_pre_saved) {
-		fhp->fh_pre_mtime = inode->i_mtime.tv_sec;
-		fhp->fh_pre_ctime = inode->i_ctime.tv_sec;
+		fhp->fh_pre_mtime = inode->i_mtime;
+		fhp->fh_pre_ctime = inode->i_ctime;
 			fhp->fh_pre_size  = inode->i_size;
 			fhp->fh_pre_saved = 1;
 	}
@@ -296,9 +296,9 @@
 	}
 	fhp->fh_post_rdev[0]    = htonl((u32)major(inode->i_rdev));
 	fhp->fh_post_rdev[1]    = htonl((u32)minor(inode->i_rdev));
-	fhp->fh_post_atime      = inode->i_atime.tv_sec;
-	fhp->fh_post_mtime      = inode->i_mtime.tv_sec;
-	fhp->fh_post_ctime      = inode->i_ctime.tv_sec;
+	fhp->fh_post_atime      = inode->i_atime;
+	fhp->fh_post_mtime      = inode->i_mtime;
+	fhp->fh_post_ctime      = inode->i_ctime;
 	fhp->fh_post_saved      = 1;
 }
 #else
diff -Nru a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
--- a/include/linux/nfsd/xdr4.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/nfsd/xdr4.h	Sun Feb 23 22:25:22 2003
@@ -331,9 +331,9 @@
 	BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved);
 	cinfo->atomic = 1;
 	cinfo->before_size = fhp->fh_pre_size;
-	cinfo->before_ctime = fhp->fh_pre_ctime;
+	cinfo->before_ctime = fhp->fh_pre_ctime.tv_sec;
 	cinfo->after_size = fhp->fh_post_size;
-	cinfo->after_ctime = fhp->fh_post_ctime;
+	cinfo->after_ctime = fhp->fh_post_ctime.tv_sec;
 }
 
 int nfs4svc_encode_voidres(struct svc_rqst *, u32 *, void *);
diff -Nru a/include/linux/pci_ids.h b/include/linux/pci_ids.h
--- a/include/linux/pci_ids.h	Sun Feb 23 22:25:23 2003
+++ b/include/linux/pci_ids.h	Sun Feb 23 22:25:23 2003
@@ -848,6 +848,7 @@
 
 #define PCI_VENDOR_ID_SGI		0x10a9
 #define PCI_DEVICE_ID_SGI_IOC3		0x0003
+#define PCI_VENDOR_ID_SGI_LITHIUM	0x1002
 
 #define PCI_VENDOR_ID_ACC		0x10aa
 #define PCI_DEVICE_ID_ACC_2056		0x0000
diff -Nru a/include/linux/pnp.h b/include/linux/pnp.h
--- a/include/linux/pnp.h	Sun Feb 23 22:25:27 2003
+++ b/include/linux/pnp.h	Sun Feb 23 22:25:27 2003
@@ -13,42 +13,144 @@
 #include <linux/list.h>
 #include <linux/errno.h>
 
+#define PNP_MAX_PORT		8
+#define PNP_MAX_MEM		4
+#define PNP_MAX_IRQ		2
+#define PNP_MAX_DMA		2
+#define PNP_MAX_DEVICES		8
+#define PNP_ID_LEN		8
+
+struct pnp_protocol;
+struct pnp_dev;
+
 
 /*
- * Device Managemnt
+ * Resource Management
  */
 
-#define DEVICE_COUNT_IRQ	2
-#define DEVICE_COUNT_DMA	2
-#define DEVICE_COUNT_IO		8
-#define DEVICE_COUNT_MEM	4
-#define MAX_DEVICES		8
+/* Use these instead of directly reading pnp_dev to get resource information */
+#define pnp_port_start(dev,bar)   ((dev)->res.port_resource[(bar)].start)
+#define pnp_port_end(dev,bar)     ((dev)->res.port_resource[(bar)].end)
+#define pnp_port_flags(dev,bar)   ((dev)->res.port_resource[(bar)].flags)
+#define pnp_port_valid(dev,bar)   (pnp_port_flags((dev),(bar)) & IORESOURCE_IO)
+#define pnp_port_len(dev,bar) \
+	((pnp_port_start((dev),(bar)) == 0 &&	\
+	  pnp_port_end((dev),(bar)) ==		\
+	  pnp_port_start((dev),(bar))) ? 0 :	\
+	  					\
+	 (pnp_port_end((dev),(bar)) -		\
+	  pnp_port_start((dev),(bar)) + 1))
 
-struct pnp_resource;
-struct pnp_protocol;
-struct pnp_id;
-struct pnp_cfg;
+#define pnp_mem_start(dev,bar)   ((dev)->res.mem_resource[(bar)].start)
+#define pnp_mem_end(dev,bar)     ((dev)->res.mem_resource[(bar)].end)
+#define pnp_mem_flags(dev,bar)   ((dev)->res.mem_resource[(bar)].flags)
+#define pnp_mem_valid(dev,bar)   (pnp_mem_flags((dev),(bar)) & IORESOURCE_MEM)
+#define pnp_mem_len(dev,bar) \
+	((pnp_mem_start((dev),(bar)) == 0 &&	\
+	  pnp_mem_end((dev),(bar)) ==		\
+	  pnp_mem_start((dev),(bar))) ? 0 :	\
+	  					\
+	 (pnp_mem_end((dev),(bar)) -		\
+	  pnp_mem_start((dev),(bar)) + 1))
+
+#define pnp_irq(dev,bar)	 ((dev)->res.irq_resource[(bar)].start)
+#define pnp_irq_flags(dev,bar)	 ((dev)->res.irq_resource[(bar)].flags)
+#define pnp_irq_valid(dev,bar)   (pnp_irq_flags((dev),(bar)) & IORESOURCE_IRQ)
+
+#define pnp_dma(dev,bar)	 ((dev)->res.dma_resource[(bar)].start)
+#define pnp_dma_flags(dev,bar)	 ((dev)->res.dma_resource[(bar)].flags)
+#define pnp_dma_valid(dev,bar)   (pnp_dma_flags((dev),(bar)) & IORESOURCE_DMA)
+
+#define PNP_PORT_FLAG_16BITADDR	(1<<0)
+#define PNP_PORT_FLAG_FIXED	(1<<1)
+
+struct pnp_port {
+	unsigned short min;		/* min base number */
+	unsigned short max;		/* max base number */
+	unsigned char align;		/* align boundary */
+	unsigned char size;		/* size of range */
+	unsigned char flags;		/* port flags */
+	unsigned char pad;		/* pad */
+	struct pnp_port *next;		/* next port */
+};
+
+struct pnp_irq {
+	unsigned short map;		/* bitmaks for IRQ lines */
+	unsigned char flags;		/* IRQ flags */
+	unsigned char pad;		/* pad */
+	struct pnp_irq *next;		/* next IRQ */
+};
+
+struct pnp_dma {
+	unsigned char map;		/* bitmask for DMA channels */
+	unsigned char flags;		/* DMA flags */
+	struct pnp_dma *next;		/* next port */
+};
+
+struct pnp_mem {
+	unsigned int min;		/* min base number */
+	unsigned int max;		/* max base number */
+	unsigned int align;		/* align boundary */
+	unsigned int size;		/* size of range */
+	unsigned char flags;		/* memory flags */
+	unsigned char pad;		/* pad */
+	struct pnp_mem *next;		/* next memory resource */
+};
+
+#define PNP_RES_PRIORITY_PREFERRED	0
+#define PNP_RES_PRIORITY_ACCEPTABLE	1
+#define PNP_RES_PRIORITY_FUNCTIONAL	2
+#define PNP_RES_PRIORITY_INVALID	65535
+
+struct pnp_resources {
+	unsigned short priority;	/* priority */
+	struct pnp_port *port;		/* first port */
+	struct pnp_irq *irq;		/* first IRQ */
+	struct pnp_dma *dma;		/* first DMA */
+	struct pnp_mem *mem;		/* first memory resource */
+	struct pnp_dev *dev;		/* parent */
+	struct pnp_resources *dep;	/* dependent resources */
+};
+
+struct pnp_rule_table {
+	int depnum;
+	struct pnp_port *port[PNP_MAX_PORT];
+	struct pnp_irq *irq[PNP_MAX_IRQ];
+	struct pnp_dma *dma[PNP_MAX_DMA];
+	struct pnp_mem *mem[PNP_MAX_MEM];
+};
+
+struct pnp_resource_table {
+	struct resource port_resource[PNP_MAX_PORT];
+	struct resource mem_resource[PNP_MAX_MEM];
+	struct resource dma_resource[PNP_MAX_DMA];
+	struct resource irq_resource[PNP_MAX_IRQ];
+};
+
+
+/*
+ * Device Managemnt
+ */
 
 struct pnp_card {
-	char name[80];
-	int status;			/* status of the card */
-	unsigned char number;		/* card number */
+	struct device dev;		/* Driver Model device interface */
+	unsigned char number;		/* used as an index, must be unique */
 	struct list_head global_list;	/* node in global list of cards */
 	struct list_head protocol_list;	/* node in protocol's list of cards */
 	struct list_head devices;	/* devices attached to the card */
+	struct list_head rdevs;		/* a list of devices requested by the card driver */
+	int status;
+
 	struct pnp_protocol * protocol;
+	struct pnpc_driver * driver;
 	struct pnp_id * id;		/* contains supported EISA IDs*/
 
+	void	      * protocol_data;	/* Used to store protocol specific data */
 	unsigned char	pnpver;		/* Plug & Play version */
 	unsigned char	productver;	/* product version */
 	unsigned int	serial;		/* serial number */
 	unsigned char	checksum;	/* if zero - checksum passed */
-	void	      * protocol_data;	/* Used to store protocol specific data */
-
-	struct pnpc_driver * driver;	/* pointer to the driver bound to this device */
-	struct list_head rdevs;		/* a list of devices requested by the card driver */
 	struct proc_dir_entry *procdir;	/* directory entry in /proc/bus/isapnp */
-	struct	device	dev;		/* Driver Model device interface */
 };
 
 #define global_to_pnp_card(n) list_entry(n, struct pnp_card, global_list)
@@ -58,10 +160,6 @@
 	for((card) = global_to_pnp_card(pnp_cards.next); \
 	(card) != global_to_pnp_card(&pnp_cards); \
 	(card) = global_to_pnp_card((card)->global_list.next))
-#define pnp_card_for_each_dev(card,dev) \
-	for((dev) = card_to_pnp_dev((card)->devices.next); \
-	(dev) != card_to_pnp_dev(&(card)->devices); \
-	(dev) = card_to_pnp_dev((dev)->card_list.next))
 
 static inline void *pnpc_get_drvdata (struct pnp_card *pcard)
 {
@@ -84,8 +182,9 @@
 }
 
 struct pnp_dev {
-	char name[80];			/* device name */
-	int active;			/* status of the device */
+	struct device dev;		/* Driver Model device interface */
+	unsigned char number;		/* used as an index, must be unique */
+	int active;
 	int capabilities;
 	int status;
 
@@ -93,24 +192,20 @@
 	struct list_head protocol_list;	/* node in list of device's protocol */
 	struct list_head card_list;	/* node in card's list of devices */
 	struct list_head rdev_list;	/* node in cards list of requested devices */
+
 	struct pnp_protocol * protocol;
-	struct pnp_card * card;
-	struct pnp_id * id;		/* contains supported EISA IDs*/
+	struct pnp_card * card;		/* card the device is attached to, none if NULL */
+	struct pnp_driver * driver;
+
+	struct pnp_id		      * id;		/* supported EISA IDs*/
+	struct pnp_resource_table	res;		/* contains the currently chosen resources */
+	struct pnp_resources	      * possible;	/* a list of possible resources */
+	struct pnp_rule_table	      * rule;		/* the current possible resource set */
+	int 				config_mode;	/* flags that determine how the device's resources should be configured */
 
 	void * protocol_data;		/* Used to store protocol specific data */
-	unsigned char number;		/* must be unique */
 	unsigned short	regs;		/* ISAPnP: supported registers */
-	
-	struct pnp_resources *res;	/* possible resource information */
-	int lock_resources;		/* resources are locked */
-	struct resource io_resource[DEVICE_COUNT_IO];   /* port regions */
-	struct resource mem_resource[DEVICE_COUNT_MEM]; /* memory regions + expansion ROMs */
-	struct resource dma_resource[DEVICE_COUNT_DMA];
-	struct resource irq_resource[DEVICE_COUNT_IRQ];
-
-	struct pnp_driver * driver;	/* pointer to the driver bound to this device */
-	struct	device	    dev;	/* Driver Model device interface */
-	int		    flags;	/* used by protocols */
+	int 		flags;		/* used by protocols */
 	struct proc_dir_entry *procent;	/* device entry in /proc/bus/isapnp */
 };
 
@@ -119,13 +214,14 @@
 #define protocol_to_pnp_dev(n) list_entry(n, struct pnp_dev, protocol_list)
 #define	to_pnp_dev(n) container_of(n, struct pnp_dev, dev)
 #define pnp_for_each_dev(dev) \
-	for(dev = global_to_pnp_dev(pnp_global.next); \
-	dev != global_to_pnp_dev(&pnp_global); \
-	dev = global_to_pnp_dev(dev->global_list.next))
+	for((dev) = global_to_pnp_dev(pnp_global.next); \
+	(dev) != global_to_pnp_dev(&pnp_global); \
+	(dev) = global_to_pnp_dev((dev)->global_list.next))
 #define card_for_each_dev(card,dev) \
 	for((dev) = card_to_pnp_dev((card)->devices.next); \
 	(dev) != card_to_pnp_dev(&(card)->devices); \
 	(dev) = card_to_pnp_dev((dev)->card_list.next))
+#define pnp_dev_name(dev) (dev)->dev.name
 
 static inline void *pnp_get_drvdata (struct pnp_dev *pdev)
 {
@@ -152,6 +248,12 @@
 	void (*quirk_function)(struct pnp_dev *dev);	/* fixup function */
 };
 
+/* config modes */
+#define PNP_CONFIG_AUTO		0x0001	/* Use the Resource Configuration Engine to determine resource settings */
+#define PNP_CONFIG_MANUAL	0x0002	/* the config has been manually specified */
+#define PNP_CONFIG_FORCE	0x0004	/* disables validity checking */
+#define PNP_CONFIG_INVALID	0x0008	/* If this flag is set, the pnp layer will refuse to activate the device */
+
 /* capabilities */
 #define PNP_READ		0x0001
 #define PNP_WRITE		0x0002
@@ -165,14 +267,14 @@
 				 ((dev)->capabilities & PNP_WRITE))
 #define pnp_can_disable(dev)	(((dev)->protocol) && ((dev)->protocol->disable) && \
 				 ((dev)->capabilities & PNP_DISABLE))
-#define pnp_can_configure(dev)	((!(dev)->active) && ((dev)->capabilities & PNP_CONFIGURABLE))
+#define pnp_can_configure(dev)	((!(dev)->active) && ((dev)->config_mode & PNP_CONFIG_AUTO) && \
+				 ((dev)->capabilities & PNP_CONFIGURABLE))
 
 /* status */
-#define PNP_INIT		0x0000
-#define PNP_READY		0x0001
-#define PNP_ATTACHED		0x0002
-#define PNP_BUSY		0x0004
-#define PNP_FAULTY		0x0008
+#define PNP_READY		0x0000
+#define PNP_ATTACHED		0x0001
+#define PNP_BUSY		0x0002
+#define PNP_FAULTY		0x0004
 
 
 /*
@@ -180,21 +282,21 @@
  */
 
 struct pnp_id {
-	char id[7];
+	char id[PNP_ID_LEN];
 	struct pnp_id * next;
 };
 
 struct pnp_device_id {
-	char id[7];
+	char id[PNP_ID_LEN];
 	unsigned long driver_data;	/* data private to the driver */
 };
 
-struct pnp_card_device_id {
-	char id[7];
+struct pnp_card_id {
+	char id[PNP_ID_LEN];
 	unsigned long driver_data;	/* data private to the driver */
 	struct {
-		char id[7];
-	} devs[MAX_DEVICES];		/* logical devices */
+		char id[PNP_ID_LEN];
+	} devs[PNP_MAX_DEVICES];	/* logical devices */
 };
 
 #define PNP_DRIVER_DO_NOT_ACTIVATE	(1<<0)
@@ -216,9 +318,9 @@
 struct pnpc_driver {
 	struct list_head node;
 	char *name;
-	const struct pnp_card_device_id *id_table;
+	const struct pnp_card_id *id_table;
 	unsigned int flags;
-	int  (*probe)  (struct pnp_card *card, const struct pnp_card_device_id *card_id);
+	int  (*probe)  (struct pnp_card *card, const struct pnp_card_id *card_id);
 	void (*remove) (struct pnp_card *card);
 	struct device_driver driver;
 };
@@ -227,135 +329,16 @@
 
 
 /*
- * Resource Management
- */
-
-#define pnp_flags_valid(resrc)	(((resrc)->flags & IORESOURCE_UNSET) == 0 && \
-				 ((resrc)->flags & (IORESOURCE_IO|IORESOURCE_MEM|IORESOURCE_IRQ|IORESOURCE_DMA)) != 0)
-
-/* Use these instead of directly reading pnp_dev to get resource information */
-#define pnp_port_start(dev,bar)	((dev)->io_resource[(bar)].start)
-#define pnp_port_end(dev,bar)	((dev)->io_resource[(bar)].end)
-#define pnp_port_flags(dev,bar)	((dev)->io_resource[(bar)].flags)
-#define pnp_port_valid(dev,bar)	pnp_flags_valid(&(dev)->io_resource[(bar)])
-#define pnp_port_len(dev,bar) \
-	((pnp_port_start((dev),(bar)) == 0 &&	\
-	  pnp_port_end((dev),(bar)) ==		\
-	  pnp_port_start((dev),(bar))) ? 0 :	\
-	  					\
-	 (pnp_port_end((dev),(bar)) -		\
-	  pnp_port_start((dev),(bar)) + 1))
-
-#define pnp_mem_start(dev,bar)	((dev)->mem_resource[(bar)].start)
-#define pnp_mem_end(dev,bar)	((dev)->mem_resource[(bar)].end)
-#define pnp_mem_flags(dev,bar)	((dev)->mem_resource[(bar)].flags)
-#define pnp_mem_valid(dev,bar)	pnp_flags_valid(&(dev)->mem_resource[(bar)])
-#define pnp_mem_len(dev,bar) \
-	((pnp_mem_start((dev),(bar)) == 0 &&	\
-	  pnp_mem_end((dev),(bar)) ==		\
-	  pnp_mem_start((dev),(bar))) ? 0 :	\
-	  					\
-	 (pnp_mem_end((dev),(bar)) -		\
-	  pnp_mem_start((dev),(bar)) + 1))
-
-#define pnp_irq(dev,bar)	((dev)->irq_resource[(bar)].start)
-#define pnp_irq_flags(dev,bar)	((dev)->irq_resource[(bar)].flags)
-#define pnp_irq_valid(dev,bar)	pnp_flags_valid(&(dev)->irq_resource[(bar)])
-
-#define pnp_dma(dev,bar)	((dev)->dma_resource[(bar)].start)
-#define pnp_dma_flags(dev,bar)	((dev)->dma_resource[(bar)].flags)
-#define pnp_dma_valid(dev,bar)	pnp_flags_valid(&(dev)->dma_resource[(bar)])
-
-#define PNP_PORT_FLAG_16BITADDR	(1<<0)
-#define PNP_PORT_FLAG_FIXED	(1<<1)
-
-struct pnp_port {
-	unsigned short min;		/* min base number */
-	unsigned short max;		/* max base number */
-	unsigned char align;		/* align boundary */
-	unsigned char size;		/* size of range */
-	unsigned char flags;		/* port flags */
-	unsigned char pad;		/* pad */
-	struct pnp_resources *res;	/* parent */
-	struct pnp_port *next;		/* next port */
-};
-
-struct pnp_irq {
-	unsigned short map;		/* bitmaks for IRQ lines */
-	unsigned char flags;		/* IRQ flags */
-	unsigned char pad;		/* pad */
-	struct pnp_resources *res;	/* parent */
-	struct pnp_irq *next;		/* next IRQ */
-};
-
-struct pnp_dma {
-	unsigned char map;		/* bitmask for DMA channels */
-	unsigned char flags;		/* DMA flags */
-	struct pnp_resources *res;	/* parent */
-	struct pnp_dma *next;		/* next port */
-};
-
-struct pnp_mem {
-	unsigned int min;		/* min base number */
-	unsigned int max;		/* max base number */
-	unsigned int align;		/* align boundary */
-	unsigned int size;		/* size of range */
-	unsigned char flags;		/* memory flags */
-	unsigned char pad;		/* pad */
-	struct pnp_resources *res;	/* parent */
-	struct pnp_mem *next;		/* next memory resource */
-};
-
-struct pnp_mem32 {
-	unsigned char data[17];
-	struct pnp_resources *res;	/* parent */
-	struct pnp_mem32 *next;		/* next 32-bit memory resource */
-};
-
-#define PNP_RES_PRIORITY_PREFERRED	0
-#define PNP_RES_PRIORITY_ACCEPTABLE	1
-#define PNP_RES_PRIORITY_FUNCTIONAL	2
-#define PNP_RES_PRIORITY_INVALID	65535
-
-struct pnp_resources {
-	unsigned short priority;	/* priority */
-	unsigned short dependent;	/* dependent resources */
-	struct pnp_port *port;		/* first port */
-	struct pnp_irq *irq;		/* first IRQ */
-	struct pnp_dma *dma;		/* first DMA */
-	struct pnp_mem *mem;		/* first memory resource */
-	struct pnp_mem32 *mem32;	/* first 32-bit memory */
-	struct pnp_dev *dev;		/* parent */
-	struct pnp_resources *dep;	/* dependent resources */
-};
-
-struct pnp_res_cfg {
-	struct resource io_resource[DEVICE_COUNT_IO];	/* I/O ports */
-	struct resource mem_resource[DEVICE_COUNT_MEM]; /* memory regions + expansion ROMs */
-	struct resource dma_resource[DEVICE_COUNT_DMA];
-	struct resource irq_resource[DEVICE_COUNT_IRQ];
-};
-
-struct pnp_cfg {
-	struct pnp_port *port[8];
-	struct pnp_irq *irq[2];
-	struct pnp_dma *dma[2];
-	struct pnp_mem *mem[4];
-	struct pnp_res_cfg request;
-};
-
-
-/* 
  * Protocol Management
  */
 
 struct pnp_protocol {
 	struct list_head	protocol_list;
-	char			name[DEVICE_NAME_SIZE];
+	char		      * name;
 
-	/* functions */
-	int (*get)(struct pnp_dev *dev);
-	int (*set)(struct pnp_dev *dev, struct pnp_cfg *config);
+	/* resource control functions */
+	int (*get)(struct pnp_dev *dev, struct pnp_resource_table *res);
+	int (*set)(struct pnp_dev *dev, struct pnp_resource_table *res);
 	int (*disable)(struct pnp_dev *dev);
 
 	/* used by pnp layer only (look but don't touch) */
@@ -384,6 +367,8 @@
 int pnp_add_device(struct pnp_dev *dev);
 void pnp_remove_device(struct pnp_dev *dev);
 extern struct list_head pnp_global;
+int pnp_device_attach(struct pnp_dev *pnp_dev);
+void pnp_device_detach(struct pnp_dev *pnp_dev);
 
 /* resource */
 struct pnp_resources * pnp_build_resource(struct pnp_dev *dev, int dependent);
@@ -393,29 +378,42 @@
 int pnp_add_dma_resource(struct pnp_dev *dev, int depnum, struct pnp_dma *data);
 int pnp_add_port_resource(struct pnp_dev *dev, int depnum, struct pnp_port *data);
 int pnp_add_mem_resource(struct pnp_dev *dev, int depnum, struct pnp_mem *data);
-int pnp_add_mem32_resource(struct pnp_dev *dev, int depnum, struct pnp_mem32 *data);
-int pnp_init_res_cfg(struct pnp_res_cfg *template);
-int pnp_activate_dev(struct pnp_dev *dev, struct pnp_res_cfg *template);
+void pnp_init_resource_table(struct pnp_resource_table *table);
+int pnp_generate_rule(struct pnp_dev * dev, int depnum, struct pnp_rule_table * rule);
+
+/* manager */
+int pnp_activate_dev(struct pnp_dev *dev);
 int pnp_disable_dev(struct pnp_dev *dev);
-int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, struct pnp_res_cfg *template);
 void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size);
+int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode);
+int pnp_auto_config_dev(struct pnp_dev *dev);
 
 /* driver */
 int compare_pnp_id(struct pnp_id * pos, const char * id);
 int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev);
 int pnp_register_driver(struct pnp_driver *drv);
 void pnp_unregister_driver(struct pnp_driver *drv);
-int pnp_device_attach(struct pnp_dev *pnp_dev);
-void pnp_device_detach(struct pnp_dev *pnp_dev);
+
+/* support */
+int pnp_is_active(struct pnp_dev * dev);
+unsigned char * pnp_parse_current_resources(unsigned char * p, unsigned char * end, struct pnp_resource_table * res);
+unsigned char * pnp_parse_possible_resources(unsigned char * p, unsigned char * end, struct pnp_dev * dev);
+unsigned char * pnp_write_resources(unsigned char * p, unsigned char * end, struct pnp_resource_table * res);
 
 #else
 
 /* just in case anyone decides to call these without PnP Support Enabled */
+
+/* core */
 static inline int pnp_register_protocol(struct pnp_protocol *protocol) { return -ENODEV; }
 static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { }
 static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; }
 static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; }
 static inline void pnp_remove_device(struct pnp_dev *dev) { }
+static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; }
+static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; }
+
+/* resource */
 static inline struct pnp_resources * pnp_build_resource(struct pnp_dev *dev, int dependent) { return NULL; }
 static inline struct pnp_resources * pnp_find_resources(struct pnp_dev *dev, int depnum) { return NULL; }
 static inline int pnp_get_max_depnum(struct pnp_dev *dev) { return -ENODEV; }
@@ -423,19 +421,27 @@
 static inline int pnp_add_dma_resource(struct pnp_dev *dev, int depnum, struct pnp_irq *data) { return -ENODEV; }
 static inline int pnp_add_port_resource(struct pnp_dev *dev, int depnum, struct pnp_irq *data) { return -ENODEV; }
 static inline int pnp_add_mem_resource(struct pnp_dev *dev, int depnum, struct pnp_irq *data) { return -ENODEV; }
-static inline int pnp_add_mem32_resource(struct pnp_dev *dev, int depnum, struct pnp_irq *data) { return -ENODEV; }
-static inline int pnp_init_res_cfg(struct pnp_res_cfg *template) { return -ENODEV; }
-static inline int pnp_activate_dev(struct pnp_dev *dev, struct pnp_res_cfg *template) { return -ENODEV; }
+static inline void pnp_init_resource_table(struct pnp_resource_table *table) { ; }
+static inline int pnp_generate_rule(struct pnp_dev * dev, int depnum, struct pnp_rule_table * rule) { return -ENODEV; }
+
+/* manager */
+static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
 static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
-static inline int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, struct pnp_res_cfg *template) { return -ENODEV; }
 static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { ; }
+static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; }
+static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; }
+
+/* driver */
 static inline int compare_pnp_id(struct list_head * id_list, const char * id) { return -ENODEV; }
 static inline int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { return -ENODEV; }
 static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; }
 static inline void pnp_unregister_driver(struct pnp_driver *drv) { ; }
 
-static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; }
-static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; }
+/* support */
+static inline int pnp_is_active(struct pnp_dev * dev) { return -ENODEV; }
+static inline unsigned char * pnp_parse_current_resources(unsigned char * p, unsigned char * end, struct pnp_resource_table * res) { return NULL; }
+static inline unsigned char * pnp_parse_possible_resources(unsigned char * p, unsigned char * end, struct pnp_dev * dev) { return NULL; }
+static inline unsigned char * pnp_write_resources(unsigned char * p, unsigned char * end, struct pnp_resource_table * res) { return NULL; }
 
 #endif /* CONFIG_PNP */
 
@@ -458,6 +464,7 @@
 
 #else
 
+/* card */
 static inline int pnpc_add_card(struct pnp_card *card) { return -ENODEV; }
 static inline void pnpc_remove_card(struct pnp_card *card) { ; }
 static inline int pnpc_add_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; }
@@ -467,11 +474,12 @@
 static inline int pnpc_register_driver(struct pnpc_driver *drv) { return -ENODEV; }
 static inline void pnpc_unregister_driver(struct pnpc_driver *drv) { ; }
 static inline int pnpc_add_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; }
-static inline int pnpc_attach(struct pnp_card *card) { return -ENODEV; }
-static inline void pnpc_detach(struct pnp_card *card) { ; }
 
 #endif /* CONFIG_PNP_CARD */
 
+#define pnp_err(format, arg...) printk(KERN_ERR "pnp: " format "\n" , ## arg)
+#define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg)
+#define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg)
 
 #ifdef DEBUG
 #define pnp_dbg(format, arg...) printk(KERN_DEBUG "pnp: " format "\n" , ## arg)
diff -Nru a/include/linux/posix-timers.h b/include/linux/posix-timers.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/linux/posix-timers.h	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,30 @@
+#ifndef _linux_POSIX_TIMERS_H
+#define _linux_POSIX_TIMERS_H
+
+struct k_clock {
+	int res;		/* in nano seconds */
+	int (*clock_set) (struct timespec * tp);
+	int (*clock_get) (struct timespec * tp);
+	int (*nsleep) (int flags,
+		       struct timespec * new_setting,
+		       struct itimerspec * old_setting);
+	int (*timer_set) (struct k_itimer * timr, int flags,
+			  struct itimerspec * new_setting,
+			  struct itimerspec * old_setting);
+	int (*timer_del) (struct k_itimer * timr);
+	void (*timer_get) (struct k_itimer * timr,
+			   struct itimerspec * cur_setting);
+};
+struct now_struct {
+	unsigned long jiffies;
+};
+
+#define posix_get_now(now) (now)->jiffies = jiffies;
+#define posix_time_before(timer, now) \
+                      time_before((timer)->expires, (now)->jiffies)
+
+#define posix_bump_timer(timr) do { \
+                        (timr)->it_timer.expires += (timr)->it_incr; \
+                        (timr)->it_overrun++;               \
+                       }while (0)
+#endif
diff -Nru a/include/linux/profile.h b/include/linux/profile.h
--- a/include/linux/profile.h	Sun Feb 23 22:25:24 2003
+++ b/include/linux/profile.h	Sun Feb 23 22:25:24 2003
@@ -45,6 +45,12 @@
 
 int profile_event_unregister(enum profile_type, struct notifier_block * n);
  
+int register_profile_notifier(struct notifier_block * nb);
+int unregister_profile_notifier(struct notifier_block * nb);
+ 
+/* profiling hook activated on each timer interrupt */
+void profile_hook(struct pt_regs * regs);
+
 #else
 
 static inline int profile_event_register(enum profile_type t, struct notifier_block * n)
@@ -60,7 +66,19 @@
 #define profile_exit_task(a) do { } while (0)
 #define profile_exec_unmap(a) do { } while (0)
 #define profile_exit_mmap(a) do { } while (0)
- 
+
+static inline int register_profile_notifier(struct notifier_block * nb)
+{
+	return -ENOSYS;
+}
+
+static inline int unregister_profile_notifier(struct notifier_block * nb)
+{
+	return -ENOSYS;
+}
+
+#define profile_hook(regs) do { } while (0)
+
 #endif /* CONFIG_PROFILING */
  
 #endif /* __KERNEL__ */
diff -Nru a/include/linux/raid/md.h b/include/linux/raid/md.h
--- a/include/linux/raid/md.h	Sun Feb 23 22:25:21 2003
+++ b/include/linux/raid/md.h	Sun Feb 23 22:25:21 2003
@@ -73,6 +73,9 @@
 extern void md_unregister_thread (mdk_thread_t *thread);
 extern void md_wakeup_thread(mdk_thread_t *thread);
 extern void md_interrupt_thread (mdk_thread_t *thread);
+extern void md_write_start(mddev_t *mddev);
+extern void md_write_end(mddev_t *mddev, mdk_thread_t *thread);
+extern void md_handle_safemode(mddev_t *mddev);
 extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
 extern void md_sync_acct(mdk_rdev_t *rdev, unsigned long nr_sectors);
 extern void md_error (mddev_t *mddev, mdk_rdev_t *rdev);
diff -Nru a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
--- a/include/linux/raid/md_k.h	Sun Feb 23 22:25:21 2003
+++ b/include/linux/raid/md_k.h	Sun Feb 23 22:25:21 2003
@@ -29,6 +29,7 @@
 #define	LEVEL_LINEAR		(-1)
 
 #define MaxSector (~(sector_t)0)
+#define MD_THREAD_NAME_MAX 14
 
 static inline int pers_to_level (int pers)
 {
@@ -229,7 +230,10 @@
 	atomic_t			recovery_active; /* blocks scheduled, but not written */
 	wait_queue_head_t		recovery_wait;
 	sector_t			recovery_cp;
-
+	int				safemode;	/* if set, update "clean" superblock
+							 * when no writes pending.
+							 */ 
+	atomic_t			writes_pending; 
 	request_queue_t			queue;	/* for plugging ... */
 
 	struct list_head		all_mddevs;
diff -Nru a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
--- a/include/linux/raid/raid1.h	Sun Feb 23 22:25:25 2003
+++ b/include/linux/raid/raid1.h	Sun Feb 23 22:25:25 2003
@@ -34,6 +34,7 @@
 
 	mempool_t *r1bio_pool;
 	mempool_t *r1buf_pool;
+	char thread_name[MD_THREAD_NAME_MAX];
 };
 
 typedef struct r1_private_data_s conf_t;
diff -Nru a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
--- a/include/linux/raid/raid5.h	Sun Feb 23 22:25:26 2003
+++ b/include/linux/raid/raid5.h	Sun Feb 23 22:25:26 2003
@@ -226,6 +226,7 @@
 							 * waiting for 25% to be free
 							 */        
 	spinlock_t		device_lock;
+	char			thread_name[MD_THREAD_NAME_MAX];
 };
 
 typedef struct raid5_private_data raid5_conf_t;
diff -Nru a/include/linux/sched.h b/include/linux/sched.h
--- a/include/linux/sched.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/sched.h	Sun Feb 23 22:25:22 2003
@@ -295,6 +295,25 @@
 typedef struct prio_array prio_array_t;
 struct backing_dev_info;
 
+/* POSIX.1b interval timer structure. */
+struct k_itimer {
+	struct list_head list;		 /* free/ allocate list */
+	spinlock_t it_lock;
+	clockid_t it_clock;		/* which timer type */
+	timer_t it_id;			/* timer id */
+	int it_overrun;			/* overrun on pending signal  */
+	int it_overrun_last;		 /* overrun on last delivered signal */
+	int it_requeue_pending;          /* waiting to requeue this timer */
+	int it_sigev_notify;		 /* notify word of sigevent struct */
+	int it_sigev_signo;		 /* signo word of sigevent struct */
+	sigval_t it_sigev_value;	 /* value word of sigevent struct */
+	unsigned long it_incr;		/* interval specified in jiffies */
+	struct task_struct *it_process;	/* process to send signal to */
+	struct timer_list it_timer;
+};
+
+
+
 struct task_struct {
 	volatile long state;	/* -1 unrunnable, 0 runnable, >0 stopped */
 	struct thread_info *thread_info;
@@ -358,6 +377,7 @@
 	unsigned long it_real_value, it_prof_value, it_virt_value;
 	unsigned long it_real_incr, it_prof_incr, it_virt_incr;
 	struct timer_list real_timer;
+	struct list_head posix_timers; /* POSIX.1b Interval Timers */
 	unsigned long utime, stime, cutime, cstime;
 	u64 start_time;
 /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
@@ -571,9 +591,6 @@
  */
 extern struct mm_struct * mm_alloc(void);
 
-extern struct mm_struct * start_lazy_tlb(void);
-extern void end_lazy_tlb(struct mm_struct *mm);
-
 /* mmdrop drops the mm and the page tables */
 extern inline void FASTCALL(__mmdrop(struct mm_struct *));
 static inline void mmdrop(struct mm_struct * mm)
@@ -597,6 +614,7 @@
 extern void __exit_signal(struct task_struct *);
 extern void exit_sighand(struct task_struct *);
 extern void __exit_sighand(struct task_struct *);
+extern void exit_itimers(struct task_struct *);
 
 extern NORET_TYPE void do_group_exit(int);
 
diff -Nru a/include/linux/signal.h b/include/linux/signal.h
--- a/include/linux/signal.h	Sun Feb 23 22:25:22 2003
+++ b/include/linux/signal.h	Sun Feb 23 22:25:22 2003
@@ -208,7 +208,7 @@
 struct pt_regs;
 extern int get_signal_to_deliver(siginfo_t *info, struct pt_regs *regs, void *cookie);
 #endif
-
+#define FOLD_NANO_SLEEP_INTO_CLOCK_NANO_SLEEP
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_SIGNAL_H */
diff -Nru a/include/linux/skbuff.h b/include/linux/skbuff.h
--- a/include/linux/skbuff.h	Sun Feb 23 22:25:25 2003
+++ b/include/linux/skbuff.h	Sun Feb 23 22:25:25 2003
@@ -1102,7 +1102,7 @@
  
 static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len)
 {
-	unsigned int size = skb->len + skb->data_len;
+	unsigned int size = skb->len;
 	if (likely(size >= len))
 		return skb;
 	return skb_pad(skb, len-size);
diff -Nru a/include/linux/socket.h b/include/linux/socket.h
--- a/include/linux/socket.h	Sun Feb 23 22:25:25 2003
+++ b/include/linux/socket.h	Sun Feb 23 22:25:25 2003
@@ -25,6 +25,21 @@
 };
 
 /*
+ * Desired design of maximum size and alignment (see RFC2553)
+ */
+#define _SS_MAXSIZE	128	/* Implementation specific max size */
+#define _SS_ALIGNSIZE	(__alignof__ (struct sockaddr *))
+				/* Implementation specific desired alignment */
+
+struct sockaddr_storage {
+	sa_family_t	ss_family;		/* address family */
+	/* Following field(s) are implementation specific */
+	char		__data[_SS_MAXSIZE - sizeof(sa_family_t)];
+				/* space to achieve desired size, */
+				/* _SS_MAXSIZE value minus size of ss_family */
+} __attribute__ ((aligned(_SS_ALIGNSIZE)));	/* force desired alignment */
+
+/*
  *	As we do 4.4BSD message passing we use a 4.4BSD message passing
  *	system, not 4.3. Thus msg_accrights(len) are now missing. They
  *	belong in an obscure libc emulation or the bin.
diff -Nru a/include/linux/sonypi.h b/include/linux/sonypi.h
--- a/include/linux/sonypi.h	Sun Feb 23 22:25:23 2003
+++ b/include/linux/sonypi.h	Sun Feb 23 22:25:23 2003
@@ -1,7 +1,7 @@
 /* 
  * Sony Programmable I/O Control Device driver for VAIO
  *
- * Copyright (C) 2001-2002 Stelian Pop <stelian@popies.net>
+ * Copyright (C) 2001-2003 Stelian Pop <stelian@popies.net>
  *
  * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
  *
diff -Nru a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
--- a/include/linux/sunrpc/auth.h	Sun Feb 23 22:25:24 2003
+++ b/include/linux/sunrpc/auth.h	Sun Feb 23 22:25:24 2003
@@ -84,6 +84,7 @@
  * Client authentication ops
  */
 struct rpc_authops {
+	struct module		*owner;
 	rpc_authflavor_t	au_flavor;	/* flavor (RPC_AUTH_*) */
 #ifdef RPC_DEBUG
 	char *			au_name;
diff -Nru a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
--- a/include/linux/sunrpc/svc.h	Sun Feb 23 22:25:24 2003
+++ b/include/linux/sunrpc/svc.h	Sun Feb 23 22:25:24 2003
@@ -114,6 +114,7 @@
 	struct xdr_buf		rq_res;
 	struct page *		rq_argpages[RPCSVC_MAXPAGES];
 	struct page *		rq_respages[RPCSVC_MAXPAGES];
+	int			rq_restailpage;
 	short			rq_argused;	/* pages used for argument */
 	short			rq_arghi;	/* pages available in argument page list */
 	short			rq_resused;	/* pages used for result */
diff -Nru a/include/linux/swap.h b/include/linux/swap.h
--- a/include/linux/swap.h	Sun Feb 23 22:25:21 2003
+++ b/include/linux/swap.h	Sun Feb 23 22:25:21 2003
@@ -242,6 +242,8 @@
 	page_cache_release(page)
 #define free_pages_and_swap_cache(pages, nr) \
 	release_pages((pages), (nr), 0);
+#define page_referenced(page) \
+	TestClearPageReferenced(page)
 
 #define show_swap_cache_info()			/*NOTHING*/
 #define free_swap_and_cache(swp)		/*NOTHING*/
diff -Nru a/include/linux/sys.h b/include/linux/sys.h
--- a/include/linux/sys.h	Sun Feb 23 22:25:23 2003
+++ b/include/linux/sys.h	Sun Feb 23 22:25:23 2003
@@ -2,9 +2,8 @@
 #define _LINUX_SYS_H
 
 /*
- * system call entry points ... but not all are defined
+ * This file is no longer used or needed
  */
-#define NR_syscalls 260
 
 /*
  * These are system calls that will be removed at some time
diff -Nru a/include/linux/time.h b/include/linux/time.h
--- a/include/linux/time.h	Sun Feb 23 22:25:25 2003
+++ b/include/linux/time.h	Sun Feb 23 22:25:25 2003
@@ -41,6 +41,19 @@
  */
 #define MAX_JIFFY_OFFSET ((~0UL >> 1)-1)
 
+/* Parameters used to convert the timespec values */
+#ifndef USEC_PER_SEC
+#define USEC_PER_SEC (1000000L)
+#endif
+
+#ifndef NSEC_PER_SEC
+#define NSEC_PER_SEC (1000000000L)
+#endif
+
+#ifndef NSEC_PER_USEC
+#define NSEC_PER_USEC (1000L)
+#endif
+
 static __inline__ unsigned long
 timespec_to_jiffies(struct timespec *value)
 {
@@ -139,6 +152,8 @@
 #ifdef __KERNEL__
 extern void do_gettimeofday(struct timeval *tv);
 extern void do_settimeofday(struct timeval *tv);
+extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz);
+extern void clock_was_set(void); // call when ever the clock is set
 extern long do_nanosleep(struct timespec *t);
 extern long do_utimes(char * filename, struct timeval * times);
 #endif
@@ -166,5 +181,25 @@
 	struct	timeval it_interval;	/* timer interval */
 	struct	timeval it_value;	/* current value */
 };
+
+
+/*
+ * The IDs of the various system clocks (for POSIX.1b interval timers).
+ */
+#define CLOCK_REALTIME		  0
+#define CLOCK_MONOTONIC	  1
+#define CLOCK_PROCESS_CPUTIME_ID 2
+#define CLOCK_THREAD_CPUTIME_ID	 3
+#define CLOCK_REALTIME_HR	 4
+#define CLOCK_MONOTONIC_HR	  5
+
+#define MAX_CLOCKS 6
+
+/*
+ * The various flags for setting POSIX.1b interval timers.
+ */
+
+#define TIMER_ABSTIME 0x01
+
 
 #endif
diff -Nru a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
--- a/include/linux/tty_ldisc.h	Sun Feb 23 22:25:27 2003
+++ b/include/linux/tty_ldisc.h	Sun Feb 23 22:25:27 2003
@@ -105,6 +105,7 @@
 	char	*name;
 	int	num;
 	int	flags;
+	
 	/*
 	 * The following routines are called from above.
 	 */
@@ -129,6 +130,8 @@
 			       char *fp, int count);
 	int	(*receive_room)(struct tty_struct *);
 	void	(*write_wakeup)(struct tty_struct *);
+
+	struct  module *owner;
 };
 
 #define TTY_LDISC_MAGIC	0x5403
diff -Nru a/include/linux/types.h b/include/linux/types.h
--- a/include/linux/types.h	Sun Feb 23 22:25:26 2003
+++ b/include/linux/types.h	Sun Feb 23 22:25:26 2003
@@ -27,6 +27,8 @@
 typedef __kernel_daddr_t	daddr_t;
 typedef __kernel_key_t		key_t;
 typedef __kernel_suseconds_t	suseconds_t;
+typedef __kernel_timer_t	timer_t;
+typedef __kernel_clockid_t	clockid_t;
 
 #ifdef __KERNEL__
 typedef __kernel_uid32_t	uid_t;
diff -Nru a/include/linux/usb.h b/include/linux/usb.h
--- a/include/linux/usb.h	Sun Feb 23 22:25:24 2003
+++ b/include/linux/usb.h	Sun Feb 23 22:25:24 2003
@@ -17,6 +17,7 @@
 #include <linux/device.h>	/* for struct device */
 #include <linux/fs.h>		/* for struct file_operations */
 #include <linux/completion.h>	/* for struct completion */
+#include <linux/sched.h>	/* for current && schedule_timeout */
 
 
 static __inline__ void wait_ms(unsigned int ms)
@@ -239,6 +240,7 @@
 
 	int have_langid;		/* whether string_langid is valid yet */
 	int string_langid;		/* language ID for strings */
+	int present;			/* if device is present or not */
 
 	void *hcpriv;			/* Host Controller private data */
 	
diff -Nru a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
--- a/include/net/bluetooth/hci.h	Sun Feb 23 22:25:26 2003
+++ b/include/net/bluetooth/hci.h	Sun Feb 23 22:25:26 2003
@@ -48,6 +48,7 @@
 #define HCI_PCCARD	2
 #define HCI_UART 	3
 #define HCI_RS232 	4
+#define HCI_PCI		5
 
 /* HCI device flags */
 enum {
@@ -65,27 +66,28 @@
 };
 
 /* HCI ioctl defines */
-#define HCIDEVUP        _IOW('H', 201, int)
-#define HCIDEVDOWN      _IOW('H', 202, int)
-#define HCIDEVRESET     _IOW('H', 203, int)
-#define HCIDEVRESTAT    _IOW('H', 204, int)
-
-#define HCIGETDEVLIST   _IOR('H', 210, int)
-#define HCIGETDEVINFO   _IOR('H', 211, int)
-#define HCIGETCONNLIST  _IOR('H', 212, int)
-#define HCIGETCONNINFO  _IOR('H', 213, int)
-
-#define HCISETRAW       _IOW('H', 220, int)
-#define HCISETSCAN      _IOW('H', 221, int)
-#define HCISETAUTH      _IOW('H', 222, int)
-#define HCISETENCRYPT   _IOW('H', 223, int)
-#define HCISETPTYPE     _IOW('H', 224, int)
-#define HCISETLINKPOL   _IOW('H', 225, int)
-#define HCISETLINKMODE  _IOW('H', 226, int)
-#define HCISETACLMTU    _IOW('H', 227, int)
-#define HCISETSCOMTU    _IOW('H', 228, int)
+#define HCIDEVUP	_IOW('H', 201, int)
+#define HCIDEVDOWN	_IOW('H', 202, int)
+#define HCIDEVRESET	_IOW('H', 203, int)
+#define HCIDEVRESTAT	_IOW('H', 204, int)
+
+#define HCIGETDEVLIST	_IOR('H', 210, int)
+#define HCIGETDEVINFO	_IOR('H', 211, int)
+#define HCIGETCONNLIST	_IOR('H', 212, int)
+#define HCIGETCONNINFO	_IOR('H', 213, int)
+
+#define HCISETRAW	_IOW('H', 220, int)
+#define HCISETSCAN	_IOW('H', 221, int)
+#define HCISETAUTH	_IOW('H', 222, int)
+#define HCISETENCRYPT	_IOW('H', 223, int)
+#define HCISETPTYPE	_IOW('H', 224, int)
+#define HCISETLINKPOL	_IOW('H', 225, int)
+#define HCISETLINKMODE	_IOW('H', 226, int)
+#define HCISETACLMTU	_IOW('H', 227, int)
+#define HCISETSCOMTU	_IOW('H', 228, int)
+#define HCISETRAWVND	_IOW('H', 229, int)
 
-#define HCIINQUIRY      _IOR('H', 240, int)
+#define HCIINQUIRY	_IOR('H', 240, int)
 
 /* HCI timeouts */
 #define HCI_CONN_TIMEOUT 	(HZ * 40)
@@ -383,7 +385,13 @@
 } __attribute__ ((packed));
 
 /* Status params */
-#define OGF_STATUS_PARAM 	0x05
+#define OGF_STATUS_PARAM	0x05
+
+/* Testing commands */
+#define OGF_TESTING_CMD		0x3E
+
+/* Vendor specific commands */
+#define OGF_VENDOR_CMD		0x3F
 
 /* ---- HCI Events ---- */
 #define HCI_EV_INQUIRY_COMPLETE	0x01
diff -Nru a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
--- a/include/net/bluetooth/hci_core.h	Sun Feb 23 22:25:24 2003
+++ b/include/net/bluetooth/hci_core.h	Sun Feb 23 22:25:24 2003
@@ -118,6 +118,8 @@
 	struct proc_dir_entry   *proc;
 #endif
 
+	struct module           *owner;
+	
 	int (*open)(struct hci_dev *hdev);
 	int (*close)(struct hci_dev *hdev);
 	int (*flush)(struct hci_dev *hdev);
@@ -299,12 +301,30 @@
 }
 
 /* ----- HCI Devices ----- */
-static inline void hci_dev_put(struct hci_dev *d)
-{ 
+static inline void __hci_dev_put(struct hci_dev *d)
+{
 	if (atomic_dec_and_test(&d->refcnt))
 		d->destruct(d);
 }
-#define hci_dev_hold(d)		atomic_inc(&d->refcnt)
+
+static inline void hci_dev_put(struct hci_dev *d)
+{ 
+	__hci_dev_put(d);
+	module_put(d->owner);
+}
+
+static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d)
+{
+	atomic_inc(&d->refcnt);
+	return d;
+}
+
+static inline struct hci_dev *hci_dev_hold(struct hci_dev *d)
+{
+	if (try_module_get(d->owner))
+		return __hci_dev_hold(d);
+	return NULL;
+}
 
 #define hci_dev_lock(d)		spin_lock(&d->lock)
 #define hci_dev_unlock(d)	spin_unlock(&d->lock)
@@ -452,7 +472,6 @@
 int hci_send_cmd(struct hci_dev *hdev, __u16 ogf, __u16 ocf, __u32 plen, void *param);
 int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags);
 int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
-int hci_send_raw(struct sk_buff *skb);
 
 void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 ogf, __u16 ocf);
 
@@ -470,7 +489,7 @@
 };
 
 /* HCI security filter */
-#define HCI_SFLT_MAX_OGF 4
+#define HCI_SFLT_MAX_OGF  5
 
 struct hci_sec_filter {
 	unsigned long type_mask;
diff -Nru a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
--- a/include/net/bluetooth/l2cap.h	Sun Feb 23 22:25:22 2003
+++ b/include/net/bluetooth/l2cap.h	Sun Feb 23 22:25:22 2003
@@ -224,6 +224,8 @@
 
 	__u8		ident;
 
+	__u16		sport;
+
 	struct l2cap_conn 	*conn;
 	struct sock 		*next_c;
 	struct sock 		*prev_c;
diff -Nru a/include/net/dn_route.h b/include/net/dn_route.h
--- a/include/net/dn_route.h	Sun Feb 23 22:25:21 2003
+++ b/include/net/dn_route.h	Sun Feb 23 22:25:21 2003
@@ -122,7 +122,7 @@
 	if ((dst = sk->dst_cache) && !dst->obsolete) {
 try_again:
 		skb->dst = dst_clone(dst);
-		dst->output(skb);
+		dst_output(skb);
 		return;
 	}
 
diff -Nru a/include/net/sctp/structs.h b/include/net/sctp/structs.h
--- a/include/net/sctp/structs.h	Sun Feb 23 22:25:27 2003
+++ b/include/net/sctp/structs.h	Sun Feb 23 22:25:27 2003
@@ -61,38 +61,6 @@
 #include <linux/workqueue.h>	/* We need tq_struct.    */
 #include <linux/sctp.h>         /* We need sctp* header structs.  */
 
-/*
- * This is (almost) a direct quote from RFC 2553.
- */
-
-/*
- * Desired design of maximum size and alignment
- */
-#define _SS_MAXSIZE    128		/* Implementation specific max size */
-#define _SS_ALIGNSIZE  (sizeof (__s64))
-				/* Implementation specific desired alignment */
-/*
- * Definitions used for sockaddr_storage structure paddings design.
- */
-#define _SS_PAD1SIZE   (_SS_ALIGNSIZE - sizeof (sa_family_t))
-#define _SS_PAD2SIZE   (_SS_MAXSIZE - (sizeof (sa_family_t)+ \
-                              _SS_PAD1SIZE + _SS_ALIGNSIZE))
-
-struct sockaddr_storage {
-	sa_family_t  __ss_family;		/* address family */
-	/* Following fields are implementation specific */
-	char      __ss_pad1[_SS_PAD1SIZE];
-				/* 6 byte pad, to make implementation */
-				/* specific pad up to alignment field that */
-				/* follows explicit in the data structure */
-	__s64   __ss_align;	/* field to force desired structure */
-				/* storage alignment */
-	char      __ss_pad2[_SS_PAD2SIZE];
-				/* 112 byte pad to achieve desired size, */
-				/* _SS_MAXSIZE value minus size of ss_family */
-				/* __ss_pad1, __ss_align fields is 112 */
-};
-
 /* A convenience structure for handling sockaddr structures.
  * We should wean ourselves off this.
  */
diff -Nru a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
--- a/include/net/sctp/ulpqueue.h	Sun Feb 23 22:25:23 2003
+++ b/include/net/sctp/ulpqueue.h	Sun Feb 23 22:25:23 2003
@@ -62,7 +62,7 @@
 /* Add a new DATA chunk for processing. */
 int sctp_ulpq_tail_data(struct sctp_ulpq *, sctp_chunk_t *chunk, int priority);
 
-/* Add a new event for propogation to the ULP. */
+/* Add a new event for propagation to the ULP. */
 int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sctp_ulpevent *ev);
 
 /* Is the ulpqueue empty. */
diff -Nru a/include/pcmcia/ss.h b/include/pcmcia/ss.h
--- a/include/pcmcia/ss.h	Sun Feb 23 22:25:26 2003
+++ b/include/pcmcia/ss.h	Sun Feb 23 22:25:26 2003
@@ -126,6 +126,7 @@
  * Socket operations.
  */
 struct pccard_operations {
+	struct module *owner;
 	int (*init)(unsigned int sock);
 	int (*suspend)(unsigned int sock);
 	int (*register_callback)(unsigned int sock, void (*handler)(void *, unsigned int), void * info);
@@ -144,12 +145,12 @@
  *  Calls to set up low-level "Socket Services" drivers
  */
 
-#define MAX_SOCKETS_PER_DEV 8
-
 struct pcmcia_socket_class_data {
 	unsigned int nsock;			/* number of sockets */
+	unsigned int sock_offset;		/* socket # (which is
+	 * returned to driver) = sock_offset + (0, 1, .. , (nsock-1) */
 	struct pccard_operations *ops;		/* see above */
-	void *s_info[MAX_SOCKETS_PER_DEV];	/* socket_info_t */
+	void *s_info;				/* socket_info_t */
 	unsigned int use_bus_pm;
 };
 
diff -Nru a/include/video/sgivw.h b/include/video/sgivw.h
--- a/include/video/sgivw.h	Sun Feb 23 22:25:21 2003
+++ b/include/video/sgivw.h	Sun Feb 23 22:25:21 2003
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/video/sgivwfb.h -- SGI DBE frame buffer device header
+ *  linux/drivers/video/sgivw.h -- SGI DBE frame buffer device header
  *
  *      Copyright (C) 1999 Silicon Graphics, Inc.
  *      Jeffrey Newquist, newquist@engr.sgi.som
@@ -12,10 +12,10 @@
 #ifndef __SGIVWFB_H__
 #define __SGIVWFB_H__
 
-#define DBE_GETREG(reg, dest)       ((dest) = DBE_REG_BASE->##reg)
-#define DBE_SETREG(reg, src)        DBE_REG_BASE->##reg = (src)
-#define DBE_IGETREG(reg, idx, dest) ((dest) = DBE_REG_BASE->##reg##[idx])
-#define DBE_ISETREG(reg, idx, src)  (DBE_REG_BASE->##reg##[idx] = (src))
+#define DBE_GETREG(reg, dest)		((dest) = DBE_REG_BASE->reg)
+#define DBE_SETREG(reg, src)		DBE_REG_BASE->reg = (src)
+#define DBE_IGETREG(reg, idx, dest)	((dest) = DBE_REG_BASE->reg[idx])
+#define DBE_ISETREG(reg, idx, src)	(DBE_REG_BASE->reg[idx] = (src))
 
 #define MASK(msb, lsb)          ( (((u32)1<<((msb)-(lsb)+1))-1) << (lsb) )
 #define GET(v, msb, lsb)        ( ((u32)(v) & MASK(msb,lsb)) >> (lsb) )
@@ -29,7 +29,7 @@
 #define DBE_REG_PHYS	0xd0000000
 #define DBE_REG_SIZE        0x01000000
 
-typedef struct {
+struct asregs {
   volatile u32 ctrlstat;     /* 0x000000 general control */
   volatile u32 dotclock;     /* 0x000004 dot clock PLL control */
   volatile u32 i2c;          /* 0x000008 crt I2C control */
@@ -121,7 +121,7 @@
   volatile u32 vc_6;           /* 0x080018 video capture crtl 3 */
   volatile u32 vc_7;           /* 0x08001c video capture crtl 3 */
   volatile u32 vc_8;           /* 0x08000c video capture crtl 3 */
-} asregs;
+};
 
 /* Bit mask information */
 
@@ -144,6 +144,21 @@
 #define DBE_VT_XY_VT_FREEZE_MSB     31
 #define DBE_VT_XY_VT_FREEZE_LSB     31
 
+#define DBE_FP_VDRV_FP_VDRV_ON_MSB	23
+#define DBE_FP_VDRV_FP_VDRV_ON_LSB	12
+#define DBE_FP_VDRV_FP_VDRV_OFF_MSB	11
+#define DBE_FP_VDRV_FP_VDRV_OFF_LSB	0
+
+#define DBE_FP_HDRV_FP_HDRV_ON_MSB	23
+#define DBE_FP_HDRV_FP_HDRV_ON_LSB	12
+#define DBE_FP_HDRV_FP_HDRV_OFF_MSB	11
+#define DBE_FP_HDRV_FP_HDRV_OFF_LSB	0
+
+#define DBE_FP_DE_FP_DE_ON_MSB		23
+#define DBE_FP_DE_FP_DE_ON_LSB		12
+#define DBE_FP_DE_FP_DE_OFF_MSB		11
+#define DBE_FP_DE_FP_DE_OFF_LSB		0
+
 #define DBE_VT_VSYNC_VT_VSYNC_ON_MSB        23
 #define DBE_VT_VSYNC_VT_VSYNC_ON_LSB        12
 #define DBE_VT_VSYNC_VT_VSYNC_OFF_MSB       11
@@ -164,6 +179,11 @@
 #define DBE_VT_HBLANK_VT_HBLANK_OFF_MSB       11
 #define DBE_VT_HBLANK_VT_HBLANK_OFF_LSB       0
 
+#define DBE_VT_FLAGS_VDRV_INVERT_MSB		0
+#define DBE_VT_FLAGS_VDRV_INVERT_LSB		0
+#define DBE_VT_FLAGS_HDRV_INVERT_MSB		2
+#define DBE_VT_FLAGS_HDRV_INVERT_LSB		2
+
 #define DBE_VT_VCMAP_VT_VCMAP_ON_MSB        23
 #define DBE_VT_VCMAP_VT_VCMAP_ON_LSB        12
 #define DBE_VT_VCMAP_VT_VCMAP_OFF_MSB       11
@@ -264,6 +284,8 @@
 
 #define DBE_CRS_MAGIC       54
 
+#define DBE_CLOCK_REF_KHZ	27000
+
 /* Config Register (DBE Only) Definitions */
 
 #define DBE_CONFIG_VDAC_ENABLE       0x00000001
@@ -326,7 +348,7 @@
  * Crime Video Timing Data Structure
  */
 
-typedef struct dbe_timing_info
+struct dbe_timing_info
 {
   dbe_timing_t type;
   int flags;				
@@ -347,7 +369,7 @@
   short pll_m;		    /* PLL M parameter		*/
   short pll_n;		    /* PLL P parameter		*/
   short pll_p;		    /* PLL N parameter		*/
-} dbe_timing_info_t;
+};
 
 /* Defines for dbe_vof_info_t flags */
 
diff -Nru a/kernel/Makefile b/kernel/Makefile
--- a/kernel/Makefile	Sun Feb 23 22:25:22 2003
+++ b/kernel/Makefile	Sun Feb 23 22:25:22 2003
@@ -6,7 +6,7 @@
 	    exit.o itimer.o time.o softirq.o resource.o \
 	    sysctl.o capability.o ptrace.o timer.o user.o \
 	    signal.o sys.o kmod.o workqueue.o futex.o pid.o \
-	    rcupdate.o intermodule.o extable.o params.o
+	    rcupdate.o intermodule.o extable.o params.o posix-timers.o
 
 obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
 obj-$(CONFIG_SMP) += cpu.o
diff -Nru a/kernel/exit.c b/kernel/exit.c
--- a/kernel/exit.c	Sun Feb 23 22:25:26 2003
+++ b/kernel/exit.c	Sun Feb 23 22:25:26 2003
@@ -66,12 +66,7 @@
  
 	BUG_ON(p->state < TASK_ZOMBIE);
  
-	if (p != current)
-		wait_task_inactive(p);
-
 	atomic_dec(&p->user->processes);
-	security_task_free(p);
-	free_uid(p->user);
 	write_lock_irq(&tasklist_lock);
 	if (unlikely(p->ptrace))
 		__ptrace_unlink(p);
@@ -435,32 +430,6 @@
 }
 
 /*
- * We can use these to temporarily drop into
- * "lazy TLB" mode and back.
- */
-struct mm_struct * start_lazy_tlb(void)
-{
-	struct mm_struct *mm = current->mm;
-	current->mm = NULL;
-	/* active_mm is still 'mm' */
-	atomic_inc(&mm->mm_count);
-	enter_lazy_tlb(mm, current, smp_processor_id());
-	return mm;
-}
-
-void end_lazy_tlb(struct mm_struct *mm)
-{
-	struct mm_struct *active_mm = current->active_mm;
-
-	current->mm = mm;
-	if (mm != active_mm) {
-		current->active_mm = mm;
-		activate_mm(active_mm, mm);
-	}
-	mmdrop(active_mm);
-}
-
-/*
  * Turn us into a lazy TLB process if we
  * aren't already..
  */
@@ -700,13 +669,19 @@
 
 	tsk->state = TASK_ZOMBIE;
 	/*
-	 * No need to unlock IRQs, we'll schedule() immediately
-	 * anyway. In the preemption case this also makes it
-	 * impossible for the task to get runnable again (thus
-	 * the "_raw_" unlock - to make sure we don't try to
-	 * preempt here).
+	 * 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().
+	 *
+	 * To avoid deadlock on SMP, interrupts must be unmasked.  If we
+	 * don't, subsequently called functions (e.g, wait_task_inactive()
+	 * via release_task()) will spin, with interrupt flags
+	 * unwittingly blocked, until the other task sleeps.  That task
+	 * may itself be waiting for smp_call_function() to answer and
+	 * complete, and with interrupts blocked that will never happen.
 	 */
 	_raw_write_unlock(&tasklist_lock);
+	local_irq_enable();
 }
 
 NORET_TYPE void do_exit(long code)
@@ -741,6 +716,7 @@
 	__exit_files(tsk);
 	__exit_fs(tsk);
 	exit_namespace(tsk);
+	exit_itimers(tsk);
 	exit_thread();
 
 	if (tsk->leader)
@@ -752,7 +728,6 @@
 
 	tsk->exit_code = code;
 	exit_notify(tsk);
-	preempt_disable();
 
 	if (tsk->exit_signal == -1)
 		release_task(tsk);
diff -Nru a/kernel/fork.c b/kernel/fork.c
--- a/kernel/fork.c	Sun Feb 23 22:25:22 2003
+++ b/kernel/fork.c	Sun Feb 23 22:25:22 2003
@@ -74,6 +74,19 @@
 
 void __put_task_struct(struct task_struct *tsk)
 {
+	WARN_ON(!(tsk->state & (TASK_DEAD | TASK_ZOMBIE)));
+	WARN_ON(atomic_read(&tsk->usage));
+	WARN_ON(tsk == current);
+
+	security_task_free(tsk);
+	free_uid(tsk->user);
+
+	/*
+	 * The task cache is effectively disabled right now.
+	 * Do we want it? The slab cache already has per-cpu
+	 * stuff, but the thread info (usually a order-1 page
+	 * allocation) doesn't.
+	 */
 	if (tsk != current) {
 		free_thread_info(tsk->thread_info);
 		kmem_cache_free(task_struct_cachep,tsk);
@@ -217,7 +230,9 @@
 	*tsk = *orig;
 	tsk->thread_info = ti;
 	ti->task = tsk;
-	atomic_set(&tsk->usage,1);
+
+	/* One for us, one for whoever does the "release_task()" (usually parent) */
+	atomic_set(&tsk->usage,2);
 	return tsk;
 }
 
@@ -813,6 +828,7 @@
 
 	INIT_LIST_HEAD(&p->children);
 	INIT_LIST_HEAD(&p->sibling);
+	INIT_LIST_HEAD(&p->posix_timers);
 	init_waitqueue_head(&p->wait_chldexit);
 	p->vfork_done = NULL;
 	spin_lock_init(&p->alloc_lock);
diff -Nru a/kernel/kmod.c b/kernel/kmod.c
--- a/kernel/kmod.c	Sun Feb 23 22:25:23 2003
+++ b/kernel/kmod.c	Sun Feb 23 22:25:23 2003
@@ -152,6 +152,14 @@
 	struct subprocess_info *sub_info = data;
 	int retval;
 
+	/* Unblock all signals. */
+	flush_signals(current);
+	spin_lock_irq(&current->sighand->siglock);
+	flush_signal_handlers(current);
+	sigemptyset(&current->blocked);
+	recalc_sigpending();
+	spin_unlock_irq(&current->sighand->siglock);
+
 	retval = -EPERM;
 	if (current->fs->root)
 		retval = execve(sub_info->path, sub_info->argv,sub_info->envp);
diff -Nru a/kernel/ksyms.c b/kernel/ksyms.c
--- a/kernel/ksyms.c	Sun Feb 23 22:25:21 2003
+++ b/kernel/ksyms.c	Sun Feb 23 22:25:21 2003
@@ -31,6 +31,7 @@
 #include <linux/genhd.h>
 #include <linux/blkpg.h>
 #include <linux/swap.h>
+#include <linux/pagevec.h>
 #include <linux/ctype.h>
 #include <linux/file.h>
 #include <linux/console.h>
@@ -80,6 +81,7 @@
 EXPORT_SYMBOL(__get_free_pages);
 EXPORT_SYMBOL(get_zeroed_page);
 EXPORT_SYMBOL(__page_cache_release);
+EXPORT_SYMBOL(__pagevec_lru_add);
 EXPORT_SYMBOL(__free_pages);
 EXPORT_SYMBOL(free_pages);
 EXPORT_SYMBOL(num_physpages);
diff -Nru a/kernel/pm.c b/kernel/pm.c
--- a/kernel/pm.c	Sun Feb 23 22:25:22 2003
+++ b/kernel/pm.c	Sun Feb 23 22:25:22 2003
@@ -17,7 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-
+#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/mm.h>
diff -Nru a/kernel/posix-timers.c b/kernel/posix-timers.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/kernel/posix-timers.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,1318 @@
+/*
+ * linux/kernel/posix_timers.c
+ *
+ * 
+ * 2002-10-15  Posix Clocks & timers by George Anzinger
+ *			     Copyright (C) 2002 by MontaVista Software.
+ */
+
+/* These are all the functions necessary to implement 
+ * POSIX clocks & timers
+ */
+
+#include <linux/mm.h>
+#include <linux/smp_lock.h>
+#include <linux/interrupt.h>
+#include <linux/slab.h>
+#include <linux/time.h>
+
+#include <asm/uaccess.h>
+#include <asm/semaphore.h>
+#include <linux/list.h>
+#include <linux/init.h>
+#include <linux/compiler.h>
+#include <linux/idr.h>
+#include <linux/posix-timers.h>
+
+#ifndef div_long_long_rem
+#include <asm/div64.h>
+
+#define div_long_long_rem(dividend,divisor,remainder) ({ \
+		       u64 result = dividend;		\
+		       *remainder = do_div(result,divisor); \
+		       result; })
+
+#endif				/* ifndef div_long_long_rem */
+
+/*
+ * Management arrays for POSIX timers.	 Timers are kept in slab memory
+ * Timer ids are allocated by an external routine that keeps track of the
+ * id and the timer.  The external interface is:
+ *
+ *void *idr_find(struct idr *idp, int id);           to find timer_id <id>
+ *int idr_get_new(struct idr *idp, void *ptr);       to get a new id and 
+ *                                                  related it to <ptr>
+ *void idr_remove(struct idr *idp, int id);          to release <id>
+ *void idr_init(struct idr *idp);                    to initialize <idp>
+ *                                                  which we supply.
+ * The idr_get_new *may* call slab for more memory so it must not be
+ * called under a spin lock.  Likewise idr_remore may release memory
+ * (but it may be ok to do this under a lock...).
+ * idr_find is just a memory look up and is quite fast.  A zero return
+ * indicates that the requested id does not exist.
+
+ */
+/*
+   * Lets keep our timers in a slab cache :-)
+ */
+static kmem_cache_t *posix_timers_cache;
+struct idr posix_timers_id;
+spinlock_t idr_lock = SPIN_LOCK_UNLOCKED;
+
+/*
+ * Just because the timer is not in the timer list does NOT mean it is
+ * inactive.  It could be in the "fire" routine getting a new expire time.
+ */
+#define TIMER_INACTIVE 1
+#define TIMER_RETRY 1
+#ifdef CONFIG_SMP
+#define timer_active(tmr) (tmr->it_timer.entry.prev != (void *)TIMER_INACTIVE)
+#define set_timer_inactive(tmr) tmr->it_timer.entry.prev = (void *)TIMER_INACTIVE
+#else
+#define timer_active(tmr) BARFY	// error to use outside of SMP
+#define set_timer_inactive(tmr)
+#endif
+/*
+ * The timer ID is turned into a timer address by idr_find().
+ * Verifying a valid ID consists of:
+ * 
+ * a) checking that idr_find() returns other than zero.
+ * b) checking that the timer id matches the one in the timer itself.
+ * c) that the timer owner is in the callers thread group.
+ */
+
+
+/* 
+ * CLOCKs: The POSIX standard calls for a couple of clocks and allows us
+ *	    to implement others.  This structure defines the various
+ *	    clocks and allows the possibility of adding others.	 We
+ *	    provide an interface to add clocks to the table and expect
+ *	    the "arch" code to add at least one clock that is high
+ *	    resolution.	 Here we define the standard CLOCK_REALTIME as a
+ *	    1/HZ resolution clock.
+
+ * CPUTIME & THREAD_CPUTIME: We are not, at this time, definding these
+ *	    two clocks (and the other process related clocks (Std
+ *	    1003.1d-1999).  The way these should be supported, we think,
+ *	    is to use large negative numbers for the two clocks that are
+ *	    pinned to the executing process and to use -pid for clocks
+ *	    pinned to particular pids.	Calls which supported these clock
+ *	    ids would split early in the function.
+ 
+ * RESOLUTION: Clock resolution is used to round up timer and interval
+ *	    times, NOT to report clock times, which are reported with as
+ *	    much resolution as the system can muster.  In some cases this
+ *	    resolution may depend on the underlaying clock hardware and
+ *	    may not be quantifiable until run time, and only then is the
+ *	    necessary code is written.	The standard says we should say
+ *	    something about this issue in the documentation...
+
+ * FUNCTIONS: The CLOCKs structure defines possible functions to handle
+ *	    various clock functions.  For clocks that use the standard
+ *	    system timer code these entries should be NULL.  This will
+ *	    allow dispatch without the overhead of indirect function
+ *	    calls.  CLOCKS that depend on other sources (e.g. WWV or GPS)
+ *	    must supply functions here, even if the function just returns
+ *	    ENOSYS.  The standard POSIX timer management code assumes the
+ *	    following: 1.) The k_itimer struct (sched.h) is used for the
+ *	    timer.  2.) The list, it_lock, it_clock, it_id and it_process
+ *	    fields are not modified by timer code. 
+ *
+ *          At this time all functions EXCEPT clock_nanosleep can be
+ *          redirected by the CLOCKS structure.  Clock_nanosleep is in
+ *          there, but the code ignors it.
+ *
+ * Permissions: It is assumed that the clock_settime() function defined
+ *	    for each clock will take care of permission checks.	 Some
+ *	    clocks may be set able by any user (i.e. local process
+ *	    clocks) others not.	 Currently the only set able clock we
+ *	    have is CLOCK_REALTIME and its high res counter part, both of
+ *	    which we beg off on and pass to do_sys_settimeofday().
+ */
+
+struct k_clock posix_clocks[MAX_CLOCKS];
+
+#define if_clock_do(clock_fun, alt_fun,parms)	(! clock_fun)? alt_fun parms :\
+							      clock_fun parms
+
+#define p_timer_get( clock,a,b) if_clock_do((clock)->timer_get, \
+					     do_timer_gettime,	 \
+					     (a,b))
+
+#define p_nsleep( clock,a,b,c) if_clock_do((clock)->nsleep,   \
+					    do_nsleep,	       \
+					    (a,b,c))
+
+#define p_timer_del( clock,a) if_clock_do((clock)->timer_del, \
+					   do_timer_delete,    \
+					   (a))
+
+void register_posix_clock(int clock_id, struct k_clock *new_clock);
+
+static int do_posix_gettime(struct k_clock *clock, struct timespec *tp);
+
+int do_posix_clock_monotonic_gettime(struct timespec *tp);
+
+int do_posix_clock_monotonic_settime(struct timespec *tp);
+static struct k_itimer *lock_timer(timer_t timer_id, unsigned long *flags);
+static inline void unlock_timer(struct k_itimer *timr, unsigned long flags);
+
+/* 
+ * Initialize everything, well, just everything in Posix clocks/timers ;)
+ */
+
+static __init int
+init_posix_timers(void)
+{
+	struct k_clock clock_realtime = {.res = NSEC_PER_SEC / HZ };
+	struct k_clock clock_monotonic = {.res = NSEC_PER_SEC / HZ,
+		.clock_get = do_posix_clock_monotonic_gettime,
+		.clock_set = do_posix_clock_monotonic_settime
+	};
+
+	register_posix_clock(CLOCK_REALTIME, &clock_realtime);
+	register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic);
+
+	posix_timers_cache = kmem_cache_create("posix_timers_cache",
+					       sizeof (struct k_itimer), 0, 0,
+					       0, 0);
+	idr_init(&posix_timers_id);
+	return 0;
+}
+
+__initcall(init_posix_timers);
+
+static inline int
+tstojiffie(struct timespec *tp, int res, unsigned long *jiff)
+{
+	unsigned long sec = tp->tv_sec;
+	long nsec = tp->tv_nsec + res - 1;
+
+	if (nsec > NSEC_PER_SEC) {
+		sec++;
+		nsec -= NSEC_PER_SEC;
+	}
+
+	/*
+	 * A note on jiffy overflow: It is possible for the system to
+	 * have been up long enough for the jiffies quanity to overflow.
+	 * In order for correct timer evaluations we require that the
+	 * specified time be somewhere between now and now + (max
+	 * unsigned int/2).  Times beyond this will be truncated back to
+	 * this value.   This is done in the absolute adjustment code,
+	 * below.  Here it is enough to just discard the high order
+	 * bits.  
+	 */
+	*jiff = HZ * sec;
+	/*
+	 * Do the res thing. (Don't forget the add in the declaration of nsec) 
+	 */
+	nsec -= nsec % res;
+	/*
+	 * Split to jiffie and sub jiffie
+	 */
+	*jiff += nsec / (NSEC_PER_SEC / HZ);
+	/*
+	 * We trust that the optimizer will use the remainder from the 
+	 * above div in the following operation as long as they are close. 
+	 */
+	return 0;
+}
+static void
+tstotimer(struct itimerspec *time, struct k_itimer *timer)
+{
+	int res = posix_clocks[timer->it_clock].res;
+	tstojiffie(&time->it_value, res, &timer->it_timer.expires);
+	tstojiffie(&time->it_interval, res, &timer->it_incr);
+}
+
+static void
+schedule_next_timer(struct k_itimer *timr)
+{
+	struct now_struct now;
+
+	/* Set up the timer for the next interval (if there is one) */
+	if (timr->it_incr == 0) {
+		{
+			set_timer_inactive(timr);
+			return;
+		}
+	}
+	posix_get_now(&now);
+	while (posix_time_before(&timr->it_timer, &now)) {
+		posix_bump_timer(timr);
+	};
+	timr->it_overrun_last = timr->it_overrun;
+	timr->it_overrun = -1;
+	timr->it_requeue_pending = 0;
+	add_timer(&timr->it_timer);
+}
+
+/*
+
+ * This function is exported for use by the signal deliver code.  It is
+ * called just prior to the info block being released and passes that
+ * block to us.  It's function is to update the overrun entry AND to
+ * restart the timer.  It should only be called if the timer is to be
+ * restarted (i.e. we have flagged this in the sys_private entry of the
+ * info block).
+ *
+ * To protect aginst the timer going away while the interrupt is queued,
+ * we require that the it_requeue_pending flag be set.
+
+ */
+void
+do_schedule_next_timer(struct siginfo *info)
+{
+
+	struct k_itimer *timr;
+	unsigned long flags;
+
+	timr = lock_timer(info->si_tid, &flags);
+
+	if (!timr || !timr->it_requeue_pending)
+		goto exit;
+
+	schedule_next_timer(timr);
+	info->si_overrun = timr->it_overrun_last;
+      exit:
+	if (timr)
+		unlock_timer(timr, flags);
+}
+
+/* 
+
+ * Notify the task and set up the timer for the next expiration (if
+ * applicable).  This function requires that the k_itimer structure
+ * it_lock is taken.  This code will requeue the timer only if we get
+ * either an error return or a flag (ret > 0) from send_seg_info
+ * indicating that the signal was either not queued or was queued
+ * without an info block.  In this case, we will not get a call back to
+ * do_schedule_next_timer() so we do it here.  This should be rare...
+
+ */
+
+static void
+timer_notify_task(struct k_itimer *timr)
+{
+	struct siginfo info;
+	int ret;
+
+	memset(&info, 0, sizeof (info));
+
+	/* Send signal to the process that owns this timer. */
+	info.si_signo = timr->it_sigev_signo;
+	info.si_errno = 0;
+	info.si_code = SI_TIMER;
+	info.si_tid = timr->it_id;
+	info.si_value = timr->it_sigev_value;
+	if (timr->it_incr == 0) {
+		set_timer_inactive(timr);
+	} else {
+		timr->it_requeue_pending = info.si_sys_private = 1;
+	}
+	ret = send_sig_info(info.si_signo, &info, timr->it_process);
+	switch (ret) {
+
+	default:
+		/*
+		 * Signal was not sent.  May or may not need to
+		 * restart the timer.
+		 */
+		printk(KERN_WARNING "sending signal failed: %d\n", ret);
+	case 1:
+		/*
+		 * signal was not sent because of sig_ignor or,
+		 * possibly no queue memory OR will be sent but,
+		 * we will not get a call back to restart it AND
+		 * it should be restarted. 
+		 */
+		schedule_next_timer(timr);
+	case 0:
+		/* 
+		 * all's well new signal queued
+		 */
+		break;
+	}
+}
+
+/*
+
+ * This function gets called when a POSIX.1b interval timer expires.  It
+ * is used as a callback from the kernel internal timer.  The
+ * run_timer_list code ALWAYS calls with interrutps on.
+
+ */
+static void
+posix_timer_fn(unsigned long __data)
+{
+	struct k_itimer *timr = (struct k_itimer *) __data;
+	unsigned long flags;
+
+	spin_lock_irqsave(&timr->it_lock, flags);
+	timer_notify_task(timr);
+	unlock_timer(timr, flags);
+}
+
+/*
+ * For some reason mips/mips64 define the SIGEV constants plus 128.  
+ * Here we define a mask to get rid of the common bits.	 The 
+ * optimizer should make this costless to all but mips.
+ */
+#if (ARCH == mips) || (ARCH == mips64)
+#define MIPS_SIGEV ~(SIGEV_NONE & \
+		      SIGEV_SIGNAL & \
+		      SIGEV_THREAD &  \
+		      SIGEV_THREAD_ID)
+#else
+#define MIPS_SIGEV (int)-1
+#endif
+
+static inline struct task_struct *
+good_sigevent(sigevent_t * event)
+{
+	struct task_struct *rtn = current;
+
+	if (event->sigev_notify & SIGEV_THREAD_ID & MIPS_SIGEV) {
+		if (!(rtn =
+		      find_task_by_pid(event->sigev_notify_thread_id)) ||
+		    rtn->tgid != current->tgid) {
+			return NULL;
+		}
+	}
+	if (event->sigev_notify & SIGEV_SIGNAL & MIPS_SIGEV) {
+		if ((unsigned) (event->sigev_signo > SIGRTMAX))
+			return NULL;
+	}
+	if (event->sigev_notify & ~(SIGEV_SIGNAL | SIGEV_THREAD_ID)) {
+		return NULL;
+	}
+	return rtn;
+}
+
+void
+register_posix_clock(int clock_id, struct k_clock *new_clock)
+{
+	if ((unsigned) clock_id >= MAX_CLOCKS) {
+		printk("POSIX clock register failed for clock_id %d\n",
+		       clock_id);
+		return;
+	}
+	posix_clocks[clock_id] = *new_clock;
+}
+
+static struct k_itimer *
+alloc_posix_timer(void)
+{
+	struct k_itimer *tmr;
+	tmr = kmem_cache_alloc(posix_timers_cache, GFP_KERNEL);
+	memset(tmr, 0, sizeof (struct k_itimer));
+	return (tmr);
+}
+
+static void
+release_posix_timer(struct k_itimer *tmr)
+{
+	if (tmr->it_id != -1){
+		spin_lock_irq(&idr_lock);
+		idr_remove(&posix_timers_id, tmr->it_id);
+		spin_unlock_irq(&idr_lock);
+	}
+	kmem_cache_free(posix_timers_cache, tmr);
+}
+
+/* Create a POSIX.1b interval timer. */
+
+asmlinkage int
+sys_timer_create(clockid_t which_clock,
+		 struct sigevent *timer_event_spec, timer_t * created_timer_id)
+{
+	int error = 0;
+	struct k_itimer *new_timer = NULL;
+	timer_t new_timer_id;
+	struct task_struct *process = 0;
+	sigevent_t event;
+
+	if ((unsigned) which_clock >= MAX_CLOCKS ||
+	    !posix_clocks[which_clock].res) return -EINVAL;
+
+	new_timer = alloc_posix_timer();
+	if (unlikely (new_timer == NULL))
+		return -EAGAIN;
+
+	spin_lock_init(&new_timer->it_lock);
+	do {
+		if ( unlikely ( !idr_pre_get(&posix_timers_id))){
+			error = -EAGAIN;
+			new_timer_id = (timer_t)-1;
+			goto out;			
+		}
+		spin_lock_irq(&idr_lock);
+		new_timer_id = (timer_t) idr_get_new(
+			&posix_timers_id, (void *) new_timer);
+		spin_unlock_irq(&idr_lock);
+	}while( unlikely (new_timer_id == -1));
+
+	new_timer->it_id = new_timer_id;
+	/*
+	 * return the timer_id now.  The next step is hard to 
+	 * back out if there is an error.
+	 */
+	if (copy_to_user(created_timer_id,
+			 &new_timer_id, sizeof (new_timer_id))) {
+		error = -EFAULT;
+		goto out;
+	}
+	if (timer_event_spec) {
+		if (copy_from_user(&event, timer_event_spec, sizeof (event))) {
+			error = -EFAULT;
+			goto out;
+		}
+		read_lock(&tasklist_lock);
+		if ((process = good_sigevent(&event))) {
+			/*
+
+			 * We may be setting up this process for another
+			 * thread.  It may be exitiing.  To catch this
+			 * case the we check the PF_EXITING flag.  If
+			 * the flag is not set, the task_lock will catch
+			 * him before it is too late (in exit_itimers).
+
+			 * The exec case is a bit more invloved but easy
+			 * to code.  If the process is in our thread
+			 * group (and it must be or we would not allow
+			 * it here) and is doing an exec, it will cause
+			 * us to be killed.  In this case it will wait
+			 * for us to die which means we can finish this
+			 * linkage with our last gasp. I.e. no code :)
+
+			 */
+			task_lock(process);
+			if (!(process->flags & PF_EXITING)) {
+				list_add(&new_timer->list,
+					 &process->posix_timers);
+				task_unlock(process);
+			} else {
+				task_unlock(process);
+				process = 0;
+			}
+		}
+		read_unlock(&tasklist_lock);
+		if (!process) {
+			error = -EINVAL;
+			goto out;
+		}
+		new_timer->it_sigev_notify = event.sigev_notify;
+		new_timer->it_sigev_signo = event.sigev_signo;
+		new_timer->it_sigev_value = event.sigev_value;
+	} else {
+		new_timer->it_sigev_notify = SIGEV_SIGNAL;
+		new_timer->it_sigev_signo = SIGALRM;
+		new_timer->it_sigev_value.sival_int = new_timer->it_id;
+		process = current;
+		task_lock(process);
+		list_add(&new_timer->list, &process->posix_timers);
+		task_unlock(process);
+	}
+
+	new_timer->it_clock = which_clock;
+	new_timer->it_incr = 0;
+	new_timer->it_overrun = -1;
+	init_timer(&new_timer->it_timer);
+	new_timer->it_timer.expires = 0;
+	new_timer->it_timer.data = (unsigned long) new_timer;
+	new_timer->it_timer.function = posix_timer_fn;
+	set_timer_inactive(new_timer);
+
+	/*
+	 * Once we set the process, it can be found so do it last...
+	 */
+	new_timer->it_process = process;
+
+      out:
+	if (error) {
+		release_posix_timer(new_timer);
+	}
+	return error;
+}
+
+/*
+ * good_timespec
+ *
+ * This function checks the elements of a timespec structure.
+ *
+ * Arguments:
+ * ts	     : Pointer to the timespec structure to check
+ *
+ * Return value: 
+ * If a NULL pointer was passed in, or the tv_nsec field was less than 0
+ * or greater than NSEC_PER_SEC, or the tv_sec field was less than 0,
+ * this function returns 0. Otherwise it returns 1.
+
+ */
+
+static int
+good_timespec(const struct timespec *ts)
+{
+	if ((ts == NULL) ||
+	    (ts->tv_sec < 0) ||
+	    ((unsigned) ts->tv_nsec >= NSEC_PER_SEC)) return 0;
+	return 1;
+}
+
+static inline void
+unlock_timer(struct k_itimer *timr, unsigned long flags)
+{
+	spin_unlock_irqrestore(&timr->it_lock, flags);
+}
+
+/*
+
+ * Locking issues: We need to protect the result of the id look up until
+ * we get the timer locked down so it is not deleted under us.  The
+ * removal is done under the idr spinlock so we use that here to bridge
+ * the find to the timer lock.  To avoid a dead lock, the timer id MUST
+ * be release with out holding the timer lock.
+
+ */
+static struct k_itimer *
+lock_timer(timer_t timer_id, unsigned long *flags)
+{
+	struct k_itimer *timr;
+	/*
+	 * Watch out here.  We do a irqsave on the idr_lock and pass the 
+	 * flags part over to the timer lock.  Must not let interrupts in
+	 * while we are moving the lock.
+	 */
+
+	spin_lock_irqsave(&idr_lock, *flags);
+	timr = (struct k_itimer *) idr_find(&posix_timers_id, (int) timer_id);
+	if (timr) {
+		spin_lock(&timr->it_lock);
+		spin_unlock(&idr_lock);
+
+		if ( (timr->it_id != timer_id) || !(timr->it_process) ||
+		     timr->it_process->tgid != current->tgid) {
+			unlock_timer(timr, *flags);
+			timr = NULL;
+		}
+	} else {
+		spin_unlock_irqrestore(&idr_lock, *flags);
+	}
+
+	return timr;
+}
+
+/* 
+
+ * Get the time remaining on a POSIX.1b interval timer.  This function
+ * is ALWAYS called with spin_lock_irq on the timer, thus it must not
+ * mess with irq.
+
+ * We have a couple of messes to clean up here.  First there is the case
+ * of a timer that has a requeue pending.  These timers should appear to
+ * be in the timer list with an expiry as if we were to requeue them
+ * now.
+
+ * The second issue is the SIGEV_NONE timer which may be active but is
+ * not really ever put in the timer list (to save system resources).
+ * This timer may be expired, and if so, we will do it here.  Otherwise
+ * it is the same as a requeue pending timer WRT to what we should
+ * report.
+
+ */
+void inline
+do_timer_gettime(struct k_itimer *timr, struct itimerspec *cur_setting)
+{
+	long sub_expires;
+	unsigned long expires;
+	struct now_struct now;
+
+	do {
+		expires = timr->it_timer.expires;
+	} while ((volatile long) (timr->it_timer.expires) != expires);
+
+	posix_get_now(&now);
+
+	if (expires && (timr->it_sigev_notify & SIGEV_NONE) && !timr->it_incr) {
+		if (posix_time_before(&timr->it_timer, &now)) {
+			timr->it_timer.expires = expires = 0;
+		}
+	}
+	if (expires) {
+		if (timr->it_requeue_pending ||
+		    (timr->it_sigev_notify & SIGEV_NONE)) {
+			while (posix_time_before(&timr->it_timer, &now)) {
+				posix_bump_timer(timr);
+			};
+		} else {
+			if (!timer_pending(&timr->it_timer)) {
+				sub_expires = expires = 0;
+			}
+		}
+		if (expires) {
+			expires -= now.jiffies;
+		}
+	}
+	jiffies_to_timespec(expires, &cur_setting->it_value);
+	jiffies_to_timespec(timr->it_incr, &cur_setting->it_interval);
+
+	if (cur_setting->it_value.tv_sec < 0) {
+		cur_setting->it_value.tv_nsec = 1;
+		cur_setting->it_value.tv_sec = 0;
+	}
+}
+/* Get the time remaining on a POSIX.1b interval timer. */
+asmlinkage int
+sys_timer_gettime(timer_t timer_id, struct itimerspec *setting)
+{
+	struct k_itimer *timr;
+	struct itimerspec cur_setting;
+	unsigned long flags;
+
+	timr = lock_timer(timer_id, &flags);
+	if (!timr)
+		return -EINVAL;
+
+	p_timer_get(&posix_clocks[timr->it_clock], timr, &cur_setting);
+
+	unlock_timer(timr, flags);
+
+	if (copy_to_user(setting, &cur_setting, sizeof (cur_setting)))
+		return -EFAULT;
+
+	return 0;
+}
+/*
+
+ * Get the number of overruns of a POSIX.1b interval timer.  This is to
+ * be the overrun of the timer last delivered.  At the same time we are
+ * accumulating overruns on the next timer.  The overrun is frozen when
+ * the signal is delivered, either at the notify time (if the info block
+ * is not queued) or at the actual delivery time (as we are informed by
+ * the call back to do_schedule_next_timer().  So all we need to do is
+ * to pick up the frozen overrun.
+
+ */
+
+asmlinkage int
+sys_timer_getoverrun(timer_t timer_id)
+{
+	struct k_itimer *timr;
+	int overrun;
+	long flags;
+
+	timr = lock_timer(timer_id, &flags);
+	if (!timr)
+		return -EINVAL;
+
+	overrun = timr->it_overrun_last;
+	unlock_timer(timr, flags);
+
+	return overrun;
+}
+/* Adjust for absolute time */
+/*
+ * If absolute time is given and it is not CLOCK_MONOTONIC, we need to
+ * adjust for the offset between the timer clock (CLOCK_MONOTONIC) and
+ * what ever clock he is using.
+ *
+ * If it is relative time, we need to add the current (CLOCK_MONOTONIC)
+ * time to it to get the proper time for the timer.
+ */
+static int
+adjust_abs_time(struct k_clock *clock, struct timespec *tp, int abs)
+{
+	struct timespec now;
+	struct timespec oc;
+	do_posix_clock_monotonic_gettime(&now);
+
+	if (abs &&
+	    (posix_clocks[CLOCK_MONOTONIC].clock_get == clock->clock_get)) {
+	} else {
+
+		if (abs) {
+			do_posix_gettime(clock, &oc);
+		} else {
+			oc.tv_nsec = oc.tv_sec = 0;
+		}
+		tp->tv_sec += now.tv_sec - oc.tv_sec;
+		tp->tv_nsec += now.tv_nsec - oc.tv_nsec;
+
+		/* 
+		 * Normalize...
+		 */
+		if ((tp->tv_nsec - NSEC_PER_SEC) >= 0) {
+			tp->tv_nsec -= NSEC_PER_SEC;
+			tp->tv_sec++;
+		}
+		if ((tp->tv_nsec) < 0) {
+			tp->tv_nsec += NSEC_PER_SEC;
+			tp->tv_sec--;
+		}
+	}
+	/*
+	 * Check if the requested time is prior to now (if so set now) or
+	 * is more than the timer code can handle (if so we error out).
+	 * The (unsigned) catches the case of prior to "now" with the same
+	 * test.  Only on failure do we sort out what happened, and then
+	 * we use the (unsigned) to error out negative seconds.
+	 */
+	if ((unsigned) (tp->tv_sec - now.tv_sec) > (MAX_JIFFY_OFFSET / HZ)) {
+		if ((unsigned) tp->tv_sec < now.tv_sec) {
+			tp->tv_sec = now.tv_sec;
+			tp->tv_nsec = now.tv_nsec;
+		} else {
+			// tp->tv_sec = now.tv_sec + (MAX_JIFFY_OFFSET / HZ);
+			/*
+			 * This is a considered response, not exactly in
+			 * line with the standard (in fact it is silent on
+			 * possible overflows).  We assume such a large 
+			 * value is ALMOST always a programming error and
+			 * try not to compound it by setting a really dumb
+			 * value.
+			 */
+			return -EINVAL;
+		}
+	}
+	return 0;
+}
+
+/* Set a POSIX.1b interval timer. */
+/* timr->it_lock is taken. */
+static inline int
+do_timer_settime(struct k_itimer *timr, int flags,
+		 struct itimerspec *new_setting, struct itimerspec *old_setting)
+{
+	struct k_clock *clock = &posix_clocks[timr->it_clock];
+
+	if (old_setting) {
+		do_timer_gettime(timr, old_setting);
+	}
+
+	/* disable the timer */
+	timr->it_incr = 0;
+	/* 
+	 * careful here.  If smp we could be in the "fire" routine which will
+	 * be spinning as we hold the lock.  But this is ONLY an SMP issue.
+	 */
+#ifdef CONFIG_SMP
+	if (timer_active(timr) && !del_timer(&timr->it_timer)) {
+		/*
+		 * It can only be active if on an other cpu.  Since
+		 * we have cleared the interval stuff above, it should
+		 * clear once we release the spin lock.  Of course once
+		 * we do that anything could happen, including the 
+		 * complete melt down of the timer.  So return with 
+		 * a "retry" exit status.
+		 */
+		return TIMER_RETRY;
+	}
+	set_timer_inactive(timr);
+#else
+	del_timer(&timr->it_timer);
+#endif
+	timr->it_requeue_pending = 0;
+	timr->it_overrun_last = 0;
+	timr->it_overrun = -1;
+	/* 
+	 *switch off the timer when it_value is zero 
+	 */
+	if ((new_setting->it_value.tv_sec == 0) &&
+	    (new_setting->it_value.tv_nsec == 0)) {
+		timr->it_timer.expires = 0;
+		return 0;
+	}
+
+	if ((flags & TIMER_ABSTIME) &&
+	    (clock->clock_get != do_posix_clock_monotonic_gettime)) {
+	}
+	if (adjust_abs_time(clock,
+			    &new_setting->it_value, flags & TIMER_ABSTIME)) {
+		return -EINVAL;
+	}
+	tstotimer(new_setting, timr);
+
+	/*
+	 * For some reason the timer does not fire immediately if expires is
+	 * equal to jiffies, so the timer notify function is called directly.
+	 * We do not even queue SIGEV_NONE timers!
+	 */
+	if (!(timr->it_sigev_notify & SIGEV_NONE)) {
+		if (timr->it_timer.expires == jiffies) {
+			timer_notify_task(timr);
+		} else
+			add_timer(&timr->it_timer);
+	}
+	return 0;
+}
+
+/* Set a POSIX.1b interval timer */
+asmlinkage int
+sys_timer_settime(timer_t timer_id, int flags,
+		  const struct itimerspec *new_setting,
+		  struct itimerspec *old_setting)
+{
+	struct k_itimer *timr;
+	struct itimerspec new_spec, old_spec;
+	int error = 0;
+	long flag;
+	struct itimerspec *rtn = old_setting ? &old_spec : NULL;
+
+	if (new_setting == NULL) {
+		return -EINVAL;
+	}
+
+	if (copy_from_user(&new_spec, new_setting, sizeof (new_spec))) {
+		return -EFAULT;
+	}
+
+	if ((!good_timespec(&new_spec.it_interval)) ||
+	    (!good_timespec(&new_spec.it_value))) {
+		return -EINVAL;
+	}
+      retry:
+	timr = lock_timer(timer_id, &flag);
+	if (!timr)
+		return -EINVAL;
+
+	if (!posix_clocks[timr->it_clock].timer_set) {
+		error = do_timer_settime(timr, flags, &new_spec, rtn);
+	} else {
+		error = posix_clocks[timr->it_clock].timer_set(timr,
+							       flags,
+							       &new_spec, rtn);
+	}
+	unlock_timer(timr, flag);
+	if (error == TIMER_RETRY) {
+		rtn = NULL;	// We already got the old time...
+		goto retry;
+	}
+
+	if (old_setting && !error) {
+		if (copy_to_user(old_setting, &old_spec, sizeof (old_spec))) {
+			error = -EFAULT;
+		}
+	}
+
+	return error;
+}
+
+static inline int
+do_timer_delete(struct k_itimer *timer)
+{
+	timer->it_incr = 0;
+#ifdef CONFIG_SMP
+	if (timer_active(timer) &&
+	    !del_timer(&timer->it_timer) && !timer->it_requeue_pending) {
+		/*
+		 * It can only be active if on an other cpu.  Since
+		 * we have cleared the interval stuff above, it should
+		 * clear once we release the spin lock.  Of course once
+		 * we do that anything could happen, including the 
+		 * complete melt down of the timer.  So return with 
+		 * a "retry" exit status.
+		 */
+		return TIMER_RETRY;
+	}
+#else
+	del_timer(&timer->it_timer);
+#endif
+	return 0;
+}
+
+/* Delete a POSIX.1b interval timer. */
+asmlinkage int
+sys_timer_delete(timer_t timer_id)
+{
+	struct k_itimer *timer;
+	long flags;
+
+#ifdef CONFIG_SMP
+	int error;
+      retry_delete:
+#endif
+
+	timer = lock_timer(timer_id, &flags);
+	if (!timer)
+		return -EINVAL;
+
+#ifdef CONFIG_SMP
+	error = p_timer_del(&posix_clocks[timer->it_clock], timer);
+
+	if (error == TIMER_RETRY) {
+		unlock_timer(timer, flags);
+		goto retry_delete;
+	}
+#else
+	p_timer_del(&posix_clocks[timer->it_clock], timer);
+#endif
+
+	task_lock(timer->it_process);
+
+	list_del(&timer->list);
+
+	task_unlock(timer->it_process);
+
+	/*
+	 * This keeps any tasks waiting on the spin lock from thinking
+	 * they got something (see the lock code above).
+	 */
+	timer->it_process = NULL;
+	unlock_timer(timer, flags);
+	release_posix_timer(timer);
+	return 0;
+}
+/*
+ * return  timer owned by the process, used by exit_itimers
+ */
+static inline void
+itimer_delete(struct k_itimer *timer)
+{
+	if (sys_timer_delete(timer->it_id)) {
+		BUG();
+	}
+}
+/*
+ * This is exported to exit and exec
+ */
+void
+exit_itimers(struct task_struct *tsk)
+{
+	struct k_itimer *tmr;
+
+	task_lock(tsk);
+	while (!list_empty(&tsk->posix_timers)) {
+		tmr = list_entry(tsk->posix_timers.next, struct k_itimer, list);
+		task_unlock(tsk);
+		itimer_delete(tmr);
+		task_lock(tsk);
+	}
+	task_unlock(tsk);
+}
+
+/*
+ * And now for the "clock" calls
+
+ * These functions are called both from timer functions (with the timer
+ * spin_lock_irq() held and from clock calls with no locking.	They must
+ * use the save flags versions of locks.
+ */
+static int
+do_posix_gettime(struct k_clock *clock, struct timespec *tp)
+{
+
+	if (clock->clock_get) {
+		return clock->clock_get(tp);
+	}
+
+	do_gettimeofday((struct timeval *) tp);
+	tp->tv_nsec *= NSEC_PER_USEC;
+	return 0;
+}
+
+/*
+ * We do ticks here to avoid the irq lock ( they take sooo long).
+ * The seqlock is great here.  Since we a reader, we don't really care
+ * if we are interrupted since we don't take lock that will stall us or 
+ * any other cpu. Voila, no irq lock is needed.
+
+ * Note also that the while loop assures that the sub_jiff_offset
+ * will be less than a jiffie, thus no need to normalize the result.
+ * Well, not really, if called with ints off :(
+ */
+
+int
+do_posix_clock_monotonic_gettime(struct timespec *tp)
+{
+	long sub_sec;
+	u64 jiffies_64_f;
+
+#if (BITS_PER_LONG > 32)
+
+	jiffies_64_f = jiffies_64;
+
+#else
+	unsigned int seq;
+
+	do {
+		seq = read_seqbegin(&xtime_lock);
+		jiffies_64_f = jiffies_64;
+
+	}while(  read_seqretry(&xtime_lock, seq));
+
+#endif
+	tp->tv_sec = div_long_long_rem(jiffies_64_f, HZ, &sub_sec);
+
+	tp->tv_nsec = sub_sec * (NSEC_PER_SEC / HZ);
+	return 0;
+}
+
+int
+do_posix_clock_monotonic_settime(struct timespec *tp)
+{
+	return -EINVAL;
+}
+
+asmlinkage int
+sys_clock_settime(clockid_t which_clock, const struct timespec *tp)
+{
+	struct timespec new_tp;
+
+	if ((unsigned) which_clock >= MAX_CLOCKS ||
+	    !posix_clocks[which_clock].res) return -EINVAL;
+	if (copy_from_user(&new_tp, tp, sizeof (*tp)))
+		return -EFAULT;
+	if (posix_clocks[which_clock].clock_set) {
+		return posix_clocks[which_clock].clock_set(&new_tp);
+	}
+	new_tp.tv_nsec /= NSEC_PER_USEC;
+	return do_sys_settimeofday((struct timeval *) &new_tp, NULL);
+}
+asmlinkage int
+sys_clock_gettime(clockid_t which_clock, struct timespec *tp)
+{
+	struct timespec rtn_tp;
+	int error = 0;
+
+	if ((unsigned) which_clock >= MAX_CLOCKS ||
+	    !posix_clocks[which_clock].res) return -EINVAL;
+
+	error = do_posix_gettime(&posix_clocks[which_clock], &rtn_tp);
+
+	if (!error) {
+		if (copy_to_user(tp, &rtn_tp, sizeof (rtn_tp))) {
+			error = -EFAULT;
+		}
+	}
+	return error;
+
+}
+asmlinkage int
+sys_clock_getres(clockid_t which_clock, struct timespec *tp)
+{
+	struct timespec rtn_tp;
+
+	if ((unsigned) which_clock >= MAX_CLOCKS ||
+	    !posix_clocks[which_clock].res) return -EINVAL;
+
+	rtn_tp.tv_sec = 0;
+	rtn_tp.tv_nsec = posix_clocks[which_clock].res;
+	if (tp) {
+		if (copy_to_user(tp, &rtn_tp, sizeof (rtn_tp))) {
+			return -EFAULT;
+		}
+	}
+	return 0;
+
+}
+static void
+nanosleep_wake_up(unsigned long __data)
+{
+	struct task_struct *p = (struct task_struct *) __data;
+
+	wake_up_process(p);
+}
+
+/*
+ * The standard says that an absolute nanosleep call MUST wake up at
+ * the requested time in spite of clock settings.  Here is what we do:
+ * For each nanosleep call that needs it (only absolute and not on 
+ * CLOCK_MONOTONIC* (as it can not be set)) we thread a little structure
+ * into the "nanosleep_abs_list".  All we need is the task_struct pointer.
+ * When ever the clock is set we just wake up all those tasks.	 The rest
+ * is done by the while loop in clock_nanosleep().
+
+ * On locking, clock_was_set() is called from update_wall_clock which 
+ * holds (or has held for it) a write_lock_irq( xtime_lock) and is 
+ * called from the timer bh code.  Thus we need the irq save locks.
+ */
+spinlock_t nanosleep_abs_list_lock = SPIN_LOCK_UNLOCKED;
+
+struct list_head nanosleep_abs_list = LIST_HEAD_INIT(nanosleep_abs_list);
+
+struct abs_struct {
+	struct list_head list;
+	struct task_struct *t;
+};
+
+void
+clock_was_set(void)
+{
+	struct list_head *pos;
+	unsigned long flags;
+
+	spin_lock_irqsave(&nanosleep_abs_list_lock, flags);
+	list_for_each(pos, &nanosleep_abs_list) {
+		wake_up_process(list_entry(pos, struct abs_struct, list)->t);
+	}
+	spin_unlock_irqrestore(&nanosleep_abs_list_lock, flags);
+}
+
+long clock_nanosleep_restart(struct restart_block *restart_block);
+
+extern long do_clock_nanosleep(clockid_t which_clock, int flags, 
+			       struct timespec *t);
+
+#ifdef FOLD_NANO_SLEEP_INTO_CLOCK_NANO_SLEEP
+
+asmlinkage long
+sys_nanosleep(struct timespec *rqtp, struct timespec *rmtp)
+{
+	struct timespec t;
+	long ret;
+
+	if (copy_from_user(&t, rqtp, sizeof (t)))
+		return -EFAULT;
+
+	if ((unsigned) t.tv_nsec >= NSEC_PER_SEC || t.tv_sec < 0)
+		return -EINVAL;
+
+	ret = do_clock_nanosleep(CLOCK_REALTIME, 0, &t);
+
+	if (ret == -ERESTART_RESTARTBLOCK && rmtp && 
+	    copy_to_user(rmtp, &t, sizeof (t)))
+			return -EFAULT;
+	return ret;
+}
+#endif				// ! FOLD_NANO_SLEEP_INTO_CLOCK_NANO_SLEEP
+
+asmlinkage long
+sys_clock_nanosleep(clockid_t which_clock, int flags,
+		    const struct timespec *rqtp, struct timespec *rmtp)
+{
+	struct timespec t;
+	int ret;
+
+	if ((unsigned) which_clock >= MAX_CLOCKS ||
+	    !posix_clocks[which_clock].res) return -EINVAL;
+
+	if (copy_from_user(&t, rqtp, sizeof (struct timespec)))
+		return -EFAULT;
+
+	if ((unsigned) t.tv_nsec >= NSEC_PER_SEC || t.tv_sec < 0)
+		return -EINVAL;
+
+	ret = do_clock_nanosleep(which_clock, flags, &t);
+
+	if ((ret == -ERESTART_RESTARTBLOCK) && rmtp && 
+	    copy_to_user(rmtp, &t, sizeof (t)))
+			return -EFAULT;
+	return ret;
+
+}
+
+long
+do_clock_nanosleep(clockid_t which_clock, int flags, struct timespec *tsave)
+{
+	struct timespec t;
+	struct timer_list new_timer;
+	struct abs_struct abs_struct = { list:{next:0} };
+	int abs;
+	int rtn = 0;
+	int active;
+	struct restart_block *restart_block =
+	    &current_thread_info()->restart_block;
+
+	init_timer(&new_timer);
+	new_timer.expires = 0;
+	new_timer.data = (unsigned long) current;
+	new_timer.function = nanosleep_wake_up;
+	abs = flags & TIMER_ABSTIME;
+
+	if (restart_block->fn == clock_nanosleep_restart) {
+		/*
+		 * Interrupted by a non-delivered signal, pick up remaining
+		 * time and continue.
+		 */
+		restart_block->fn = do_no_restart_syscall;
+		if (!restart_block->arg2)
+			return -EINTR;
+
+		new_timer.expires = restart_block->arg2;
+		if (time_before(new_timer.expires, jiffies))
+			return 0;
+	}
+
+	if (abs && (posix_clocks[which_clock].clock_get !=
+		    posix_clocks[CLOCK_MONOTONIC].clock_get)) {
+		spin_lock_irq(&nanosleep_abs_list_lock);
+		list_add(&abs_struct.list, &nanosleep_abs_list);
+		abs_struct.t = current;
+		spin_unlock_irq(&nanosleep_abs_list_lock);
+	}
+	do {
+		t = *tsave;
+		if ((abs || !new_timer.expires) &&
+		    !(rtn = adjust_abs_time(&posix_clocks[which_clock],
+					    &t, abs))) {
+			/*
+			 * On error, we don't set up the timer so
+			 * we don't arm the timer so
+			 * del_timer_sync() will return 0, thus
+			 * active is zero... and so it goes.
+			 */
+
+			tstojiffie(&t,
+				   posix_clocks[which_clock].res,
+				   &new_timer.expires);
+		}
+		if (new_timer.expires) {
+			current->state = TASK_INTERRUPTIBLE;
+			add_timer(&new_timer);
+
+			schedule();
+		}
+	}
+	while ((active = del_timer_sync(&new_timer)) &&
+	       !test_thread_flag(TIF_SIGPENDING));
+
+	if (abs_struct.list.next) {
+		spin_lock_irq(&nanosleep_abs_list_lock);
+		list_del(&abs_struct.list);
+		spin_unlock_irq(&nanosleep_abs_list_lock);
+	}
+	if (active) {
+		unsigned long jiffies_f = jiffies;
+
+		/*
+		 * Always restart abs calls from scratch to pick up any
+		 * clock shifting that happened while we are away.
+		 */
+		if (abs)
+			return -ERESTARTNOHAND;
+
+		jiffies_to_timespec(new_timer.expires - jiffies_f, tsave);
+
+		while (tsave->tv_nsec < 0) {
+			tsave->tv_nsec += NSEC_PER_SEC;
+			tsave->tv_sec--;
+		}
+		if (tsave->tv_sec < 0) {
+			tsave->tv_sec = 0;
+			tsave->tv_nsec = 1;
+		}
+		restart_block->fn = clock_nanosleep_restart;
+		restart_block->arg0 = which_clock;
+		restart_block->arg1 = (unsigned long)tsave;
+		restart_block->arg2 = new_timer.expires;
+		return -ERESTART_RESTARTBLOCK;
+	}
+
+	return rtn;
+}
+/*
+ * This will restart either clock_nanosleep or clock_nanosleep
+ */
+long
+clock_nanosleep_restart(struct restart_block *restart_block)
+{
+	struct timespec t;
+	int ret = do_clock_nanosleep(restart_block->arg0, 0, &t);
+
+	if ((ret == -ERESTART_RESTARTBLOCK) && restart_block->arg1 && 
+	    copy_to_user((struct timespec *)(restart_block->arg1), &t, 
+			 sizeof (t)))
+		return -EFAULT;
+	return ret;
+}
diff -Nru a/kernel/profile.c b/kernel/profile.c
--- a/kernel/profile.c	Sun Feb 23 22:25:26 2003
+++ b/kernel/profile.c	Sun Feb 23 22:25:26 2003
@@ -119,6 +119,39 @@
 	return err;
 }
 
+static struct notifier_block * profile_listeners;
+static rwlock_t profile_lock = RW_LOCK_UNLOCKED;
+ 
+int register_profile_notifier(struct notifier_block * nb)
+{
+	int err;
+	write_lock_irq(&profile_lock);
+	err = notifier_chain_register(&profile_listeners, nb);
+	write_unlock_irq(&profile_lock);
+	return err;
+}
+
+
+int unregister_profile_notifier(struct notifier_block * nb)
+{
+	int err;
+	write_lock_irq(&profile_lock);
+	err = notifier_chain_unregister(&profile_listeners, nb);
+	write_unlock_irq(&profile_lock);
+	return err;
+}
+
+
+void profile_hook(struct pt_regs * regs)
+{
+	read_lock(&profile_lock);
+	notifier_call_chain(&profile_listeners, 0, regs);
+	read_unlock(&profile_lock);
+}
+
+EXPORT_SYMBOL_GPL(register_profile_notifier);
+EXPORT_SYMBOL_GPL(unregister_profile_notifier);
+
 #endif /* CONFIG_PROFILING */
 
 EXPORT_SYMBOL_GPL(profile_event_register);
diff -Nru a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c	Sun Feb 23 22:25:26 2003
+++ b/kernel/sched.c	Sun Feb 23 22:25:26 2003
@@ -152,6 +152,7 @@
 	unsigned long nr_running, nr_switches, expired_timestamp,
 			nr_uninterruptible;
 	task_t *curr, *idle;
+	struct mm_struct *prev_mm;
 	prio_array_t *active, *expired, arrays[2];
 	int prev_nr_running[NR_CPUS];
 #ifdef CONFIG_NUMA
@@ -388,7 +389,10 @@
  * wait_task_inactive - wait for a thread to unschedule.
  *
  * The caller must ensure that the task *will* unschedule sometime soon,
- * else this function might spin for a *long* time.
+ * else this function might spin for a *long* time. This function can't
+ * be called with interrupts off, or it may introduce deadlock with
+ * smp_call_function() if an IPI is sent by the same process we are
+ * waiting to become inactive.
  */
 void wait_task_inactive(task_t * p)
 {
@@ -556,12 +560,39 @@
 }
 
 /**
+ * finish_task_switch - clean up after a task-switch
+ * @prev: the thread we just switched away from.
+ *
+ * We enter this with the runqueue still locked, and finish_arch_switch()
+ * will unlock it along with doing any other architecture-specific cleanup
+ * actions.
+ *
+ * Note that we may have delayed dropping an mm in context_switch(). If
+ * so, we finish that here outside of the runqueue lock.  (Doing it
+ * with the lock held can cause deadlocks; see schedule() for
+ * details.)
+ */
+static inline void finish_task_switch(task_t *prev)
+{
+	runqueue_t *rq = this_rq();
+	struct mm_struct *mm = rq->prev_mm;
+
+	rq->prev_mm = NULL;
+	finish_arch_switch(rq, prev);
+	if (mm)
+		mmdrop(mm);
+	if (prev->state & (TASK_DEAD | TASK_ZOMBIE))
+		put_task_struct(prev);
+}
+
+/**
  * schedule_tail - first thing a freshly forked thread must call.
  * @prev: the thread we just switched away from.
  */
 asmlinkage void schedule_tail(task_t *prev)
 {
-	finish_arch_switch(this_rq(), prev);
+	finish_task_switch(prev);
+
 	if (current->set_child_tid)
 		put_user(current->pid, current->set_child_tid);
 }
@@ -570,7 +601,7 @@
  * context_switch - switch to the new MM and the new
  * thread's register state.
  */
-static inline task_t * context_switch(task_t *prev, task_t *next)
+static inline task_t * context_switch(runqueue_t *rq, task_t *prev, task_t *next)
 {
 	struct mm_struct *mm = next->mm;
 	struct mm_struct *oldmm = prev->active_mm;
@@ -584,7 +615,8 @@
 
 	if (unlikely(!prev->mm)) {
 		prev->active_mm = NULL;
-		mmdrop(oldmm);
+		WARN_ON(rq->prev_mm);
+		rq->prev_mm = oldmm;
 	}
 
 	/* Here we just switch the register state and the stack. */
@@ -1155,7 +1187,7 @@
 	 * schedule() atomically, we ignore that path for now.
 	 * Otherwise, whine if we are scheduling when we should not be.
 	 */
-	if (likely(current->state != TASK_ZOMBIE)) {
+	if (likely(!(current->state & (TASK_DEAD | TASK_ZOMBIE)))) {
 		if (unlikely(in_atomic())) {
 			printk(KERN_ERR "bad: scheduling while atomic!\n");
 			dump_stack();
@@ -1227,10 +1259,10 @@
 		rq->curr = next;
 	
 		prepare_arch_switch(rq, next);
-		prev = context_switch(prev, next);
+		prev = context_switch(rq, prev, next);
 		barrier();
-		rq = this_rq();
-		finish_arch_switch(rq, prev);
+
+		finish_task_switch(prev);
 	} else
 		spin_unlock_irq(&rq->lock);
 
diff -Nru a/kernel/signal.c b/kernel/signal.c
--- a/kernel/signal.c	Sun Feb 23 22:25:23 2003
+++ b/kernel/signal.c	Sun Feb 23 22:25:23 2003
@@ -472,8 +472,6 @@
 		if (!collect_signal(sig, pending, info))
 			sig = 0;
 				
-		/* XXX: Once POSIX.1b timers are in, if si_code == SI_TIMER,
-		   we need to xchg out the timer overrun values.  */
 	}
 	recalc_sigpending();
 
@@ -492,6 +490,11 @@
 	if (!signr)
 		signr = __dequeue_signal(&tsk->signal->shared_pending,
 					 mask, info);
+	if ( signr &&
+	     ((info->si_code & __SI_MASK) == __SI_TIMER) &&
+	     info->si_sys_private){
+		do_schedule_next_timer(info);
+	}
 	return signr;
 }
 
@@ -677,6 +680,7 @@
 static int send_signal(int sig, struct siginfo *info, struct sigpending *signals)
 {
 	struct sigqueue * q = NULL;
+	int ret = 0;
 
 	/*
 	 * fast-pathed signals for kernel-internal things like SIGSTOP
@@ -720,17 +724,25 @@
 			copy_siginfo(&q->info, info);
 			break;
 		}
-	} else if (sig >= SIGRTMIN && info && (unsigned long)info != 1
+	} else {
+		if (sig >= SIGRTMIN && info && (unsigned long)info != 1
 		   && info->si_code != SI_USER)
 		/*
 		 * Queue overflow, abort.  We may abort if the signal was rt
 		 * and sent by user using something other than kill().
 		 */
-		return -EAGAIN;
+			return -EAGAIN;
+		if (((unsigned long)info > 1) && (info->si_code == SI_TIMER))
+			/*
+			 * Set up a return to indicate that we dropped 
+			 * the signal.
+			 */
+			ret = info->si_sys_private;
+	}
 
 out_set:
 	sigaddset(&signals->signal, sig);
-	return 0;
+	return ret;
 }
 
 #define LEGACY_QUEUE(sigptr, sig) \
@@ -740,7 +752,7 @@
 static int
 specific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t)
 {
-	int ret;
+	int ret = 0;
 
 	if (!irqs_disabled())
 		BUG();
@@ -749,20 +761,26 @@
 		BUG();
 #endif
 
+	if (((unsigned long)info > 2) && (info->si_code == SI_TIMER))
+		/*
+		 * Set up a return to indicate that we dropped the signal.
+		 */
+		ret = info->si_sys_private;
+
 	/* Short-circuit ignored signals.  */
 	if (sig_ignored(t, sig))
-		return 0;
+		goto out;
 
 	/* Support queueing exactly one non-rt signal, so that we
 	   can get more detailed information about the cause of
 	   the signal. */
 	if (LEGACY_QUEUE(&t->pending, sig))
-		return 0;
+		goto out;
 
 	ret = send_signal(sig, info, &t->pending);
 	if (!ret && !sigismember(&t->blocked, sig))
 		signal_wake_up(t, sig == SIGKILL);
-
+out:
 	return ret;
 }
 
@@ -821,7 +839,7 @@
 {
 	struct task_struct *t;
 	unsigned int mask;
-	int ret;
+	int ret = 0;
 
 #if CONFIG_SMP
 	if (!spin_is_locked(&p->sighand->siglock))
@@ -829,13 +847,19 @@
 #endif
 	handle_stop_signal(sig, p);
 
+	if (((unsigned long)info > 2) && (info->si_code == SI_TIMER))
+		/*
+		 * Set up a return to indicate that we dropped the signal.
+		 */
+		ret = info->si_sys_private;
+
 	/* Short-circuit ignored signals.  */
 	if (sig_ignored(p, sig))
-		return 0;
+		return ret;
 
 	if (LEGACY_QUEUE(&p->signal->shared_pending, sig))
 		/* This is a non-RT signal and we already have one queued.  */
-		return 0;
+		return ret;
 
 	/*
 	 * Don't bother zombies and stopped tasks (but
@@ -1753,8 +1777,9 @@
 		err |= __put_user(from->si_uid, &to->si_uid);
 		break;
 	case __SI_TIMER:
-		err |= __put_user(from->si_timer1, &to->si_timer1);
-		err |= __put_user(from->si_timer2, &to->si_timer2);
+		 err |= __put_user(from->si_tid, &to->si_tid);
+		 err |= __put_user(from->si_overrun, &to->si_overrun);
+		 err |= __put_user(from->si_ptr, &to->si_ptr);
 		break;
 	case __SI_POLL:
 		err |= __put_user(from->si_band, &to->si_band);
diff -Nru a/kernel/timer.c b/kernel/timer.c
--- a/kernel/timer.c	Sun Feb 23 22:25:26 2003
+++ b/kernel/timer.c	Sun Feb 23 22:25:26 2003
@@ -31,6 +31,7 @@
 
 #include <asm/uaccess.h>
 #include <asm/div64.h>
+#include <asm/timex.h>
 
 /*
  * per-CPU timer vector definitions:
@@ -52,12 +53,11 @@
 	struct list_head vec[TVR_SIZE];
 } tvec_root_t;
 
-typedef struct timer_list timer_t;
 
 struct tvec_t_base_s {
 	spinlock_t lock;
 	unsigned long timer_jiffies;
-	timer_t *running_timer;
+	struct timer_list *running_timer;
 	tvec_root_t tv1;
 	tvec_t tv2;
 	tvec_t tv3;
@@ -70,7 +70,7 @@
 /* Fake initialization */
 static DEFINE_PER_CPU(tvec_base_t, tvec_bases) = { SPIN_LOCK_UNLOCKED };
 
-static void check_timer_failed(timer_t *timer)
+static void check_timer_failed(struct timer_list *timer)
 {
 	static int whine_count;
 	if (whine_count < 16) {
@@ -88,13 +88,13 @@
 	timer->magic = TIMER_MAGIC;
 }
 
-static inline void check_timer(timer_t *timer)
+static inline void check_timer(struct timer_list *timer)
 {
 	if (timer->magic != TIMER_MAGIC)
 		check_timer_failed(timer);
 }
 
-static inline void internal_add_timer(tvec_base_t *base, timer_t *timer)
+static inline void internal_add_timer(tvec_base_t *base, struct timer_list *timer)
 {
 	unsigned long expires = timer->expires;
 	unsigned long idx = expires - base->timer_jiffies;
@@ -146,7 +146,7 @@
  * Timers with an ->expired field in the past will be executed in the next
  * timer tick. It's illegal to add an already pending timer.
  */
-void add_timer(timer_t *timer)
+void add_timer(struct timer_list *timer)
 {
 	int cpu = get_cpu();
 	tvec_base_t *base = &per_cpu(tvec_bases, cpu);
@@ -204,7 +204,7 @@
  * (ie. mod_timer() of an inactive timer returns 0, mod_timer() of an
  * active timer returns 1.)
  */
-int mod_timer(timer_t *timer, unsigned long expires)
+int mod_timer(struct timer_list *timer, unsigned long expires)
 {
 	tvec_base_t *old_base, *new_base;
 	unsigned long flags;
@@ -281,7 +281,7 @@
  * (ie. del_timer() of an inactive timer returns 0, del_timer() of an
  * active timer returns 1.)
  */
-int del_timer(timer_t *timer)
+int del_timer(struct timer_list *timer)
 {
 	unsigned long flags;
 	tvec_base_t *base;
@@ -320,7 +320,7 @@
  *
  * The function returns whether it has deactivated a pending timer or not.
  */
-int del_timer_sync(timer_t *timer)
+int del_timer_sync(struct timer_list *timer)
 {
 	tvec_base_t *base;
 	int i, ret = 0;
@@ -363,9 +363,9 @@
 	 * detach them individually, just clear the list afterwards.
 	 */
 	while (curr != head) {
-		timer_t *tmp;
+		struct timer_list *tmp;
 
-		tmp = list_entry(curr, timer_t, entry);
+		tmp = list_entry(curr, struct timer_list, entry);
 		if (tmp->base != base)
 			BUG();
 		next = curr->next;
@@ -404,9 +404,9 @@
 		if (curr != head) {
 			void (*fn)(unsigned long);
 			unsigned long data;
-			timer_t *timer;
+			struct timer_list *timer;
 
-			timer = list_entry(curr, timer_t, entry);
+			timer = list_entry(curr, struct timer_list, entry);
  			fn = timer->function;
  			data = timer->data;
 
@@ -508,6 +508,7 @@
 	if (xtime.tv_sec % 86400 == 0) {
 	    xtime.tv_sec--;
 	    time_state = TIME_OOP;
+	    clock_was_set();
 	    printk(KERN_NOTICE "Clock: inserting leap second 23:59:60 UTC\n");
 	}
 	break;
@@ -516,6 +517,7 @@
 	if ((xtime.tv_sec + 1) % 86400 == 0) {
 	    xtime.tv_sec++;
 	    time_state = TIME_WAIT;
+	    clock_was_set();
 	    printk(KERN_NOTICE "Clock: deleting leap second 23:59:59 UTC\n");
 	}
 	break;
@@ -761,7 +763,9 @@
  * This read-write spinlock protects us from races in SMP while
  * playing with xtime and avenrun.
  */
+#ifndef ARCH_HAVE_XTIME_LOCK
 seqlock_t xtime_lock __cacheline_aligned_in_smp = SEQLOCK_UNLOCKED;
+#endif
 unsigned long last_time_offset;
 
 /*
@@ -968,7 +972,7 @@
  */
 signed long schedule_timeout(signed long timeout)
 {
-	timer_t timer;
+	struct timer_list timer;
 	unsigned long expire;
 
 	switch (timeout)
@@ -1023,6 +1027,7 @@
 {
 	return current->pid;
 }
+#ifndef FOLD_NANO_SLEEP_INTO_CLOCK_NANO_SLEEP
 
 static long nanosleep_restart(struct restart_block *restart)
 {
@@ -1081,6 +1086,7 @@
 	}
 	return ret;
 }
+#endif // ! FOLD_NANO_SLEEP_INTO_CLOCK_NANO_SLEEP
 
 /*
  * sys_sysinfo - fill in sysinfo struct
diff -Nru a/lib/Makefile b/lib/Makefile
--- a/lib/Makefile	Sun Feb 23 22:25:21 2003
+++ b/lib/Makefile	Sun Feb 23 22:25:21 2003
@@ -10,7 +10,7 @@
 
 obj-y := errno.o ctype.o string.o vsprintf.o brlock.o cmdline.o \
 	 bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \
-	 kobject.o
+	 kobject.o idr.o
 
 obj-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
 obj-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
@@ -25,7 +25,7 @@
 obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/
 
 include $(TOPDIR)/drivers/net/Makefile.lib
-include $(TOPDIR)/drivers/usb/class/Makefile.lib
+include $(TOPDIR)/drivers/usb/Makefile.lib
 include $(TOPDIR)/fs/Makefile.lib
 include $(TOPDIR)/net/bluetooth/bnep/Makefile.lib
 
diff -Nru a/lib/idr.c b/lib/idr.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/lib/idr.c	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,342 @@
+/*
+ * linux/kernel/id.c
+ *
+ * 2002-10-18  written by Jim Houston jim.houston@ccur.com
+ *	Copyright (C) 2002 by Concurrent Computer Corporation
+ *	Distributed under the GNU GPL license version 2.
+ *
+ * Small id to pointer translation service.  
+ *
+ * It uses a radix tree like structure as a sparse array indexed 
+ * by the id to obtain the pointer.  The bitmap makes allocating
+ * a new id quick.  
+
+ * Modified by George Anzinger to reuse immediately and to use
+ * find bit instructions.  Also removed _irq on spinlocks.
+
+ * So here is what this bit of code does:
+
+ * You call it to allocate an id (an int) an associate with that id a
+ * pointer or what ever, we treat it as a (void *).  You can pass this
+ * id to a user for him to pass back at a later time.  You then pass
+ * that id to this code and it returns your pointer.
+
+ * You can release ids at any time. When all ids are released, most of 
+ * the memory is returned (we keep IDR_FREE_MAX) in a local pool so we
+ * don't need to go to the memory "store" during an id allocate, just 
+ * so you don't need to be too concerned about locking and conflicts
+ * with the slab allocator.
+
+ * A word on reuse.  We reuse empty id slots as soon as we can, always
+ * using the lowest one available.  But we also merge a counter in the
+ * high bits of the id.  The counter is RESERVED_ID_BITS (8 at this time)
+ * long.  This means that if you allocate and release the same id in a 
+ * loop we will reuse an id after about 256 times around the loop.  The
+ * word about is used here as we will NOT return a valid id of -1 so if
+ * you loop on the largest possible id (and that is 24 bits, wow!) we
+ * will kick the counter to avoid -1.  (Paranoid?  You bet!)
+ *
+ * What you need to do is, since we don't keep the counter as part of
+ * id / ptr pair, to keep a copy of it in the pointed to structure
+ * (or else where) so that when you ask for a ptr you can varify that
+ * the returned ptr is correct by comparing the id it contains with the one
+ * you asked for.  In other words, we only did half the reuse protection.
+ * Since the code depends on your code doing this check, we ignore high
+ * order bits in the id, not just the count, but bits that would, if used,
+ * index outside of the allocated ids.  In other words, if the largest id
+ * currently allocated is 32 a look up will only look at the low 5 bits of
+ * the id.  Since you will want to keep this id in the structure anyway
+ * (if for no other reason than to be able to eliminate the id when the
+ * structure is found in some other way) this seems reasonable.  If you
+ * really think otherwise, the code to check these bits here, it is just
+ * disabled with a #if 0.
+
+
+ * So here are the complete details:
+
+ *  include <linux/idr.h>
+
+ * void idr_init(struct idr *idp)
+
+ *   This function is use to set up the handle (idp) that you will pass
+ *   to the rest of the functions.  The structure is defined in the
+ *   header.
+
+ * int idr_pre_get(struct idr *idp)
+
+ *   This function should be called prior to locking and calling the
+ *   following function.  It pre allocates enough memory to satisfy the
+ *   worst possible allocation.  It can sleep, so must not be called
+ *   with any spinlocks held.  If the system is REALLY out of memory
+ *   this function returns 0, other wise 1.
+
+ * int idr_get_new(struct idr *idp, void *ptr);
+ 
+ *   This is the allocate id function.  It should be called with any
+ *   required locks.  In fact, in the SMP case, you MUST lock prior to
+ *   calling this function to avoid possible out of memory problems.  If
+ *   memory is required, it will return a -1, in which case you should
+ *   unlock and go back to the idr_pre_get() call.  ptr is the pointer
+ *   you want associated with the id.  In other words:
+
+ * void *idr_find(struct idr *idp, int id);
+ 
+ *   returns the "ptr", given the id.  A NULL return indicates that the
+ *   id is not valid (or you passed NULL in the idr_get_new(), shame on
+ *   you).  This function must be called with a spinlock that prevents
+ *   calling either idr_get_new() or idr_remove() or idr_find() while it
+ *   is working.
+
+ * void idr_remove(struct idr *idp, int id);
+
+ *   removes the given id, freeing that slot and any memory that may
+ *   now be unused.  See idr_find() for locking restrictions.
+
+ */
+
+
+
+#ifndef TEST                        // to test in user space...
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#endif
+#include <linux/string.h>
+#include <linux/idr.h>
+
+
+static kmem_cache_t *idr_layer_cache;
+
+
+
+static inline struct idr_layer *alloc_layer(struct idr *idp)
+{
+	struct idr_layer *p;
+
+	spin_lock(&idp->lock);
+	if (!(p = idp->id_free))
+		BUG();
+	idp->id_free = p->ary[0];
+	idp->id_free_cnt--;
+	p->ary[0] = 0;
+	spin_unlock(&idp->lock);
+	return(p);
+}
+
+static inline void free_layer(struct idr *idp, struct idr_layer *p)
+{
+	/*
+	 * Depends on the return element being zeroed.
+	 */
+	spin_lock(&idp->lock);
+	p->ary[0] = idp->id_free;
+	idp->id_free = p;
+	idp->id_free_cnt++;
+	spin_unlock(&idp->lock);
+}
+
+int idr_pre_get(struct idr *idp)
+{
+	while (idp->id_free_cnt < idp->layers + 1) {
+		struct idr_layer *new;
+		new = kmem_cache_alloc(idr_layer_cache, GFP_KERNEL);
+		if(new == NULL)
+			return (0);
+		free_layer(idp, new);
+	}
+	return 1;
+}
+EXPORT_SYMBOL(idr_pre_get);
+
+static inline int sub_alloc(struct idr *idp, int shift, void *ptr)
+{
+	long n, v = 0;
+	struct idr_layer *p;
+	struct idr_layer **pa[MAX_LEVEL];
+	struct idr_layer ***paa = &pa[0];
+	
+	*paa = NULL;
+	*++paa = &idp->top;
+
+	/*
+	 * By keeping each pointer in an array we can do the 
+	 * "after" recursion processing.  In this case, that means
+	 * we can update the upper level bit map.
+	 */
+	
+	while (1){
+		p = **paa;
+		n = ffz(p->bitmap);
+		if (shift){
+			/*
+			 * We run around this while until we
+			 * reach the leaf node...
+			 */
+			if (!p->ary[n]){
+				/*
+				 * If no node, allocate one, AFTER
+				 * we insure that we will not
+				 * intrude on the reserved bit field.
+				 */
+				if ((n << shift) >= MAX_ID_BIT)
+					return -1;
+				p->ary[n] = alloc_layer(idp);
+				p->count++;
+			}
+			*++paa = &p->ary[n];
+			v += (n << shift);
+			shift -= IDR_BITS;
+		} else {
+			/*
+			 * We have reached the leaf node, plant the
+			 * users pointer and return the raw id.
+			 */
+			p->ary[n] = (struct idr_layer *)ptr;
+			__set_bit(n, &p->bitmap);
+			v += n;
+			p->count++;
+			/*
+			 * This is the post recursion processing.  Once
+			 * we find a bitmap that is not full we are
+			 * done
+			 */
+			while (*(paa-1) && (**paa)->bitmap == IDR_FULL){
+				n = *paa - &(**(paa-1))->ary[0];
+				__set_bit(n, &(**--paa)->bitmap);
+			}
+			return(v);
+		}
+	}
+}
+
+int idr_get_new(struct idr *idp, void *ptr)
+{
+	long v;
+	
+	if (idp->id_free_cnt < idp->layers + 1) 
+		return (-1);
+	/*
+	 * Add a new layer if the array is full 
+	 */
+	if (unlikely(!idp->top || idp->top->bitmap == IDR_FULL)){
+		/*
+		 * This is a bit different than the lower layers because
+		 * we have one branch already allocated and full.
+		 */
+		struct idr_layer *new = alloc_layer(idp);
+		new->ary[0] = idp->top;
+		if ( idp->top)
+			++new->count;
+		idp->top = new;
+		if ( idp->layers++ )
+			__set_bit(0, &new->bitmap);
+	}
+	v = sub_alloc(idp,  (idp->layers - 1) * IDR_BITS, ptr);
+	if ( likely(v >= 0 )){
+		idp->count++;
+		v += (idp->count << MAX_ID_SHIFT);
+		if ( unlikely( v == -1 ))
+		     v += (1L << MAX_ID_SHIFT);
+	}
+	return(v);
+}
+EXPORT_SYMBOL(idr_get_new);
+
+
+static inline void sub_remove(struct idr *idp, int shift, int id)
+{
+	struct idr_layer *p = idp->top;
+	struct idr_layer **pa[MAX_LEVEL];
+	struct idr_layer ***paa = &pa[0];
+
+	*paa = NULL;
+	*++paa = &idp->top;
+
+	while ((shift > 0) && p) {
+		int n = (id >> shift) & IDR_MASK;
+		__clear_bit(n, &p->bitmap);
+		*++paa = &p->ary[n];
+		p = p->ary[n];
+		shift -= IDR_BITS;
+	}
+	if (likely(p != NULL)){
+		int n = id & IDR_MASK;
+		__clear_bit(n, &p->bitmap);
+		p->ary[n] = NULL;
+		while(*paa && ! --((**paa)->count)){
+			free_layer(idp, **paa);
+			**paa-- = NULL;
+		}
+		if ( ! *paa )
+			idp->layers = 0;
+	}
+}
+void idr_remove(struct idr *idp, int id)
+{
+	struct idr_layer *p;
+
+	sub_remove(idp, (idp->layers - 1) * IDR_BITS, id);
+	if ( idp->top && idp->top->count == 1 && 
+	     (idp->layers > 1) &&
+	     idp->top->ary[0]){  // We can drop a layer
+
+		p = idp->top->ary[0];
+		idp->top->bitmap = idp->top->count = 0;
+		free_layer(idp, idp->top);
+		idp->top = p;
+		--idp->layers;
+	}
+	while (idp->id_free_cnt >= IDR_FREE_MAX) {
+		
+		p = alloc_layer(idp);
+		kmem_cache_free(idr_layer_cache, p);
+		return;
+	}
+}
+EXPORT_SYMBOL(idr_remove);
+
+void *idr_find(struct idr *idp, int id)
+{
+	int n;
+	struct idr_layer *p;
+
+	n = idp->layers * IDR_BITS;
+	p = idp->top;
+#if 0
+	/*
+	 * This tests to see if bits outside the current tree are
+	 * present.  If so, tain't one of ours!
+	 */
+	if ( unlikely( (id & ~(~0 << MAX_ID_SHIFT)) >> (n + IDR_BITS)))
+	     return NULL;
+#endif
+	while (n > 0 && p) {
+		n -= IDR_BITS;
+		p = p->ary[(id >> n) & IDR_MASK];
+	}
+	return((void *)p);
+}
+EXPORT_SYMBOL(idr_find);
+
+static void idr_cache_ctor(void * idr_layer, 
+			   kmem_cache_t *idr_layer_cache, unsigned long flags)
+{
+	memset(idr_layer, 0, sizeof(struct idr_layer));
+}
+
+static  int init_id_cache(void)
+{
+	if (!idr_layer_cache)
+		idr_layer_cache = kmem_cache_create("idr_layer_cache", 
+			sizeof(struct idr_layer), 0, 0, idr_cache_ctor, 0);
+	return 0;
+}
+
+void idr_init(struct idr *idp)
+{
+	init_id_cache();
+	memset(idp, 0, sizeof(struct idr));
+	spin_lock_init(&idp->lock);
+}
+EXPORT_SYMBOL(idr_init);
+
diff -Nru a/mm/filemap.c b/mm/filemap.c
--- a/mm/filemap.c	Sun Feb 23 22:25:23 2003
+++ b/mm/filemap.c	Sun Feb 23 22:25:23 2003
@@ -225,6 +225,7 @@
 	}
 	return error;
 }
+EXPORT_SYMBOL(add_to_page_cache);
 
 int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
 				pgoff_t offset, int gfp_mask)
diff -Nru a/mm/slab.c b/mm/slab.c
--- a/mm/slab.c	Sun Feb 23 22:25:25 2003
+++ b/mm/slab.c	Sun Feb 23 22:25:25 2003
@@ -2194,10 +2194,19 @@
 	struct list_head *p;
 
 	down(&cache_chain_sem);
-	if (!n)
-		return (void *)1;
+	if (!n) {
+		/*
+		 * Output format version, so at least we can change it
+		 * without _too_ many complaints.
+		 */
+		seq_puts(m, "slabinfo - version: 1.2"
+#if STATS
+				" (statistics)"
+#endif
+				"\n");
+	}
 	p = cache_chain.next;
-	while (--n) {
+	while (n--) {
 		p = p->next;
 		if (p == &cache_chain)
 			return NULL;
@@ -2209,8 +2218,6 @@
 {
 	kmem_cache_t *cachep = p;
 	++*pos;
-	if (p == (void *)1)
-		return list_entry(cache_chain.next, kmem_cache_t, next);
 	return cachep->next.next == &cache_chain ? NULL
 		: list_entry(cachep->next.next, kmem_cache_t, next);
 }
@@ -2233,20 +2240,6 @@
 	char *error = NULL;
 	mm_segment_t old_fs;
 	char tmp; 
-
-
-	if (p == (void*)1) {
-		/*
-		 * Output format version, so at least we can change it
-		 * without _too_ many complaints.
-		 */
-		seq_puts(m, "slabinfo - version: 1.2"
-#if STATS
-				" (statistics)"
-#endif
-				"\n");
-		return 0;
-	}
 
 	check_irq_on();
 	spin_lock_irq(&cachep->spinlock);
diff -Nru a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c	Sun Feb 23 22:25:27 2003
+++ b/net/atm/common.c	Sun Feb 23 22:25:27 2003
@@ -121,7 +121,6 @@
 	vcc->push_oam = NULL;
 	vcc->vpi = vcc->vci = 0; /* no VCI/VPI yet */
 	vcc->atm_options = vcc->aal_options = 0;
-	vcc->timestamp.tv_sec = vcc->timestamp.tv_usec = 0;
 	init_waitqueue_head(&vcc->sleep);
 	skb_queue_head_init(&vcc->recvq);
 	skb_queue_head_init(&vcc->listenq);
@@ -379,7 +378,7 @@
 	set_current_state(TASK_RUNNING);
 	remove_wait_queue(&vcc->sleep,&wait);
 	if (error <= 0) return error;
-	vcc->timestamp = skb->stamp;
+	sock_recv_timestamp(m, vcc->sk, skb);
 	eff_len = skb->len > size ? size : skb->len;
 	if (skb->len > size) /* Not fit ?  Report it... */
 		m->msg_flags |= MSG_TRUNC;
@@ -611,13 +610,11 @@
 			kfree(tmp_buf);
 			goto done;
 		case SIOCGSTAMP: /* borrowed from IP */
-			if (!vcc->timestamp.tv_sec) {
+			if (!vcc->sk->stamp.tv_sec) {
 				ret_val = -ENOENT;
 				goto done;
 			}
-			vcc->timestamp.tv_sec += vcc->timestamp.tv_usec/1000000;
-			vcc->timestamp.tv_usec %= 1000000;
-			ret_val = copy_to_user((void *) arg,&vcc->timestamp,
+			ret_val = copy_to_user((void *) arg, &vcc->sk->stamp,
 			    sizeof(struct timeval)) ? -EFAULT : 0;
 			goto done;
 		case ATM_SETSC:
diff -Nru a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig
--- a/net/bluetooth/Kconfig	Sun Feb 23 22:25:26 2003
+++ b/net/bluetooth/Kconfig	Sun Feb 23 22:25:26 2003
@@ -7,7 +7,7 @@
 
 config BT
 	tristate "Bluetooth subsystem support"
-	---help---
+	help
 	  Bluetooth is low-cost, low-power, short-range wireless technology.
 	  It was designed as a replacement for cables and other short-range
 	  technologies like IrDA.  Bluetooth operates in personal area range
@@ -15,12 +15,12 @@
 	  Bluetooth can be found at <http://www.bluetooth.com/>.
 
 	  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)
+	     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)
 
 	  Say Y here to enable Linux Bluetooth support and to build Bluetooth Core
 	  layer.
diff -Nru a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
--- a/net/bluetooth/af_bluetooth.c	Sun Feb 23 22:25:22 2003
+++ b/net/bluetooth/af_bluetooth.c	Sun Feb 23 22:25:22 2003
@@ -335,7 +335,9 @@
 	BT_INFO("Core ver %s", VERSION);
 
 	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,
diff -Nru a/net/bluetooth/bnep/Kconfig b/net/bluetooth/bnep/Kconfig
--- a/net/bluetooth/bnep/Kconfig	Sun Feb 23 22:25:27 2003
+++ b/net/bluetooth/bnep/Kconfig	Sun Feb 23 22:25:27 2003
@@ -1,7 +1,7 @@
 config BT_BNEP
 	tristate "BNEP protocol support"
-	depends on BT_L2CAP
-	---help---
+	depends on BT && BT_L2CAP
+	help
 	  BNEP (Bluetooth Network Encapsulation Protocol) is Ethernet
 	  emulation layer on top of Bluetooth. BNEP is required for Bluetooth
 	  PAN (Personal Area Network).
diff -Nru a/net/bluetooth/bnep/bnep.h b/net/bluetooth/bnep/bnep.h
--- a/net/bluetooth/bnep/bnep.h	Sun Feb 23 22:25:24 2003
+++ b/net/bluetooth/bnep/bnep.h	Sun Feb 23 22:25:24 2003
@@ -111,25 +111,25 @@
 	__u8  data[0];
 } __attribute__((packed));
 
-// Ioctl interface
-#define BNEPCONADD      1
-#define BNEPCONDEL      2
-#define BNEPGETCONLIST  3
-#define BNEPGETCONINFO  4
+/* BNEP ioctl defines */
+#define BNEPCONNADD	_IOW('B', 200, int)
+#define BNEPCONNDEL	_IOW('B', 201, int)
+#define BNEPGETCONNLIST	_IOR('B', 210, int)
+#define BNEPGETCONNINFO	_IOR('B', 211, int)
 
-struct bnep_conadd_req {
+struct bnep_connadd_req {
 	int   sock;       // Connected socket
 	__u32 flags;
 	__u16 role;
 	char  device[16]; // Name of the Ethernet device
 };
 
-struct bnep_condel_req {
+struct bnep_conndel_req {
 	__u32 flags;
 	__u8  dst[ETH_ALEN];
 };
 
-struct bnep_coninfo {
+struct bnep_conninfo {
 	__u32 flags;
 	__u16 role;
 	__u16 state;	
@@ -137,9 +137,9 @@
 	char  device[16];
 };
 
-struct bnep_conlist_req {
+struct bnep_connlist_req {
 	__u32  cnum;
-	struct bnep_coninfo *ci;
+	struct bnep_conninfo *ci;
 };
 
 struct bnep_proto_filter {
@@ -147,10 +147,10 @@
 	__u16 end;
 };
 
-int bnep_add_connection(struct bnep_conadd_req *req, struct socket *sock);
-int bnep_del_connection(struct bnep_condel_req *req);
-int bnep_get_conlist(struct bnep_conlist_req *req);
-int bnep_get_coninfo(struct bnep_coninfo *ci);
+int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock);
+int bnep_del_connection(struct bnep_conndel_req *req);
+int bnep_get_connlist(struct bnep_connlist_req *req);
+int bnep_get_conninfo(struct bnep_conninfo *ci);
 
 // BNEP sessions
 struct bnep_session {
diff -Nru a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
--- a/net/bluetooth/bnep/core.c	Sun Feb 23 22:25:25 2003
+++ b/net/bluetooth/bnep/core.c	Sun Feb 23 22:25:25 2003
@@ -128,18 +128,17 @@
 	return bnep_send(s, &rsp, sizeof(rsp));
 }
 
-static int bnep_ctrl_set_netfilter(struct bnep_session *s, struct sk_buff *skb)
+static int bnep_ctrl_set_netfilter(struct bnep_session *s, u16 *data, int len)
 {
-	u16 *data;
 	int n;
-	
-	data = (void *) skb->data;
-	if (!skb_pull(skb, 2))
+
+	if (len < 2)
 		return -EILSEQ;
+
 	n = ntohs(get_unaligned(data));
+	data++; len -= 2;
 
-	data = (void *) skb->data;
-	if (!skb_pull(skb, n))
+	if (len < n)
 		return -EILSEQ;
 
 	BT_DBG("filter len %d", n);
@@ -170,18 +169,17 @@
 	return 0;
 }
 
-static int bnep_ctrl_set_mcfilter(struct bnep_session *s, struct sk_buff *skb)
+static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
 {
-	u8 *data;
 	int n;
-	
-	data = (void *) skb->data;
-	if (!skb_pull(skb, 2))
+
+	if (len < 2)
 		return -EILSEQ;
-	n = ntohs(get_unaligned((u16 *) data));
 
-	data = (void *) skb->data;
-	if (!skb_pull(skb, n))
+	n = ntohs(get_unaligned((u16 *) data)); 
+	data += 2; len -= 2;
+
+	if (len < n)
 		return -EILSEQ;
 
 	BT_DBG("filter len %d", n);
@@ -225,12 +223,13 @@
 	return 0;
 }
 
-static int bnep_rx_control(struct bnep_session *s, struct sk_buff *skb)
+static int bnep_rx_control(struct bnep_session *s, void *data, int len)
 {
+	u8  cmd = *(u8 *)data;
 	int err = 0;
-	u8 cmd = *(u8 *) skb->data;
-	skb_pull(skb, 1);
-	
+
+	data++; len--;
+
 	switch (cmd) {
 	case BNEP_CMD_NOT_UNDERSTOOD:
 	case BNEP_SETUP_CONN_REQ:
@@ -239,13 +238,13 @@
 	case BNEP_FILTER_MULTI_ADDR_RSP:
 		/* Ignore these for now */
 		break;
-		
+
 	case BNEP_FILTER_NET_TYPE_SET:
-		err = bnep_ctrl_set_netfilter(s, skb);
+		err = bnep_ctrl_set_netfilter(s, data, len);
 		break;
 
 	case BNEP_FILTER_MULTI_ADDR_SET:
-		err = bnep_ctrl_set_mcfilter(s, skb);
+		err = bnep_ctrl_set_mcfilter(s, data, len);
 		break;
 
 	default: {
@@ -274,16 +273,19 @@
 		}
 
 		BT_DBG("type 0x%x len %d", h->type, h->len);
-		
+	
 		switch (h->type & BNEP_TYPE_MASK) {
 		case BNEP_EXT_CONTROL:
-			err = bnep_rx_control(s, skb);
+			bnep_rx_control(s, skb->data, skb->len);
 			break;
 
 		default:
-			/* Unknown extension */
-			if (!skb_pull(skb, h->len))
-				err = -EILSEQ;
+			/* Unknown extension, skip it. */
+			break;
+		}
+
+		if (!skb_pull(skb, h->len)) {
+			err = -EILSEQ;
 			break;
 		}
 	} while (!err && (h->type & BNEP_EXT_HEADER));
@@ -315,7 +317,7 @@
 		goto badframe;
 	
 	if ((type & BNEP_TYPE_MASK) == BNEP_CONTROL) {
-		bnep_rx_control(s, skb);
+		bnep_rx_control(s, skb->data, skb->len);
 		kfree_skb(skb);
 		return 0;
 	}
@@ -525,7 +527,7 @@
 	return 0;
 }
 
-int bnep_add_connection(struct bnep_conadd_req *req, struct socket *sock)
+int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
 {
 	struct net_device *dev;
 	struct bnep_session *s, *ss;
@@ -616,7 +618,7 @@
 	return err;
 }
 
-int bnep_del_connection(struct bnep_condel_req *req)
+int bnep_del_connection(struct bnep_conndel_req *req)
 {
 	struct bnep_session *s;
 	int  err = 0;
@@ -641,7 +643,7 @@
 	return err;
 }
 
-static void __bnep_copy_ci(struct bnep_coninfo *ci, struct bnep_session *s)
+static void __bnep_copy_ci(struct bnep_conninfo *ci, struct bnep_session *s)
 {
 	memcpy(ci->dst, s->eh.h_source, ETH_ALEN);
 	strcpy(ci->device, s->dev.name);
@@ -650,7 +652,7 @@
 	ci->role  = s->role;
 }
 
-int bnep_get_conlist(struct bnep_conlist_req *req)
+int bnep_get_connlist(struct bnep_connlist_req *req)
 {
 	struct list_head *p;
 	int err = 0, n = 0;
@@ -659,7 +661,7 @@
 
 	list_for_each(p, &bnep_session_list) {
 		struct bnep_session *s;
-		struct bnep_coninfo ci;
+		struct bnep_conninfo ci;
 
 		s = list_entry(p, struct bnep_session, list);
 
@@ -681,7 +683,7 @@
 	return err;
 }
 
-int bnep_get_coninfo(struct bnep_coninfo *ci)
+int bnep_get_conninfo(struct bnep_conninfo *ci)
 {
 	struct bnep_session *s;
 	int err = 0;
@@ -698,7 +700,7 @@
 	return err;
 }
 
-static int __init bnep_init_module(void)
+static int  __init bnep_init_module(void)
 {	
 	char flt[50] = "";	
 
diff -Nru a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c
--- a/net/bluetooth/bnep/sock.c	Sun Feb 23 22:25:27 2003
+++ b/net/bluetooth/bnep/sock.c	Sun Feb 23 22:25:27 2003
@@ -73,17 +73,17 @@
 
 static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {
-	struct bnep_conlist_req cl;
-	struct bnep_conadd_req  ca;
-	struct bnep_condel_req  cd;
-	struct bnep_coninfo ci;
+	struct bnep_connlist_req cl;
+	struct bnep_connadd_req  ca;
+	struct bnep_conndel_req  cd;
+	struct bnep_conninfo ci;
 	struct socket *nsock;
 	int err;
 
 	BT_DBG("cmd %x arg %lx", cmd, arg);
 
 	switch (cmd) {
-	case BNEPCONADD:
+	case BNEPCONNADD:
 		if (!capable(CAP_NET_ADMIN))
 			return -EACCES;
 
@@ -106,7 +106,7 @@
 
 		return err;
 	
-	case BNEPCONDEL:
+	case BNEPCONNDEL:
 		if (!capable(CAP_NET_ADMIN))
 			return -EACCES;
 
@@ -115,24 +115,24 @@
 	
 		return bnep_del_connection(&cd);
 
-	case BNEPGETCONLIST:
+	case BNEPGETCONNLIST:
 		if (copy_from_user(&cl, (void *) arg, sizeof(cl)))
 			return -EFAULT;
 
 		if (cl.cnum <= 0)
 			return -EINVAL;
 	
-		err = bnep_get_conlist(&cl);
+		err = bnep_get_connlist(&cl);
 		if (!err && copy_to_user((void *) arg, &cl, sizeof(cl)))
 			return -EFAULT;
 
 		return err;
 
-	case BNEPGETCONINFO:
+	case BNEPGETCONNINFO:
 		if (copy_from_user(&ci, (void *) arg, sizeof(ci)))
 			return -EFAULT;
 
-		err = bnep_get_coninfo(&ci);
+		err = bnep_get_conninfo(&ci);
 		if (!err && copy_to_user((void *) arg, &ci, sizeof(ci)))
 			return -EFAULT;
 
@@ -192,13 +192,13 @@
 	.create = bnep_sock_create
 };
 
-int bnep_sock_init(void)
+int __init bnep_sock_init(void)
 {
 	bt_sock_register(BTPROTO_BNEP, &bnep_sock_family_ops);
 	return 0;
 }
 
-int bnep_sock_cleanup(void)
+int __exit bnep_sock_cleanup(void)
 {
 	if (bt_sock_unregister(BTPROTO_BNEP))
 		BT_ERR("Can't unregister BNEP socket");
diff -Nru a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
--- a/net/bluetooth/hci_conn.c	Sun Feb 23 22:25:27 2003
+++ b/net/bluetooth/hci_conn.c	Sun Feb 23 22:25:27 2003
@@ -218,8 +218,7 @@
 	read_lock_bh(&hci_dev_list_lock);
 
 	list_for_each(p, &hci_dev_list) {
-		struct hci_dev *d;
-		d = list_entry(p, struct hci_dev, list);
+		struct hci_dev *d = list_entry(p, struct hci_dev, list);
 		
 		if (!test_bit(HCI_UP, &d->flags))
 			continue;
@@ -241,7 +240,7 @@
 	}
 
 	if (hdev)
-		hci_dev_hold(hdev);
+		hdev = hci_dev_hold(hdev);
 
 	read_unlock_bh(&hci_dev_list_lock);
 	return hdev;
diff -Nru a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
--- a/net/bluetooth/hci_core.c	Sun Feb 23 22:25:22 2003
+++ b/net/bluetooth/hci_core.c	Sun Feb 23 22:25:22 2003
@@ -287,10 +287,10 @@
 }
 
 /* Get HCI device by index. 
- * Device is locked on return. */
+ * Device is held on return. */
 struct hci_dev *hci_dev_get(int index)
 {
-	struct hci_dev *hdev;
+	struct hci_dev *hdev = NULL;
 	struct list_head *p;
 
 	BT_DBG("%d", index);
@@ -300,14 +300,12 @@
 
 	read_lock(&hci_dev_list_lock);
 	list_for_each(p, &hci_dev_list) {
-		hdev = list_entry(p, struct hci_dev, list);
-		if (hdev->id == index) {
-			hci_dev_hold(hdev);
-			goto done;
+		struct hci_dev *d = list_entry(p, struct hci_dev, list);
+		if (d->id == index) {
+			hdev = hci_dev_hold(d);
+			break;
 		}
 	}
-	hdev = NULL;
-done:
 	read_unlock(&hci_dev_list_lock);
 	return hdev;
 }
@@ -483,6 +481,7 @@
 	}
 
 	if (!ret) {
+		hci_dev_hold(hdev);
 		set_bit(HCI_UP, &hdev->flags);
 		hci_notify(hdev, HCI_DEV_UP);
 	} else {	
@@ -567,6 +566,8 @@
 	hdev->flags = 0;
 
 	hci_req_unlock(hdev);
+
+	hci_dev_put(hdev);
 	return 0;
 }
 
@@ -718,7 +719,7 @@
 	if (!dev_num)
 		return -EINVAL;
 	
-	size = dev_num * sizeof(struct hci_dev_req) + sizeof(__u16);
+	size = dev_num * sizeof(*dr) + sizeof(*dl);
 
 	if (verify_area(VERIFY_WRITE, (void *) arg, size))
 		return -EFAULT;
@@ -739,7 +740,7 @@
 	read_unlock_bh(&hci_dev_list_lock);
 
 	dl->dev_num = n;
-	size = n * sizeof(struct hci_dev_req) + sizeof(__u16);
+	size = n * sizeof(*dr) + sizeof(*dl);
 
 	copy_to_user((void *) arg, dl, size);
 	kfree(dl);
@@ -790,7 +791,7 @@
 	struct list_head *head = &hci_dev_list, *p;
 	int id = 0;
 
-	BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type);
+	BT_DBG("%p name %s type %d owner %p", hdev, hdev->name, hdev->type, hdev->owner);
 
 	if (!hdev->open || !hdev->close || !hdev->destruct)
 		return -EINVAL;
@@ -834,8 +835,6 @@
 
 	atomic_set(&hdev->promisc, 0);
 		
-	MOD_INC_USE_COUNT;
-
 	write_unlock_bh(&hci_dev_list_lock);
 
 	hci_dev_proc_init(hdev);
@@ -862,9 +861,7 @@
 	hci_notify(hdev, HCI_DEV_UNREG);
 	hci_run_hotplug(hdev->name, "unregister");
 	
-	hci_dev_put(hdev);
-
-	MOD_DEC_USE_COUNT;
+	__hci_dev_put(hdev);
 	return 0;
 }
 
@@ -954,40 +951,6 @@
 	return hdev->send(skb);
 }
 
-/* Send raw HCI frame */
-int hci_send_raw(struct sk_buff *skb)
-{
-	struct hci_dev *hdev = (struct hci_dev *) skb->dev;
-
-	if (!hdev) {
-		kfree_skb(skb);
-		return -ENODEV;
-	}
-
-	BT_DBG("%s type %d len %d", hdev->name, skb->pkt_type, skb->len);
-
-	if (!test_bit(HCI_RAW, &hdev->flags)) {
-		/* Queue frame according it's type */
-		switch (skb->pkt_type) {
-		case HCI_COMMAND_PKT:
-			skb_queue_tail(&hdev->cmd_q, skb);
-			hci_sched_cmd(hdev);
-			return 0;
-
-		case HCI_ACLDATA_PKT:
-		case HCI_SCODATA_PKT:
-			/* FIXME:
-		 	 * Check header here and queue to apropriate connection.
-		 	 */
-			break;
-		}
-	}
-
-	skb_queue_tail(&hdev->raw_q, skb);
-	hci_sched_tx(hdev);
-	return 0;
-}
-
 /* Send HCI command */
 int hci_send_cmd(struct hci_dev *hdev, __u16 ogf, __u16 ocf, __u32 plen, void *param)
 {
@@ -1002,7 +965,7 @@
 		BT_ERR("%s Can't allocate memory for HCI command", hdev->name);
 		return -ENOMEM;
 	}
-	
+
 	hdr = (struct hci_command_hdr *) skb_put(skb, HCI_COMMAND_HDR_SIZE);
 	hdr->opcode = __cpu_to_le16(hci_opcode_pack(ogf, ocf));
 	hdr->plen   = plen;
diff -Nru a/net/bluetooth/hci_proc.c b/net/bluetooth/hci_proc.c
--- a/net/bluetooth/hci_proc.c	Sun Feb 23 22:25:22 2003
+++ b/net/bluetooth/hci_proc.c	Sun Feb 23 22:25:22 2003
@@ -151,13 +151,13 @@
 	remove_proc_entry(id, proc_bt_hci);
 }
 
-int __init hci_proc_init(void)
+int  __init hci_proc_init(void)
 {
 	proc_bt_hci = proc_mkdir("hci", proc_bt);
         return 0;
 }
 
-void __init hci_proc_cleanup(void)
+void __exit hci_proc_cleanup(void)
 {
 	remove_proc_entry("hci", proc_bt);
 }
@@ -179,7 +179,7 @@
         return 0;
 }
 
-void __init hci_proc_cleanup(void)
+void __exit hci_proc_cleanup(void)
 {
         return;
 }
diff -Nru a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
--- a/net/bluetooth/hci_sock.c	Sun Feb 23 22:25:24 2003
+++ b/net/bluetooth/hci_sock.c	Sun Feb 23 22:25:24 2003
@@ -49,6 +49,7 @@
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
+#include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci_core.h>
@@ -68,14 +69,17 @@
 	{ 0xd9fe, 0x0 },
 	/* Commands */
 	{
+		{ 0x0 },
 		/* OGF_LINK_CTL */
-		{ 0x2a000002, 0x0, 0x0, 0x0 },
+		{ 0x2a000002, 0x0, 0x0, 0x0  },
 		/* OGF_LINK_POLICY */
-		{ 0x1200, 0x0, 0x0, 0x0     },
+		{ 0x1200, 0x0, 0x0, 0x0      },
 		/* OGF_HOST_CTL */
-		{ 0x80100000, 0xa, 0x0, 0x0 },
+		{ 0x80100000, 0x2a, 0x0, 0x0 },
 		/* OGF_INFO_PARAM */
-		{ 0x22a, 0x0, 0x0, 0x0      }
+		{ 0x22a, 0x0, 0x0, 0x0       },
+		/* OGF_STATUS_PARAM */
+		{ 0x2e, 0x0, 0x0, 0x0        }
 	}
 };
 
@@ -388,25 +392,37 @@
 
 	skb->pkt_type = *((unsigned char *) skb->data);
 	skb_pull(skb, 1);
+	skb->dev = (void *) hdev;
 
-	if (!capable(CAP_NET_RAW)) {
-		err = -EPERM;
+	if (skb->pkt_type == HCI_COMMAND_PKT) {
+		u16 opcode = __le16_to_cpu(get_unaligned((u16 *)skb->data));
+		u16 ogf = hci_opcode_ogf(opcode);
+		u16 ocf = hci_opcode_ocf(opcode);
+
+		if (((ogf > HCI_SFLT_MAX_OGF) || 
+				!test_bit(ocf & HCI_FLT_OCF_BITS, hci_sec_filter.ocf_mask[ogf])) &&
+		    			!capable(CAP_NET_RAW)) {
+			err = -EPERM;
+			goto drop;
+		}
 
-		if (skb->pkt_type == HCI_COMMAND_PKT) {
-			u16 opcode = __le16_to_cpu(*(__u16 *)skb->data);
-			u16 ogf = hci_opcode_ogf(opcode) - 1;
-			u16 ocf = hci_opcode_ocf(opcode) & HCI_FLT_OCF_BITS;
-
-			if (ogf > HCI_SFLT_MAX_OGF ||
-					!test_bit(ocf, hci_sec_filter.ocf_mask[ogf]))
-				goto drop;
-		} else
+		if (test_bit(HCI_RAW, &hdev->flags) || (ogf == OGF_VENDOR_CMD)) {
+			skb_queue_tail(&hdev->raw_q, skb);
+			hci_sched_tx(hdev);
+		} else {
+			skb_queue_tail(&hdev->cmd_q, skb);
+			hci_sched_cmd(hdev);
+		}
+	} else {
+		if (!capable(CAP_NET_RAW)) {
+			err = -EPERM;
 			goto drop;
+		}
+
+		skb_queue_tail(&hdev->raw_q, skb);
+		hci_sched_tx(hdev);
 	}
-		
-	/* Send frame to HCI core */
-	skb->dev = (void *) hdev;
-	hci_send_raw(skb);
+
 	err = len;
 
 done:
@@ -625,7 +641,7 @@
 	.notifier_call = hci_sock_dev_event
 };
 
-int hci_sock_init(void)
+int __init hci_sock_init(void)
 {
 	if (bt_sock_register(BTPROTO_HCI, &hci_sock_family_ops)) {
 		BT_ERR("HCI socket registration failed");
@@ -639,7 +655,7 @@
 	return 0;
 }
 
-int hci_sock_cleanup(void)
+int __exit hci_sock_cleanup(void)
 {
 	if (bt_sock_unregister(BTPROTO_HCI))
 		BT_ERR("HCI socket unregistration failed");
diff -Nru a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
--- a/net/bluetooth/l2cap.c	Sun Feb 23 22:25:25 2003
+++ b/net/bluetooth/l2cap.c	Sun Feb 23 22:25:25 2003
@@ -186,69 +186,12 @@
 	write_unlock(&l->lock);
 }
 
-int l2cap_connect(struct sock *sk)
-{
-	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;
-	int err = 0;
-
-	BT_DBG("%s -> %s psm 0x%2.2x", batostr(src), batostr(dst), l2cap_pi(sk)->psm);
-
-	if (!(hdev = hci_get_route(dst, src)))
-		return -EHOSTUNREACH;
-
-	hci_dev_lock_bh(hdev);
-
-	err = -ENOMEM;
-
-	hcon = hci_connect(hdev, ACL_LINK, dst);
-	if (!hcon)
-		goto done;
-
-	conn = l2cap_conn_add(hcon, 0);
-	if (!conn) {
-		hci_conn_put(hcon);
-		goto done;
-	}
-
-	err = 0;
-
-	/* Update source addr of the socket */
-	bacpy(src, conn->src);
-
-	l2cap_chan_add(conn, sk, NULL);
-
-	sk->state = BT_CONNECT;
-	l2cap_sock_set_timer(sk, sk->sndtimeo);
-
-	if (hcon->state == BT_CONNECTED) {
-		if (sk->type == SOCK_SEQPACKET) {
-			struct l2cap_conn_req req;
-			req.scid = __cpu_to_le16(l2cap_pi(sk)->scid);
-			req.psm  = l2cap_pi(sk)->psm;
-			l2cap_send_req(conn, L2CAP_CONN_REQ, sizeof(req), &req);
-		} else {
-			l2cap_sock_clear_timer(sk);
-			sk->state = BT_CONNECTED;
-		}
-	}
-
-done:
-	hci_dev_unlock_bh(hdev);
-	hci_dev_put(hdev);
-	return err;
-}
-
 /* ---- Socket interface ---- */
 static struct sock *__l2cap_get_sock_by_addr(u16 psm, bdaddr_t *src)
 {
 	struct sock *sk;
 	for (sk = l2cap_sk_list.head; sk; sk = sk->next) {
-		if (l2cap_pi(sk)->psm == psm &&
-				!bacmp(&bt_sk(sk)->src, src))
+		if (l2cap_pi(sk)->sport == psm && !bacmp(&bt_sk(sk)->src, src))
 			break;
 	}
 	return sk;
@@ -437,7 +380,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);
@@ -472,7 +418,8 @@
 	} else {
 		/* Save source address */
 		bacpy(&bt_sk(sk)->src, &la->l2_bdaddr);
-		l2cap_pi(sk)->psm = la->l2_psm;
+		l2cap_pi(sk)->psm   = la->l2_psm;
+		l2cap_pi(sk)->sport = la->l2_psm;
 		sk->state = BT_BOUND;
 	}
 	write_unlock_bh(&l2cap_sk_list.lock);
@@ -482,6 +429,62 @@
 	return err;
 }
 
+static int l2cap_do_connect(struct sock *sk)
+{
+	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;
+	int err = 0;
+
+	BT_DBG("%s -> %s psm 0x%2.2x", batostr(src), batostr(dst), l2cap_pi(sk)->psm);
+
+	if (!(hdev = hci_get_route(dst, src)))
+		return -EHOSTUNREACH;
+
+	hci_dev_lock_bh(hdev);
+
+	err = -ENOMEM;
+
+	hcon = hci_connect(hdev, ACL_LINK, dst);
+	if (!hcon)
+		goto done;
+
+	conn = l2cap_conn_add(hcon, 0);
+	if (!conn) {
+		hci_conn_put(hcon);
+		goto done;
+	}
+
+	err = 0;
+
+	/* Update source addr of the socket */
+	bacpy(src, conn->src);
+
+	l2cap_chan_add(conn, sk, NULL);
+
+	sk->state = BT_CONNECT;
+	l2cap_sock_set_timer(sk, sk->sndtimeo);
+
+	if (hcon->state == BT_CONNECTED) {
+		if (sk->type == SOCK_SEQPACKET) {
+			struct l2cap_conn_req req;
+			req.scid = __cpu_to_le16(l2cap_pi(sk)->scid);
+			req.psm  = l2cap_pi(sk)->psm;
+			l2cap_send_req(conn, L2CAP_CONN_REQ, sizeof(req), &req);
+		} else {
+			l2cap_sock_clear_timer(sk);
+			sk->state = BT_CONNECTED;
+		}
+	}
+
+done:
+	hci_dev_unlock_bh(hdev);
+	hci_dev_put(hdev);
+	return err;
+}
+
 static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags)
 {
 	struct sockaddr_l2 *la = (struct sockaddr_l2 *) addr;
@@ -527,7 +530,7 @@
 	bacpy(&bt_sk(sk)->dst, &la->l2_bdaddr);
 	l2cap_pi(sk)->psm = la->l2_psm;
 
-	if ((err = l2cap_connect(sk)))
+	if ((err = l2cap_do_connect(sk)))
 		goto done;
 
 wait:
@@ -2051,30 +2054,31 @@
 	.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;
+	p->owner     = THIS_MODULE;
         p->proc_fops = &l2cap_seq_fops;
         return 0;
 }
 
-static void __init l2cap_proc_cleanup(void)
+static void __exit l2cap_proc_cleanup(void)
 {
         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;
 }
 
-static void __init l2cap_proc_cleanup(void)
+static void __exit l2cap_proc_cleanup(void)
 {
-        return 0;
+        return;
 }
 #endif /* CONFIG_PROC_FS */
 
@@ -2136,7 +2140,7 @@
 	return 0;
 }
 
-void l2cap_cleanup(void)
+void __exit l2cap_cleanup(void)
 {
 	l2cap_proc_cleanup();
 
diff -Nru a/net/bluetooth/rfcomm/Kconfig b/net/bluetooth/rfcomm/Kconfig
--- a/net/bluetooth/rfcomm/Kconfig	Sun Feb 23 22:25:24 2003
+++ b/net/bluetooth/rfcomm/Kconfig	Sun Feb 23 22:25:24 2003
@@ -1,6 +1,6 @@
 config BT_RFCOMM
 	tristate "RFCOMM protocol support"
-	depends on BT_L2CAP
+	depends on BT && BT_L2CAP
 	help
 	  RFCOMM provides connection oriented stream transport. RFCOMM
 	  support is required for Dialup Networking, OBEX and other Bluetooth
diff -Nru a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
--- a/net/bluetooth/rfcomm/core.c	Sun Feb 23 22:25:21 2003
+++ b/net/bluetooth/rfcomm/core.c	Sun Feb 23 22:25:21 2003
@@ -263,7 +263,7 @@
 	rfcomm_session_put(s);
 }
 
-static struct rfcomm_dlc *rfcomm_dlc_get(struct rfcomm_session *s, int dlci)
+static struct rfcomm_dlc *rfcomm_dlc_get(struct rfcomm_session *s, u8 dlci)
 {
 	struct rfcomm_dlc *d;
 	struct list_head *p;
@@ -279,7 +279,8 @@
 static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel)
 {
 	struct rfcomm_session *s;
-	int err = 0, dlci = __dlci(0, channel);
+	u8 dlci = __dlci(0, channel);
+	int err = 0;
 
 	BT_DBG("dlc %p state %ld %s %s channel %d dlci %d", 
 			d, d->state, batostr(src), batostr(dst), channel, dlci);
@@ -923,7 +924,7 @@
 }
 
 /* ---- RFCOMM frame reception ---- */
-static int rfcomm_recv_ua(struct rfcomm_session *s, int dlci)
+static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci)
 {
 	BT_DBG("session %p state %ld dlci %d", s, s->state, dlci);
 
@@ -964,7 +965,7 @@
 	return 0;
 }
 
-static int rfcomm_recv_dm(struct rfcomm_session *s, int dlci)
+static int rfcomm_recv_dm(struct rfcomm_session *s, u8 dlci)
 {
 	int err = 0;
 
@@ -994,7 +995,7 @@
 	return 0;
 }
 
-static int rfcomm_recv_disc(struct rfcomm_session *s, int dlci)
+static int rfcomm_recv_disc(struct rfcomm_session *s, u8 dlci)
 {
 	int err = 0;
 
@@ -1030,10 +1031,10 @@
 	return 0;
 }
 
-static int rfcomm_recv_sabm(struct rfcomm_session *s, int dlci)
+static int rfcomm_recv_sabm(struct rfcomm_session *s, u8 dlci)
 {
 	struct rfcomm_dlc *d;
-	int channel;
+	u8 channel;
 
 	BT_DBG("session %p state %ld dlci %d", s, s->state, dlci);
 
@@ -1116,7 +1117,7 @@
 {
 	struct rfcomm_pn *pn = (void *) skb->data;
 	struct rfcomm_dlc *d;
-	int dlci = pn->dlci;
+	u8 dlci = pn->dlci;
 
 	BT_DBG("session %p state %ld dlci %d", s, s->state, dlci);
 
@@ -1141,7 +1142,7 @@
 			}
 		}
 	} else {
-		int channel = __srv_channel(dlci);
+		u8 channel = __srv_channel(dlci);
 
 		if (!cr)
 			return 0;
@@ -1167,7 +1168,7 @@
 static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_buff *skb)
 {
 	struct rfcomm_rpn *rpn = (void *) skb->data;
-	int dlci = __get_dlci(rpn->dlci);
+	u8 dlci = __get_dlci(rpn->dlci);
 
 	u8 bit_rate  = 0;
 	u8 data_bits = 0;
@@ -1257,7 +1258,7 @@
 {
 	struct rfcomm_msc *msc = (void *) skb->data;
 	struct rfcomm_dlc *d;
-	int dlci = __get_dlci(msc->dlci);
+	u8 dlci = __get_dlci(msc->dlci);
 
 	BT_DBG("dlci %d cr %d v24 0x%x", dlci, cr, msc->v24_sig);
 
@@ -1312,6 +1313,9 @@
 			rfcomm_send_test(s, 0, skb->data, skb->len);
 		break;
 
+	case RFCOMM_NSC:
+		break;
+
 	default:
 		BT_ERR("Unknown control type 0x%02x", type);
 		rfcomm_send_nsc(s, cr, type);
@@ -1320,7 +1324,7 @@
 	return 0;
 }
 
-static int rfcomm_recv_data(struct rfcomm_session *s, int dlci, int pf, struct sk_buff *skb)
+static int rfcomm_recv_data(struct rfcomm_session *s, u8 dlci, int pf, struct sk_buff *skb)
 {
 	struct rfcomm_dlc *d;
 
@@ -1442,7 +1446,7 @@
 
 	/* Send pending MSC */
 	if (test_and_clear_bit(RFCOMM_MSC_PENDING, &d->flags))
-		rfcomm_send_msc(d->session, d->dlci, 1, d->v24_sig); 
+		rfcomm_send_msc(d->session, 1, d->dlci, d->v24_sig); 
 	
 	if (d->credits) {
 		/* CFC enabled. 
@@ -1799,19 +1803,22 @@
 	.release = seq_release,
 };
 
-static int __init rfcomm_proc_init(void)
+static int  __init rfcomm_proc_init(void)
 {
         struct proc_dir_entry *p;
 
 	proc_bt_rfcomm = proc_mkdir("rfcomm", proc_bt);
+	if (proc_bt_rfcomm) {
+		proc_bt_rfcomm->owner = THIS_MODULE;
 
-        p = create_proc_entry("dlc", S_IRUGO, proc_bt_rfcomm);
-        if (p)
-        	p->proc_fops = &rfcomm_seq_fops;
+        	p = create_proc_entry("dlc", S_IRUGO, proc_bt_rfcomm);
+		if (p)
+        		p->proc_fops = &rfcomm_seq_fops;
+	}
         return 0;
 }
 
-static void __init rfcomm_proc_cleanup(void)
+static void __exit rfcomm_proc_cleanup(void)
 {
         remove_proc_entry("dlc", proc_bt_rfcomm);
 
@@ -1820,19 +1827,19 @@
 
 #else /* CONFIG_PROC_FS */
 
-static int __init rfcomm_proc_init(void)
+static int  __init rfcomm_proc_init(void)
 {
         return 0;
 }
 
-static void __init rfcomm_proc_cleanup(void)
+static void __exit rfcomm_proc_cleanup(void)
 {
-        return 0;
+        return;
 }
 #endif /* CONFIG_PROC_FS */
 
 /* ---- Initialization ---- */
-int __init rfcomm_init(void)
+int  __init rfcomm_init(void)
 {
 	kernel_thread(rfcomm_run, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
 
@@ -1849,7 +1856,7 @@
 	return 0;
 }
 
-void rfcomm_cleanup(void)
+void __exit rfcomm_cleanup(void)
 {
 	/* Terminate working thread.
 	 * ie. Set terminate flag and wake it up */
diff -Nru a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
--- a/net/bluetooth/rfcomm/sock.c	Sun Feb 23 22:25:25 2003
+++ b/net/bluetooth/rfcomm/sock.c	Sun Feb 23 22:25:25 2003
@@ -112,7 +112,7 @@
 }
 
 /* ---- Socket functions ---- */
-static struct sock *__rfcomm_get_sock_by_addr(int channel, bdaddr_t *src)
+static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src)
 {
 	struct sock *sk;
 
@@ -128,7 +128,7 @@
 /* Find socket with channel and source bdaddr.
  * Returns closest match.
  */
-static struct sock *__rfcomm_get_sock_by_channel(int state, __u16 channel, bdaddr_t *src)
+static struct sock *__rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src)
 {
 	struct sock *sk, *sk1 = NULL;
 
@@ -151,7 +151,7 @@
 
 /* Find socket with given address (channel, src).
  * Returns locked socket */
-static inline struct sock *rfcomm_get_sock_by_channel(int state, __u16 channel, bdaddr_t *src)
+static inline struct sock *rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src)
 {
 	struct sock *s;
 	read_lock(&rfcomm_sk_list.lock);
@@ -828,7 +828,7 @@
 	.release = seq_release,
 };
 
-static int __init rfcomm_sock_proc_init(void)
+static int  __init rfcomm_sock_proc_init(void)
 {
         struct proc_dir_entry *p = create_proc_entry("sock", S_IRUGO, proc_bt_rfcomm);
         if (!p)
@@ -837,21 +837,21 @@
         return 0;
 }
 
-static void __init rfcomm_sock_proc_cleanup(void)
+static void __exit rfcomm_sock_proc_cleanup(void)
 {
         remove_proc_entry("sock", proc_bt_rfcomm);
 }
 
 #else /* CONFIG_PROC_FS */
 
-static int __init rfcomm_sock_proc_init(void)
+static int  __init rfcomm_sock_proc_init(void)
 {
         return 0;
 }
 
-static void __init rfcomm_sock_proc_cleanup(void)
+static void __exit rfcomm_sock_proc_cleanup(void)
 {
-        return 0;
+        return;
 }
 #endif /* CONFIG_PROC_FS */
 
@@ -879,7 +879,7 @@
 	.create		= rfcomm_sock_create
 };
 
-int rfcomm_init_sockets(void)
+int  __init rfcomm_init_sockets(void)
 {
 	int err;
 
@@ -894,7 +894,7 @@
 	return 0;
 }
 
-void rfcomm_cleanup_sockets(void)
+void __exit rfcomm_cleanup_sockets(void)
 {
 	int err;
 
diff -Nru a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
--- a/net/bluetooth/rfcomm/tty.c	Sun Feb 23 22:25:24 2003
+++ b/net/bluetooth/rfcomm/tty.c	Sun Feb 23 22:25:24 2003
@@ -257,7 +257,7 @@
 
 static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, int priority)
 {
-	if (size || atomic_read(&dev->wmem_alloc) < dev->sndbuf) {
+	if (atomic_read(&dev->wmem_alloc) < dev->sndbuf) {
 		struct sk_buff *skb = alloc_skb(size, priority);
 		if (skb) {
 			rfcomm_set_owner_w(skb, dev);
@@ -442,7 +442,7 @@
 	struct tty_struct *tty;
        
 	if (!dev || !(tty = dev->tty)) {
-		kfree(skb);
+		kfree_skb(skb);
 		return;
 	}
 
@@ -669,12 +669,12 @@
 	else
 		rfcomm_dlc_get_modem_status(dlc, &v24_sig);
 
-	mask =  (status & TIOCM_DSR) ? RFCOMM_V24_RTC : 0 |
-		(status & TIOCM_DTR) ? RFCOMM_V24_RTC : 0 |
-		(status & TIOCM_RTS) ? RFCOMM_V24_RTR : 0 |
-		(status & TIOCM_CTS) ? RFCOMM_V24_RTR : 0 |
-		(status & TIOCM_RI)  ? RFCOMM_V24_IC  : 0 |
-		(status & TIOCM_CD)  ? RFCOMM_V24_DV  : 0;
+	mask =  ((status & TIOCM_DSR) ? RFCOMM_V24_RTC : 0) |
+		((status & TIOCM_DTR) ? RFCOMM_V24_RTC : 0) |
+		((status & TIOCM_RTS) ? RFCOMM_V24_RTR : 0) |
+		((status & TIOCM_CTS) ? RFCOMM_V24_RTR : 0) |
+		((status & TIOCM_RI)  ? RFCOMM_V24_IC  : 0) |
+		((status & TIOCM_CD)  ? RFCOMM_V24_DV  : 0);
 
 	if (cmd == TIOCMBIC)
 		v24_sig &= ~mask;
@@ -854,7 +854,7 @@
 #ifdef CONFIG_DEVFS_FS
 	.name			= "bluetooth/rfcomm/%d",
 #else
-	.name			= "rfcomm%d",
+	.name			= "rfcomm",
 #endif
 	.major			= RFCOMM_TTY_MAJOR,
 	.minor_start		= RFCOMM_TTY_MINOR,
diff -Nru a/net/bluetooth/sco.c b/net/bluetooth/sco.c
--- a/net/bluetooth/sco.c	Sun Feb 23 22:25:22 2003
+++ b/net/bluetooth/sco.c	Sun Feb 23 22:25:22 2003
@@ -698,7 +698,7 @@
 		
 		opts.mtu = sco_pi(sk)->conn->mtu;
 
-		BT_INFO("mtu %d", opts.mtu);
+		BT_DBG("mtu %d", opts.mtu);
 
 		len = min_t(unsigned int, len, sizeof(opts));
 		if (copy_to_user(optval, (char *)&opts, len))
@@ -939,30 +939,31 @@
 	.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;
+	p->owner     = THIS_MODULE;
         p->proc_fops = &sco_seq_fops;
         return 0;
 }
 
-static void __init sco_proc_cleanup(void)
+static void __exit sco_proc_cleanup(void)
 {
         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;
 }
 
-static void __init sco_proc_cleanup(void)
+static void __exit sco_proc_cleanup(void)
 {
-        return 0;
+        return;
 }
 #endif /* CONFIG_PROC_FS */
 
@@ -1021,7 +1022,7 @@
 	return 0;
 }
 
-void sco_cleanup(void)
+void __exit sco_cleanup(void)
 {
 	int err;
 
diff -Nru a/net/bluetooth/syms.c b/net/bluetooth/syms.c
--- a/net/bluetooth/syms.c	Sun Feb 23 22:25:24 2003
+++ b/net/bluetooth/syms.c	Sun Feb 23 22:25:24 2003
@@ -58,7 +58,7 @@
 
 EXPORT_SYMBOL(hci_send_acl);
 EXPORT_SYMBOL(hci_send_sco);
-EXPORT_SYMBOL(hci_send_raw);
+EXPORT_SYMBOL(hci_send_cmd);
 EXPORT_SYMBOL(hci_si_event);
 
 /* Bluetooth lib */
diff -Nru a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
--- a/net/decnet/dn_nsp_out.c	Sun Feb 23 22:25:27 2003
+++ b/net/decnet/dn_nsp_out.c	Sun Feb 23 22:25:27 2003
@@ -593,7 +593,7 @@
 	 * associations.
 	 */
 	skb->dst = dst_clone(dst);
-	skb->dst->output(skb);
+	dst_output(skb);
 }
 
 
diff -Nru a/net/decnet/dn_route.c b/net/decnet/dn_route.c
--- a/net/decnet/dn_route.c	Sun Feb 23 22:25:26 2003
+++ b/net/decnet/dn_route.c	Sun Feb 23 22:25:26 2003
@@ -389,7 +389,7 @@
 	int err;
 
 	if ((err = dn_route_input(skb)) == 0)
-		return skb->dst->input(skb);
+		return dst_input(skb);
 
 	if (decnet_debug_level & 4) {
 		char *devname = skb->dev ? skb->dev->name : "???";
diff -Nru a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
--- a/net/ipv4/af_inet.c	Sun Feb 23 22:25:22 2003
+++ b/net/ipv4/af_inet.c	Sun Feb 23 22:25:22 2003
@@ -976,6 +976,7 @@
 	struct list_head *lh;
 	struct inet_protosw *answer;
 	int protocol = p->protocol;
+	struct list_head *last_perm;
 
 	br_write_lock_bh(BR_NETPROTO_LOCK);
 
@@ -984,24 +985,29 @@
 
 	/* If we are trying to override a permanent protocol, bail. */
 	answer = NULL;
+	last_perm = &inetsw[p->type];
 	list_for_each(lh, &inetsw[p->type]) {
 		answer = list_entry(lh, struct inet_protosw, list);
 
 		/* Check only the non-wild match. */
-		if (protocol == answer->protocol &&
-		    (INET_PROTOSW_PERMANENT & answer->flags))
-			break;
+		if (INET_PROTOSW_PERMANENT & answer->flags) {
+			if (protocol == answer->protocol)
+				break;
+			last_perm = lh;
+		}
 
 		answer = NULL;
 	}
 	if (answer)
 		goto out_permanent;
 
-	/* Add to the BEGINNING so that we override any existing
-	 * entry.  This means that when we remove this entry, the
+	/* Add the new entry after the last permanent entry if any, so that
+	 * the new entry does not override a permanent entry when matched with
+	 * a wild-card protocol. But it is allowed to override any existing
+	 * non-permanent entry.  This means that when we remove this entry, the 
 	 * system automatically returns to the old behavior.
 	 */
-	list_add(&p->list, &inetsw[p->type]);
+	list_add(&p->list, last_perm);
 out:
 	br_write_unlock_bh(BR_NETPROTO_LOCK);
 	return;
diff -Nru a/net/ipv4/igmp.c b/net/ipv4/igmp.c
--- a/net/ipv4/igmp.c	Sun Feb 23 22:25:27 2003
+++ b/net/ipv4/igmp.c	Sun Feb 23 22:25:27 2003
@@ -184,14 +184,6 @@
 
 #define IGMP_SIZE (sizeof(struct igmphdr)+sizeof(struct iphdr)+4)
 
-/* Don't just hand NF_HOOK skb->dst->output, in case netfilter hook
-   changes route */
-static inline int
-output_maybe_reroute(struct sk_buff *skb)
-{
-	return skb->dst->output(skb);
-}
-
 static int igmp_send_report(struct net_device *dev, u32 group, int type)
 {
 	struct sk_buff *skb;
@@ -255,7 +247,7 @@
 	ih->csum=ip_compute_csum((void *)ih, sizeof(struct igmphdr));
 
 	return NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, rt->u.dst.dev,
-		       output_maybe_reroute);
+		       dst_output);
 }
 
 
diff -Nru a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
--- a/net/ipv4/ip_fragment.c	Sun Feb 23 22:25:22 2003
+++ b/net/ipv4/ip_fragment.c	Sun Feb 23 22:25:22 2003
@@ -19,6 +19,7 @@
  *		Bill Hawes	:	Frag accounting and evictor fixes.
  *		John McDonald	:	0 length frag bug.
  *		Alexey Kuznetsov:	SMP races, threading, cleanup.
+ *		Patrick McHardy :	LRU queue of frag heads for evictor.
  */
 
 #include <linux/config.h>
@@ -26,6 +27,7 @@
 #include <linux/mm.h>
 #include <linux/jiffies.h>
 #include <linux/skbuff.h>
+#include <linux/list.h>
 #include <linux/ip.h>
 #include <linux/icmp.h>
 #include <linux/netdevice.h>
@@ -67,6 +69,7 @@
 /* Describe an entry in the "incomplete datagrams" queue. */
 struct ipq {
 	struct ipq	*next;		/* linked list pointers			*/
+	struct list_head lru_list;	/* lru list member 			*/
 	u32		saddr;
 	u32		daddr;
 	u16		id;
@@ -94,6 +97,7 @@
 /* Per-bucket lock is easy to add now. */
 static struct ipq *ipq_hash[IPQ_HASHSZ];
 static rwlock_t ipfrag_lock = RW_LOCK_UNLOCKED;
+static LIST_HEAD(ipq_lru_list);
 int ip_frag_nqueues = 0;
 
 static __inline__ void __ipq_unlink(struct ipq *qp)
@@ -101,6 +105,7 @@
 	if(qp->next)
 		qp->next->pprev = qp->pprev;
 	*qp->pprev = qp->next;
+	list_del(&qp->lru_list);
 	ip_frag_nqueues--;
 }
 
@@ -202,39 +207,30 @@
  */
 static void ip_evictor(void)
 {
-	int i, progress;
+	struct ipq *qp;
+	struct list_head *tmp;
 
-	do {
+	for(;;) {
 		if (atomic_read(&ip_frag_mem) <= sysctl_ipfrag_low_thresh)
 			return;
-		progress = 0;
-		/* FIXME: Make LRU queue of frag heads. -DaveM */
-		for (i = 0; i < IPQ_HASHSZ; i++) {
-			struct ipq *qp;
-			if (ipq_hash[i] == NULL)
-				continue;
-
-			read_lock(&ipfrag_lock);
-			if ((qp = ipq_hash[i]) != NULL) {
-				/* find the oldest queue for this hash bucket */
-				while (qp->next)
-					qp = qp->next;
-				atomic_inc(&qp->refcnt);
-				read_unlock(&ipfrag_lock);
-
-				spin_lock(&qp->lock);
-				if (!(qp->last_in&COMPLETE))
-					ipq_kill(qp);
-				spin_unlock(&qp->lock);
-
-				ipq_put(qp);
-				IP_INC_STATS_BH(IpReasmFails);
-				progress = 1;
-				continue;
-			}
+		read_lock(&ipfrag_lock);
+		if (list_empty(&ipq_lru_list)) {
 			read_unlock(&ipfrag_lock);
+			return;
 		}
-	} while (progress);
+		tmp = ipq_lru_list.next;
+		qp = list_entry(tmp, struct ipq, lru_list);
+		atomic_inc(&qp->refcnt);
+		read_unlock(&ipfrag_lock);
+
+		spin_lock(&qp->lock);
+		if (!(qp->last_in&COMPLETE))
+			ipq_kill(qp);
+		spin_unlock(&qp->lock);
+
+		ipq_put(qp);
+		IP_INC_STATS_BH(IpReasmFails);
+	}
 }
 
 /*
@@ -302,6 +298,8 @@
 		qp->next->pprev = &qp->next;
 	ipq_hash[hash] = qp;
 	qp->pprev = &ipq_hash[hash];
+	INIT_LIST_HEAD(&qp->lru_list);
+	list_add_tail(&qp->lru_list, &ipq_lru_list);
 	ip_frag_nqueues++;
 	write_unlock(&ipfrag_lock);
 	return qp;
@@ -495,6 +493,10 @@
 	atomic_add(skb->truesize, &ip_frag_mem);
 	if (offset == 0)
 		qp->last_in |= FIRST_IN;
+
+	write_lock(&ipfrag_lock);
+	list_move_tail(&qp->lru_list, &ipq_lru_list);
+	write_unlock(&ipfrag_lock);
 
 	return;
 
diff -Nru a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
--- a/net/ipv4/ip_input.c	Sun Feb 23 22:25:21 2003
+++ b/net/ipv4/ip_input.c	Sun Feb 23 22:25:21 2003
@@ -344,7 +344,7 @@
 		}
 	}
 
-	return skb->dst->input(skb);
+	return dst_input(skb);
 
 inhdr_error:
 	IP_INC_STATS_BH(IpInHdrErrors);
diff -Nru a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
--- a/net/ipv4/ipconfig.c	Sun Feb 23 22:25:21 2003
+++ b/net/ipv4/ipconfig.c	Sun Feb 23 22:25:21 2003
@@ -603,7 +603,7 @@
 	*e++ = 3;		/* Default gateway request */
 	*e++ = 4;
 	e += 4;
-	*e++ = 5;		/* Name server reqeust */
+	*e++ = 5;		/* Name server request */
 	*e++ = 8;
 	e += 8;
 	*e++ = 12;		/* Host name request */
diff -Nru a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
--- a/net/ipv4/ipmr.c	Sun Feb 23 22:25:24 2003
+++ b/net/ipv4/ipmr.c	Sun Feb 23 22:25:24 2003
@@ -1112,9 +1112,9 @@
 	struct dst_entry *dst = skb->dst;
 
 	if (skb->len <= dst_pmtu(dst))
-		return dst->output(skb);
+		return dst_output(skb);
 	else
-		return ip_fragment(skb, dst->output);
+		return ip_fragment(skb, dst_output);
 }
 
 /*
diff -Nru a/net/ipv4/netfilter/ip_fw_compat.c b/net/ipv4/netfilter/ip_fw_compat.c
--- a/net/ipv4/netfilter/ip_fw_compat.c	Sun Feb 23 22:25:23 2003
+++ b/net/ipv4/netfilter/ip_fw_compat.c	Sun Feb 23 22:25:23 2003
@@ -16,10 +16,6 @@
 #include <linux/netfilter_ipv4/ip_conntrack.h>
 #include <linux/netfilter_ipv4/ip_conntrack_core.h>
 
-/* Theoretically, we could one day use 2.4 helpers, but for now it
-   just confuses depmod --RR */
-EXPORT_NO_SYMBOLS;
-
 static struct firewall_ops *fwops;
 
 /* From ip_fw_compat_redir.c */
diff -Nru a/net/ipv4/netfilter/ipt_ah.c b/net/ipv4/netfilter/ipt_ah.c
--- a/net/ipv4/netfilter/ipt_ah.c	Sun Feb 23 22:25:25 2003
+++ b/net/ipv4/netfilter/ipt_ah.c	Sun Feb 23 22:25:25 2003
@@ -5,7 +5,6 @@
 #include <linux/netfilter_ipv4/ipt_ah.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
 
-EXPORT_NO_SYMBOLS;
 MODULE_LICENSE("GPL");
 
 #ifdef DEBUG_CONNTRACK
diff -Nru a/net/ipv4/netfilter/ipt_esp.c b/net/ipv4/netfilter/ipt_esp.c
--- a/net/ipv4/netfilter/ipt_esp.c	Sun Feb 23 22:25:24 2003
+++ b/net/ipv4/netfilter/ipt_esp.c	Sun Feb 23 22:25:24 2003
@@ -5,7 +5,6 @@
 #include <linux/netfilter_ipv4/ipt_esp.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
 
-EXPORT_NO_SYMBOLS;
 MODULE_LICENSE("GPL");
 
 #ifdef DEBUG_CONNTRACK
diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c
--- a/net/ipv4/route.c	Sun Feb 23 22:25:27 2003
+++ b/net/ipv4/route.c	Sun Feb 23 22:25:27 2003
@@ -2409,149 +2409,149 @@
 
 ctl_table ipv4_route_table[] = {
         {
-		.ctl_name =	NET_IPV4_ROUTE_FLUSH,
-		.procname =	"flush",
-		.data =	&flush_delay,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&ipv4_sysctl_rtcache_flush,
-		.strategy =	&ipv4_sysctl_rtcache_flush_strategy,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_MIN_DELAY,
-		.procname =	"min_delay",
-		.data =	&ip_rt_min_delay,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec_jiffies,
-		.strategy =	&sysctl_jiffies,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_MAX_DELAY,
-		.procname =	"max_delay",
-		.data =	&ip_rt_max_delay,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec_jiffies,
-		.strategy =	&sysctl_jiffies,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_GC_THRESH,
-		.procname =	"gc_thresh",
-		.data =	&ipv4_dst_ops.gc_thresh,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_MAX_SIZE,
-		.procname =	"max_size",
-		.data =	&ip_rt_max_size,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_GC_MIN_INTERVAL,
-		.procname =	"gc_min_interval",
-		.data =	&ip_rt_gc_min_interval,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec_jiffies,
-		.strategy =	&sysctl_jiffies,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_GC_TIMEOUT,
-		.procname =	"gc_timeout",
-		.data =	&ip_rt_gc_timeout,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec_jiffies,
-		.strategy =	&sysctl_jiffies,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_GC_INTERVAL,
-		.procname =	"gc_interval",
-		.data =	&ip_rt_gc_interval,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec_jiffies,
-		.strategy =	&sysctl_jiffies,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_REDIRECT_LOAD,
-		.procname =	"redirect_load",
-		.data =	&ip_rt_redirect_load,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_REDIRECT_NUMBER,
-		.procname =	"redirect_number",
-		.data =	&ip_rt_redirect_number,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_REDIRECT_SILENCE,
-		.procname =	"redirect_silence",
-		.data =	&ip_rt_redirect_silence,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_ERROR_COST,
-		.procname =	"error_cost",
-		.data =	&ip_rt_error_cost,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_ERROR_BURST,
-		.procname =	"error_burst",
-		.data =	&ip_rt_error_burst,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_GC_ELASTICITY,
-		.procname =	"gc_elasticity",
-		.data =	&ip_rt_gc_elasticity,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_MTU_EXPIRES,
-		.procname =	"mtu_expires",
-		.data =	&ip_rt_mtu_expires,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec_jiffies,
-		.strategy =	&sysctl_jiffies,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_MIN_PMTU,
-		.procname =	"min_pmtu",
-		.data =	&ip_rt_min_pmtu,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec,
-	},
-	{
-		.ctl_name =	NET_IPV4_ROUTE_MIN_ADVMSS,
-		.procname =	"min_adv_mss",
-		.data =	&ip_rt_min_advmss,
-		.maxlen =		sizeof(int),
-		.mode =	0644,
-		.proc_handler =&proc_dointvec,
+		.ctl_name 	= NET_IPV4_ROUTE_FLUSH,
+		.procname	= "flush",
+		.data		= &flush_delay,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &ipv4_sysctl_rtcache_flush,
+		.strategy	= &ipv4_sysctl_rtcache_flush_strategy,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_MIN_DELAY,
+		.procname	= "min_delay",
+		.data		= &ip_rt_min_delay,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_jiffies,
+		.strategy	= &sysctl_jiffies,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_MAX_DELAY,
+		.procname	= "max_delay",
+		.data		= &ip_rt_max_delay,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_jiffies,
+		.strategy	= &sysctl_jiffies,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_GC_THRESH,
+		.procname	= "gc_thresh",
+		.data		= &ipv4_dst_ops.gc_thresh,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_MAX_SIZE,
+		.procname	= "max_size",
+		.data		= &ip_rt_max_size,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_GC_MIN_INTERVAL,
+		.procname	= "gc_min_interval",
+		.data		= &ip_rt_gc_min_interval,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_jiffies,
+		.strategy	= &sysctl_jiffies,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_GC_TIMEOUT,
+		.procname	= "gc_timeout",
+		.data		= &ip_rt_gc_timeout,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_jiffies,
+		.strategy	= &sysctl_jiffies,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_GC_INTERVAL,
+		.procname	= "gc_interval",
+		.data		= &ip_rt_gc_interval,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_jiffies,
+		.strategy	= &sysctl_jiffies,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_REDIRECT_LOAD,
+		.procname	= "redirect_load",
+		.data		= &ip_rt_redirect_load,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_REDIRECT_NUMBER,
+		.procname	= "redirect_number",
+		.data		= &ip_rt_redirect_number,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_REDIRECT_SILENCE,
+		.procname	= "redirect_silence",
+		.data		= &ip_rt_redirect_silence,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_ERROR_COST,
+		.procname	= "error_cost",
+		.data		= &ip_rt_error_cost,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_ERROR_BURST,
+		.procname	= "error_burst",
+		.data		= &ip_rt_error_burst,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_GC_ELASTICITY,
+		.procname	= "gc_elasticity",
+		.data		= &ip_rt_gc_elasticity,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_MTU_EXPIRES,
+		.procname	= "mtu_expires",
+		.data		= &ip_rt_mtu_expires,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_jiffies,
+		.strategy	= &sysctl_jiffies,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_MIN_PMTU,
+		.procname	= "min_pmtu",
+		.data		= &ip_rt_min_pmtu,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= NET_IPV4_ROUTE_MIN_ADVMSS,
+		.procname	= "min_adv_mss",
+		.data		= &ip_rt_min_advmss,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
 	},
-	 { 0 }
+	{ .ctl_name = 0 }
 };
 #endif
 
@@ -2658,6 +2658,12 @@
 					GFP_KERNEL);
 	if (!rt_cache_stat) 
 		goto out_enomem1;
+	for (i = 0; i < NR_CPUS; i++) {
+		if (cpu_possible(i)) {
+			memset(per_cpu_ptr(rt_cache_stat, i), 0,
+			       sizeof (struct rt_cache_stat));
+		}
+	}
 
 	devinet_init();
 	ip_fib_init();
diff -Nru a/net/ipv4/xfrm_policy.c b/net/ipv4/xfrm_policy.c
--- a/net/ipv4/xfrm_policy.c	Sun Feb 23 22:25:24 2003
+++ b/net/ipv4/xfrm_policy.c	Sun Feb 23 22:25:24 2003
@@ -1,3 +1,4 @@
+#include <linux/config.h>
 #include <net/xfrm.h>
 #include <net/ip.h>
 
@@ -197,6 +198,49 @@
 	read_unlock(&xfrm_type_lock);
 	return type;
 }
+
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+static struct xfrm_type *xfrm6_type_map[256];
+static rwlock_t xfrm6_type_lock = RW_LOCK_UNLOCKED;
+
+int xfrm6_register_type(struct xfrm_type *type)
+{
+	int err = 0;
+
+	write_lock(&xfrm6_type_lock);
+	if (xfrm6_type_map[type->proto] == NULL)
+		xfrm6_type_map[type->proto] = type;
+	else
+		err = -EEXIST;
+	write_unlock(&xfrm6_type_lock);
+	return err;
+}
+
+int xfrm6_unregister_type(struct xfrm_type *type)
+{
+	int err = 0;
+
+	write_lock(&xfrm6_type_lock);
+	if (xfrm6_type_map[type->proto] != type)
+		err = -ENOENT;
+	else
+		xfrm6_type_map[type->proto] = NULL;
+	write_unlock(&xfrm6_type_lock);
+	return err;
+}
+
+struct xfrm_type *xfrm6_get_type(u8 proto)
+{
+	struct xfrm_type *type;
+
+	read_lock(&xfrm6_type_lock);
+	type = xfrm6_type_map[proto];
+	if (type && !try_module_get(type->owner))
+		type = NULL;
+	read_unlock(&xfrm6_type_lock);
+	return type;
+}
+#endif /* CONFIG_IPV6 || CONFIG_IPV6_MODULE */
 
 void xfrm_put_type(struct xfrm_type *type)
 {
diff -Nru a/net/ipv4/xfrm_user.c b/net/ipv4/xfrm_user.c
--- a/net/ipv4/xfrm_user.c	Sun Feb 23 22:25:24 2003
+++ b/net/ipv4/xfrm_user.c	Sun Feb 23 22:25:24 2003
@@ -1,6 +1,13 @@
 /* xfrm_user.c: User interface to configure xfrm engine.
  *
  * Copyright (C) 2002 David S. Miller (davem@redhat.com)
+ *
+ * Changes
+ *
+ *	Mitsuru KANDA @USAGI       : IPv6 Support 
+ * 	Kazunori MIYAZAWA @USAGI   :
+ * 	Kunihiro Ishiguro          :
+ * 	
  */
 
 #include <linux/module.h>
@@ -17,6 +24,9 @@
 #include <linux/ipsec.h>
 #include <linux/init.h>
 #include <linux/security.h>
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+#include <linux/in6.h>
+#endif
 #include <net/sock.h>
 #include <net/xfrm.h>
 
@@ -63,10 +73,14 @@
 	case AF_INET:
 		break;
 
-	case AF_INET6: /* XXX */
+	case AF_INET6:
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+		break;
+#else
 		err = -EAFNOSUPPORT;
+		goto out;
+#endif
 
-		/* fallthru */
 	default:
 		goto out;
 	};
@@ -171,7 +185,19 @@
 		goto error;
 
 	err = -ENOENT;
-	x->type = xfrm_get_type(x->id.proto);
+	switch (x->props.family) {
+	case AF_INET:
+		x->type = xfrm_get_type(x->id.proto);
+		break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+	case AF_INET6:
+		x->type = xfrm6_get_type(x->id.proto);
+		break;
+#endif
+	default:
+		x->type = NULL;
+		break;
+	}
 	if (x->type == NULL)
 		goto error;
 
@@ -206,8 +232,21 @@
 	if (!x)
 		return err;
 
-	x1 = xfrm_state_lookup(x->props.saddr.xfrm4_addr,
-			       x->id.spi, x->id.proto);
+	switch (x->props.family) {
+	case AF_INET:
+		x1 = xfrm_state_lookup(x->props.saddr.xfrm4_addr,
+				       x->id.spi, x->id.proto);
+		break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+	case AF_INET6:
+		x1 = xfrm6_state_lookup((struct in6_addr*)x->props.saddr.a6,
+					x->id.spi, x->id.proto);
+		break;
+#endif
+	default:
+		x1 = NULL;
+		break;
+	}
 	if (x1) {
 		xfrm_state_put(x);
 		xfrm_state_put(x1);
@@ -224,7 +263,19 @@
 	struct xfrm_state *x;
 	struct xfrm_usersa_id *p = NLMSG_DATA(nlh);
 
-	x = xfrm_state_lookup(p->saddr.xfrm4_addr, p->spi, p->proto);
+	switch (p->family) {
+	case AF_INET:
+		x = xfrm_state_lookup(p->saddr.xfrm4_addr, p->spi, p->proto);
+		break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+	case AF_INET6:
+		x = xfrm6_state_lookup((struct in6_addr*)p->saddr.a6, p->spi, p->proto);
+		break;
+#endif
+	default:
+		x = NULL;
+		break;
+	}
 	if (x == NULL)
 		return -ESRCH;
 
@@ -342,7 +393,19 @@
 	struct sk_buff *resp_skb;
 	int err;
 
-	x = xfrm_state_lookup(p->saddr.xfrm4_addr, p->spi, p->proto);
+	switch (p->family) {
+	case AF_INET:
+		x = xfrm_state_lookup(p->saddr.xfrm4_addr, p->spi, p->proto);
+		break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+	case AF_INET6:
+		x = xfrm6_state_lookup((struct in6_addr*)p->saddr.a6, p->spi, p->proto);
+		break;
+#endif
+	default:
+		x = NULL;
+		break;
+	}
 	err = -ESRCH;
 	if (x == NULL)
 		goto out_noput;
@@ -393,9 +456,23 @@
 	err = verify_userspi_info(p);
 	if (err)
 		goto out_noput;
-	x = xfrm_find_acq(p->info.mode, p->info.reqid, p->info.id.proto,
-			  p->info.sel.daddr.xfrm4_addr,
-			  p->info.sel.saddr.xfrm4_addr, 1);
+	switch (p->info.family) {
+	case AF_INET:
+		x = xfrm_find_acq(p->info.mode, p->info.reqid, p->info.id.proto,
+				  p->info.sel.daddr.xfrm4_addr,
+				  p->info.sel.saddr.xfrm4_addr, 1);
+		break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+	case AF_INET6:
+		x = xfrm6_find_acq(p->info.mode, p->info.reqid, p->info.id.proto,
+				   (struct in6_addr*)p->info.sel.daddr.a6,
+				   (struct in6_addr*)p->info.sel.saddr.a6, 1);
+		break;
+#endif
+	default:
+		x = NULL;
+		break;
+	}
 	err = -ENOENT;
 	if (x == NULL)
 		goto out_noput;
diff -Nru a/net/ipv6/Makefile b/net/ipv6/Makefile
--- a/net/ipv6/Makefile	Sun Feb 23 22:25:25 2003
+++ b/net/ipv6/Makefile	Sun Feb 23 22:25:25 2003
@@ -11,5 +11,3 @@
 		ip6_flowlabel.o ipv6_syms.o
 
 obj-$(CONFIG_NETFILTER)	+= netfilter/
-
-obj-y += xfrm_policy.o
diff -Nru a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
--- a/net/ipv6/addrconf.c	Sun Feb 23 22:25:26 2003
+++ b/net/ipv6/addrconf.c	Sun Feb 23 22:25:26 2003
@@ -136,6 +136,10 @@
 	MAX_RTR_SOLICITATION_DELAY,	/* rtr solicit delay	*/
 };
 
+/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
+const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
+const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
+
 int ipv6_addr_type(struct in6_addr *addr)
 {
 	u32 st;
diff -Nru a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
--- a/net/ipv6/af_inet6.c	Sun Feb 23 22:25:24 2003
+++ b/net/ipv6/af_inet6.c	Sun Feb 23 22:25:24 2003
@@ -67,11 +67,9 @@
 			      module for allowing unload */
 #endif
 
-#if defined(MODULE) && LINUX_VERSION_CODE > 0x20115
 MODULE_AUTHOR("Cast of dozens");
 MODULE_DESCRIPTION("IPv6 protocol stack for Linux");
 MODULE_PARM(unloadable, "i");
-#endif
 
 /* IPv6 procfs goodies... */
 
@@ -571,6 +569,7 @@
 	struct list_head *lh;
 	struct inet_protosw *answer;
 	int protocol = p->protocol;
+	struct list_head *last_perm;
 
 	br_write_lock_bh(BR_NETPROTO_LOCK);
 
@@ -579,24 +578,29 @@
 
 	/* If we are trying to override a permanent protocol, bail. */
 	answer = NULL;
+	last_perm = &inetsw6[p->type];
 	list_for_each(lh, &inetsw6[p->type]) {
 		answer = list_entry(lh, struct inet_protosw, list);
 
 		/* Check only the non-wild match. */
-		if (protocol == answer->protocol &&
-		    (INET_PROTOSW_PERMANENT & answer->flags))
-			break;
+		if (INET_PROTOSW_PERMANENT & answer->flags) {
+			if (protocol == answer->protocol)
+				break;
+			last_perm = lh;
+		}
 
 		answer = NULL;
 	}
 	if (answer)
 		goto out_permanent;
 
-	/* Add to the BEGINNING so that we override any existing
-	 * entry.  This means that when we remove this entry, the
+	/* Add the new entry after the last permanent entry if any, so that
+	 * the new entry does not override a permanent entry when matched with
+	 * a wild-card protocol. But it is allowed to override any existing
+	 * non-permanent entry.  This means that when we remove this entry, the 
 	 * system automatically returns to the old behavior.
 	 */
-	list_add(&p->list, &inetsw6[p->type]);
+	list_add(&p->list, last_perm);
 out:
 	br_write_unlock_bh(BR_NETPROTO_LOCK);
 	return;
diff -Nru a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
--- a/net/ipv6/exthdrs.c	Sun Feb 23 22:25:21 2003
+++ b/net/ipv6/exthdrs.c	Sun Feb 23 22:25:21 2003
@@ -288,7 +288,7 @@
 	dst_release(xchg(&skb->dst, NULL));
 	ip6_route_input(skb);
 	if (skb->dst->error) {
-		skb->dst->input(skb);
+		dst_input(skb);
 		return -1;
 	}
 	if (skb->dst->dev->flags&IFF_LOOPBACK) {
@@ -302,7 +302,7 @@
 		goto looped_back;
 	}
 
-	skb->dst->input(skb);
+	dst_input(skb);
 	return -1;
 }
 
diff -Nru a/net/ipv6/icmp.c b/net/ipv6/icmp.c
--- a/net/ipv6/icmp.c	Sun Feb 23 22:25:23 2003
+++ b/net/ipv6/icmp.c	Sun Feb 23 22:25:23 2003
@@ -705,9 +705,15 @@
 
 #ifdef CONFIG_SYSCTL
 ctl_table ipv6_icmp_table[] = {
-	{NET_IPV6_ICMP_RATELIMIT, "ratelimit",
-	&sysctl_icmpv6_time, sizeof(int), 0644, NULL, &proc_dointvec},
-	{0},
+	{
+		.ctl_name	= NET_IPV6_ICMP_RATELIMIT,
+		.procname	= "ratelimit",
+		.data		= &sysctl_icmpv6_time,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec
+	},
+	{ .ctl_name = 0 },
 };
 #endif
 
diff -Nru a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
--- a/net/ipv6/ip6_input.c	Sun Feb 23 22:25:25 2003
+++ b/net/ipv6/ip6_input.c	Sun Feb 23 22:25:25 2003
@@ -47,7 +47,7 @@
 	if (skb->dst == NULL)
 		ip6_route_input(skb);
 
-	return skb->dst->input(skb);
+	return dst_input(skb);
 }
 
 int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
@@ -235,7 +235,7 @@
 				skb2 = skb;
 			}
 
-			dst->output(skb2);
+			dst_output(skb2);
 		}
 	}
 #endif
diff -Nru a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
--- a/net/ipv6/ip6_output.c	Sun Feb 23 22:25:21 2003
+++ b/net/ipv6/ip6_output.c	Sun Feb 23 22:25:21 2003
@@ -174,7 +174,7 @@
 		}
 	}
 #endif /* CONFIG_NETFILTER */
-	return skb->dst->output(skb);
+	return dst_output(skb);
 }
 
 /*
@@ -722,7 +722,7 @@
 
 static inline int ip6_forward_finish(struct sk_buff *skb)
 {
-	return skb->dst->output(skb);
+	return dst_output(skb);
 }
 
 int ip6_forward(struct sk_buff *skb)
diff -Nru a/net/ipv6/ipv6_syms.c b/net/ipv6/ipv6_syms.c
--- a/net/ipv6/ipv6_syms.c	Sun Feb 23 22:25:25 2003
+++ b/net/ipv6/ipv6_syms.c	Sun Feb 23 22:25:25 2003
@@ -4,7 +4,6 @@
 #include <net/ipv6.h>
 #include <net/addrconf.h>
 #include <net/ip6_route.h>
-#include <net/xfrm.h>
 
 EXPORT_SYMBOL(ipv6_addr_type);
 EXPORT_SYMBOL(icmpv6_send);
@@ -26,6 +25,3 @@
 EXPORT_SYMBOL(inet6_ioctl);
 EXPORT_SYMBOL(ipv6_get_saddr);
 EXPORT_SYMBOL(ipv6_chk_addr);
-EXPORT_SYMBOL(xfrm6_register_type);
-EXPORT_SYMBOL(xfrm6_unregister_type);
-EXPORT_SYMBOL(xfrm6_get_type);
diff -Nru a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
--- a/net/ipv6/reassembly.c	Sun Feb 23 22:25:23 2003
+++ b/net/ipv6/reassembly.c	Sun Feb 23 22:25:23 2003
@@ -22,6 +22,7 @@
  *
  *      Horst von Brand Add missing #include <linux/string.h>
  *	Alexey Kuznetsov	SMP races, threading, cleanup.
+ *	Patrick McHardy		LRU queue of frag heads for evictor.
  */
 #include <linux/config.h>
 #include <linux/errno.h>
@@ -31,6 +32,7 @@
 #include <linux/sockios.h>
 #include <linux/jiffies.h>
 #include <linux/net.h>
+#include <linux/list.h>
 #include <linux/netdevice.h>
 #include <linux/in6.h>
 #include <linux/ipv6.h>
@@ -67,6 +69,7 @@
 struct frag_queue
 {
 	struct frag_queue	*next;
+	struct list_head lru_list;		/* lru list member	*/
 
 	__u32			id;		/* fragment id		*/
 	struct in6_addr		saddr;
@@ -95,6 +98,7 @@
 
 static struct frag_queue *ip6_frag_hash[IP6Q_HASHSZ];
 static rwlock_t ip6_frag_lock = RW_LOCK_UNLOCKED;
+static LIST_HEAD(ip6_frag_lru_list);
 int ip6_frag_nqueues = 0;
 
 static __inline__ void __fq_unlink(struct frag_queue *fq)
@@ -102,6 +106,7 @@
 	if(fq->next)
 		fq->next->pprev = fq->pprev;
 	*fq->pprev = fq->next;
+	list_del(&fq->lru_list);
 	ip6_frag_nqueues--;
 }
 
@@ -193,38 +198,30 @@
 
 static void ip6_evictor(void)
 {
-	int i, progress;
+	struct frag_queue *fq;
+	struct list_head *tmp;
 
-	do {
+	for(;;) {
 		if (atomic_read(&ip6_frag_mem) <= sysctl_ip6frag_low_thresh)
 			return;
-		progress = 0;
-		for (i = 0; i < IP6Q_HASHSZ; i++) {
-			struct frag_queue *fq;
-			if (ip6_frag_hash[i] == NULL)
-				continue;
-
-			read_lock(&ip6_frag_lock);
-			if ((fq = ip6_frag_hash[i]) != NULL) {
-				/* find the oldest queue for this hash bucket */
-				while (fq->next)
-					fq = fq->next;
-				atomic_inc(&fq->refcnt);
-				read_unlock(&ip6_frag_lock);
-
-				spin_lock(&fq->lock);
-				if (!(fq->last_in&COMPLETE))
-					fq_kill(fq);
-				spin_unlock(&fq->lock);
-
-				fq_put(fq);
-				IP6_INC_STATS_BH(Ip6ReasmFails);
-				progress = 1;
-				continue;
-			}
+		read_lock(&ip6_frag_lock);
+		if (list_empty(&ip6_frag_lru_list)) {
 			read_unlock(&ip6_frag_lock);
+			return;
 		}
-	} while (progress);
+		tmp = ip6_frag_lru_list.next;
+		fq = list_entry(tmp, struct frag_queue, lru_list);
+		atomic_inc(&fq->refcnt);
+		read_unlock(&ip6_frag_lock);
+
+		spin_lock(&fq->lock);
+		if (!(fq->last_in&COMPLETE))
+			fq_kill(fq);
+		spin_unlock(&fq->lock);
+
+		fq_put(fq);
+		IP6_INC_STATS_BH(Ip6ReasmFails);
+	}
 }
 
 static void ip6_frag_expire(unsigned long data)
@@ -294,6 +291,8 @@
 		fq->next->pprev = &fq->next;
 	ip6_frag_hash[hash] = fq;
 	fq->pprev = &ip6_frag_hash[hash];
+	INIT_LIST_HEAD(&fq->lru_list);
+	list_add_tail(&fq->lru_list, &ip6_frag_lru_list);
 	ip6_frag_nqueues++;
 	write_unlock(&ip6_frag_lock);
 	return fq;
@@ -501,6 +500,9 @@
 		fq->nhoffset = nhoff;
 		fq->last_in |= FIRST_IN;
 	}
+	write_lock(&ip6_frag_lock);
+	list_move_tail(&fq->lru_list, &ip6_frag_lru_list);
+	write_unlock(&ip6_frag_lock);
 	return;
 
 err:
diff -Nru a/net/ipv6/xfrm_policy.c b/net/ipv6/xfrm_policy.c
--- a/net/ipv6/xfrm_policy.c	Sun Feb 23 22:25:25 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,43 +0,0 @@
-#include <net/xfrm.h>
-#include <net/ip.h>
-
-static struct xfrm_type *xfrm6_type_map[256];
-static rwlock_t xfrm6_type_lock = RW_LOCK_UNLOCKED;
-
-int xfrm6_register_type(struct xfrm_type *type)
-{
-	int err = 0;
-
-	write_lock(&xfrm6_type_lock);
-	if (xfrm6_type_map[type->proto] == NULL)
-		xfrm6_type_map[type->proto] = type;
-	else
-		err = -EEXIST;
-	write_unlock(&xfrm6_type_lock);
-	return err;
-}
-
-int xfrm6_unregister_type(struct xfrm_type *type)
-{
-	int err = 0;
-
-	write_lock(&xfrm6_type_lock);
-	if (xfrm6_type_map[type->proto] != type)
-		err = -ENOENT;
-	else
-		xfrm6_type_map[type->proto] = NULL;
-	write_unlock(&xfrm6_type_lock);
-	return err;
-}
-
-struct xfrm_type *xfrm6_get_type(u8 proto)
-{
-	struct xfrm_type *type;
-
-	read_lock(&xfrm6_type_lock);
-	type = xfrm6_type_map[proto];
-	if (type && !try_module_get(type->owner))
-		type = NULL;
-	read_unlock(&xfrm6_type_lock);
-	return type;
-}
diff -Nru a/net/key/af_key.c b/net/key/af_key.c
--- a/net/key/af_key.c	Sun Feb 23 22:25:22 2003
+++ b/net/key/af_key.c	Sun Feb 23 22:25:22 2003
@@ -10,6 +10,7 @@
  *		David S. Miller	<davem@redhat.com>
  *		Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
  *		Kunihiro Ishiguro <kunihiro@ipinfusion.com>
+ *		Kazunori MIYAZAWA / USAGI Project <miyazawa@linux-ipv6.org>
  */
 
 #include <linux/config.h>
diff -Nru a/net/netrom/sysctl_net_netrom.c b/net/netrom/sysctl_net_netrom.c
--- a/net/netrom/sysctl_net_netrom.c	Sun Feb 23 22:25:22 2003
+++ b/net/netrom/sysctl_net_netrom.c	Sun Feb 23 22:25:22 2003
@@ -34,50 +34,150 @@
 static struct ctl_table_header *nr_table_header;
 
 static ctl_table nr_table[] = {
-        {NET_NETROM_DEFAULT_PATH_QUALITY, "default_path_quality",
-         &sysctl_netrom_default_path_quality, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_quality, &max_quality},
-        {NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER, "obsolescence_count_initialiser",
-         &sysctl_netrom_obsolescence_count_initialiser, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_obs, &max_obs},
-        {NET_NETROM_NETWORK_TTL_INITIALISER, "network_ttl_initialiser",
-         &sysctl_netrom_network_ttl_initialiser, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_ttl, &max_ttl},
-        {NET_NETROM_TRANSPORT_TIMEOUT, "transport_timeout",
-         &sysctl_netrom_transport_timeout, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_t1, &max_t1},
-        {NET_NETROM_TRANSPORT_MAXIMUM_TRIES, "transport_maximum_tries",
-         &sysctl_netrom_transport_maximum_tries, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_n2, &max_n2},
-        {NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY, "transport_acknowledge_delay",
-         &sysctl_netrom_transport_acknowledge_delay, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_t2, &max_t2},
-        {NET_NETROM_TRANSPORT_BUSY_DELAY, "transport_busy_delay",
-         &sysctl_netrom_transport_busy_delay, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_t4, &max_t4},
-        {NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE, "transport_requested_window_size",
-         &sysctl_netrom_transport_requested_window_size, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_window, &max_window},
-        {NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT, "transport_no_activity_timeout",
-         &sysctl_netrom_transport_no_activity_timeout, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_idle, &max_idle},
-        {NET_NETROM_ROUTING_CONTROL, "routing_control",
-         &sysctl_netrom_routing_control, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_route, &max_route},
-        {NET_NETROM_LINK_FAILS_COUNT, "link_fails_count",
-         &sysctl_netrom_link_fails_count, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_fails, &max_fails},
-	{0}
+        {
+		.ctl_name	= NET_NETROM_DEFAULT_PATH_QUALITY,
+		.procname	= "default_path_quality",
+		.data		= &sysctl_netrom_default_path_quality,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_quality,
+		.extra2		= &max_quality
+	},
+        {
+		.ctl_name	= NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER,
+		.procname	= "obsolescence_count_initialiser",
+		.data		= &sysctl_netrom_obsolescence_count_initialiser,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+ 		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_obs,
+		.extra2		= &max_obs
+	},
+        {
+		.ctl_name	= NET_NETROM_NETWORK_TTL_INITIALISER,
+		.procname	= "network_ttl_initialiser",
+		.data		= &sysctl_netrom_network_ttl_initialiser,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_ttl,
+		.extra2		= &max_ttl
+	},
+        {
+		.ctl_name	= NET_NETROM_TRANSPORT_TIMEOUT,
+		.procname	= "transport_timeout",
+		.data		= &sysctl_netrom_transport_timeout,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_t1,
+		.extra2		= &max_t1
+	},
+        {
+		.ctl_name	= NET_NETROM_TRANSPORT_MAXIMUM_TRIES,
+		.procname	= "transport_maximum_tries",
+		.data		= &sysctl_netrom_transport_maximum_tries,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_n2,
+		.extra2		= &max_n2
+	},
+        {
+		.ctl_name	= NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY,
+		.procname	= "transport_acknowledge_delay",
+		.data		= &sysctl_netrom_transport_acknowledge_delay,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_t2,
+		.extra2		= &max_t2
+	},
+        {
+		.ctl_name	= NET_NETROM_TRANSPORT_BUSY_DELAY,
+		.procname	= "transport_busy_delay",
+		.data		= &sysctl_netrom_transport_busy_delay,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_t4,
+		.extra2		= &max_t4
+	},
+        {
+		.ctl_name	= NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE,
+		.procname	= "transport_requested_window_size",
+		.data		= &sysctl_netrom_transport_requested_window_size,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_window,
+		.extra2		= &max_window
+	},
+        {
+		.ctl_name	= NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT,
+		.procname	= "transport_no_activity_timeout",
+		.data		= &sysctl_netrom_transport_no_activity_timeout,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_idle,
+		.extra2		= &max_idle
+	},
+        {
+		.ctl_name	= NET_NETROM_ROUTING_CONTROL,
+		.procname	= "routing_control",
+		.data		= &sysctl_netrom_routing_control,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_route,
+		.extra2		= &max_route
+	},
+        {
+		.ctl_name	= NET_NETROM_LINK_FAILS_COUNT,
+		.procname	= "link_fails_count",
+		.data		= &sysctl_netrom_link_fails_count,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_fails,
+		.extra2		= &max_fails
+	},
+	{ .ctl_name = 0 }
 };
 
 static ctl_table nr_dir_table[] = {
-	{NET_NETROM, "netrom", NULL, 0, 0555, nr_table},
-	{0}
+	{
+		.ctl_name	= NET_NETROM,
+		.procname	= "netrom",
+		.maxlen		= 0,
+		.mode		= 0555,
+		.child		= nr_table
+	},
+	{ .ctl_name = 0 }
 };
 
 static ctl_table nr_root_table[] = {
-	{CTL_NET, "net", NULL, 0, 0555, nr_dir_table},
-	{0}
+	{
+		.ctl_name	= CTL_NET,
+		.procname	= "net",
+		.maxlen		= 0,
+		.mode		= 0555,
+		.child		= nr_dir_table
+	},
+	{ .ctl_name = 0 }
 };
 
 void __init nr_register_sysctl(void)
diff -Nru a/net/netsyms.c b/net/netsyms.c
--- a/net/netsyms.c	Sun Feb 23 22:25:23 2003
+++ b/net/netsyms.c	Sun Feb 23 22:25:23 2003
@@ -328,6 +328,9 @@
 EXPORT_SYMBOL(xfrm6_state_lookup);
 EXPORT_SYMBOL(xfrm6_find_acq);
 EXPORT_SYMBOL(xfrm6_alloc_spi);
+EXPORT_SYMBOL(xfrm6_register_type);
+EXPORT_SYMBOL(xfrm6_unregister_type);
+EXPORT_SYMBOL(xfrm6_get_type);
 #endif
 
 EXPORT_SYMBOL_GPL(xfrm_probe_algs);
diff -Nru a/net/rose/sysctl_net_rose.c b/net/rose/sysctl_net_rose.c
--- a/net/rose/sysctl_net_rose.c	Sun Feb 23 22:25:21 2003
+++ b/net/rose/sysctl_net_rose.c	Sun Feb 23 22:25:21 2003
@@ -25,47 +25,139 @@
 static struct ctl_table_header *rose_table_header;
 
 static ctl_table rose_table[] = {
-        {NET_ROSE_RESTART_REQUEST_TIMEOUT, "restart_request_timeout",
-         &sysctl_rose_restart_request_timeout, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_timer, &max_timer},
-        {NET_ROSE_CALL_REQUEST_TIMEOUT, "call_request_timeout",
-         &sysctl_rose_call_request_timeout, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_timer, &max_timer},
-        {NET_ROSE_RESET_REQUEST_TIMEOUT, "reset_request_timeout",
-         &sysctl_rose_reset_request_timeout, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_timer, &max_timer},
-        {NET_ROSE_CLEAR_REQUEST_TIMEOUT, "clear_request_timeout",
-         &sysctl_rose_clear_request_timeout, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_timer, &max_timer},
-        {NET_ROSE_NO_ACTIVITY_TIMEOUT, "no_activity_timeout",
-         &sysctl_rose_no_activity_timeout, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_idle, &max_idle},
-        {NET_ROSE_ACK_HOLD_BACK_TIMEOUT, "acknowledge_hold_back_timeout",
-         &sysctl_rose_ack_hold_back_timeout, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_timer, &max_timer},
-        {NET_ROSE_ROUTING_CONTROL, "routing_control",
-         &sysctl_rose_routing_control, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_route, &max_route},
-        {NET_ROSE_LINK_FAIL_TIMEOUT, "link_fail_timeout",
-         &sysctl_rose_link_fail_timeout, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_ftimer, &max_ftimer},
-        {NET_ROSE_MAX_VCS, "maximum_virtual_circuits",
-         &sysctl_rose_maximum_vcs, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_maxvcs, &max_maxvcs},
-        {NET_ROSE_WINDOW_SIZE, "window_size",
-         &sysctl_rose_window_size, sizeof(int), 0644, NULL,
-         &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_window, &max_window},
-	{0}
+        {
+		.ctl_name	= NET_ROSE_RESTART_REQUEST_TIMEOUT,
+		.procname	= "restart_request_timeout",
+		.data		= &sysctl_rose_restart_request_timeout,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_timer,
+		.extra2		= &max_timer
+	},
+        {
+		.ctl_name	= NET_ROSE_CALL_REQUEST_TIMEOUT,
+		.procname	= "call_request_timeout",
+		.data		= &sysctl_rose_call_request_timeout,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_timer,
+		.extra2		= &max_timer
+	},
+        {
+		.ctl_name	= NET_ROSE_RESET_REQUEST_TIMEOUT,
+		.procname	= "reset_request_timeout",
+		.data		= &sysctl_rose_reset_request_timeout,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_timer,
+		.extra2		= &max_timer
+	},
+        {
+		.ctl_name	= NET_ROSE_CLEAR_REQUEST_TIMEOUT,
+		.procname	= "clear_request_timeout",
+		.data		= &sysctl_rose_clear_request_timeout,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_timer,
+		.extra2		= &max_timer
+	},
+        {
+		.ctl_name	= NET_ROSE_NO_ACTIVITY_TIMEOUT,
+		.procname	= "no_activity_timeout",
+		.data		= &sysctl_rose_no_activity_timeout,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_idle,
+		.extra2		= &max_idle
+	},
+        {
+		.ctl_name	= NET_ROSE_ACK_HOLD_BACK_TIMEOUT,
+		.procname	= "acknowledge_hold_back_timeout",
+		.data		= &sysctl_rose_ack_hold_back_timeout,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_timer,
+		.extra2		= &max_timer
+	},
+        {
+		.ctl_name	= NET_ROSE_ROUTING_CONTROL,
+		.procname	= "routing_control",
+		.data		= &sysctl_rose_routing_control,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_route,
+		.extra2		= &max_route
+	},
+        {
+		.ctl_name	= NET_ROSE_LINK_FAIL_TIMEOUT,
+		.procname	= "link_fail_timeout",
+		.data		= &sysctl_rose_link_fail_timeout,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_ftimer,
+		.extra2		= &max_ftimer
+	},
+        {
+		.ctl_name	= NET_ROSE_MAX_VCS,
+		.procname	= "maximum_virtual_circuits",
+		.data		= &sysctl_rose_maximum_vcs,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_maxvcs,
+		.extra2		= &max_maxvcs
+	},
+        {
+		.ctl_name	= NET_ROSE_WINDOW_SIZE,
+		.procname	= "window_size",
+		.data		= &sysctl_rose_window_size,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec_minmax,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &min_window,
+		.extra2		= &max_window
+	},
+	{ .ctl_name = 0 }
 };
 
 static ctl_table rose_dir_table[] = {
-	{NET_ROSE, "rose", NULL, 0, 0555, rose_table},
-	{0}
+	{
+		.ctl_name	= NET_ROSE,
+		.procname	= "rose",
+		.maxlen		= 0,
+		.mode		= 0555,
+		.child		= rose_table
+	},
+	{ .ctl_name = 0 }
 };
 
 static ctl_table rose_root_table[] = {
-	{CTL_NET, "net", NULL, 0, 0555, rose_dir_table},
-	{0}
+	{
+		.ctl_name	= CTL_NET,
+		.procname	= "net",
+		.maxlen		= 0,
+		.mode		= 0555,
+		.child		= rose_dir_table
+	},
+	{ .ctl_name = 0 }
 };
 
 void __init rose_register_sysctl(void)
diff -Nru a/net/rxrpc/sysctl.c b/net/rxrpc/sysctl.c
--- a/net/rxrpc/sysctl.c	Sun Feb 23 22:25:23 2003
+++ b/net/rxrpc/sysctl.c	Sun Feb 23 22:25:23 2003
@@ -29,16 +29,50 @@
 static struct ctl_table_header *rxrpc_sysctl = NULL;
 
 static ctl_table rxrpc_sysctl_table[] = {
-        { 1, "kdebug", &rxrpc_kdebug, sizeof(int), 0644, NULL, &proc_dointvec },
-        { 2, "ktrace", &rxrpc_ktrace, sizeof(int), 0644, NULL, &proc_dointvec },
-        { 3, "kproto", &rxrpc_kproto, sizeof(int), 0644, NULL, &proc_dointvec },
-        { 4, "knet",   &rxrpc_knet,   sizeof(int), 0644, NULL, &proc_dointvec },
-	{ 0 }
+        {
+		.ctl_name	= 1,
+		.procname	= "kdebug",
+		.data		= &rxrpc_kdebug,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec
+	},
+        {
+		.ctl_name	= 2,
+		.procname	= "ktrace",
+		.data		= &rxrpc_ktrace,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec
+	},
+        {
+		.ctl_name	= 3,
+		.procname	= "kproto",
+		.data		= &rxrpc_kproto,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec
+	},
+        {
+		.ctl_name	= 4,
+		.procname	= "knet",
+		.data		= &rxrpc_knet,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec
+	},
+	{ .ctl_name = 0 }
 };
 
 static ctl_table rxrpc_dir_sysctl_table[] = {
-	{ 1, "rxrpc", NULL, 0, 0555, rxrpc_sysctl_table },
-	{ 0 }
+	{
+		.ctl_name	= 1,
+		.procname	= "rxrpc",
+		.maxlen		= 0,
+		.mode		= 0555,
+		.child		= rxrpc_sysctl_table
+	},
+	{ .ctl_name = 0 }
 };
 #endif /* CONFIG_SYSCTL */
 
diff -Nru a/net/sched/sch_atm.c b/net/sched/sch_atm.c
--- a/net/sched/sch_atm.c	Sun Feb 23 22:25:24 2003
+++ b/net/sched/sch_atm.c	Sun Feb 23 22:25:24 2003
@@ -492,7 +492,7 @@
 				(void) flow->q->ops->requeue(skb,flow->q);
 				break;
 			}
-			D2PRINTK("atm_tc_deqeueue: sending on class %p\n",flow);
+			D2PRINTK("atm_tc_dequeue: sending on class %p\n",flow);
 			/* remove any LL header somebody else has attached */
 			skb_pull(skb,(char *) skb->nh.iph-(char *) skb->data);
 			if (skb_headroom(skb) < flow->hdr_len) {
diff -Nru a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
--- a/net/sctp/ulpqueue.c	Sun Feb 23 22:25:26 2003
+++ b/net/sctp/ulpqueue.c	Sun Feb 23 22:25:26 2003
@@ -154,7 +154,7 @@
 	return 0;
 }
 
-/* Add a new event for propogation to the ULP.  */
+/* Add a new event for propagation to the ULP.  */
 int sctp_ulpq_tail_event(struct sctp_ulpq *ulpq, struct sctp_ulpevent *event)
 {
 	struct sock *sk = ulpq->asoc->base.sk;
diff -Nru a/net/sunrpc/auth.c b/net/sunrpc/auth.c
--- a/net/sunrpc/auth.c	Sun Feb 23 22:25:24 2003
+++ b/net/sunrpc/auth.c	Sun Feb 23 22:25:24 2003
@@ -8,6 +8,7 @@
 
 #include <linux/types.h>
 #include <linux/sched.h>
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/errno.h>
 #include <linux/socket.h>
@@ -65,6 +66,8 @@
 
 	if (flavor >= RPC_AUTH_MAXFLAVOR || !(ops = auth_flavors[flavor]))
 		return NULL;
+	if (!try_module_get(ops->owner))
+		return NULL;
 	clnt->cl_auth = ops->create(clnt, pseudoflavor);
 	return clnt->cl_auth;
 }
@@ -73,6 +76,8 @@
 rpcauth_destroy(struct rpc_auth *auth)
 {
 	auth->au_ops->destroy(auth);
+	module_put(auth->au_ops->owner);
+	kfree(auth);
 }
 
 static spinlock_t rpc_credcache_lock = SPIN_LOCK_UNLOCKED;
diff -Nru a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
--- a/net/sunrpc/auth_gss/auth_gss.c	Sun Feb 23 22:25:24 2003
+++ b/net/sunrpc/auth_gss/auth_gss.c	Sun Feb 23 22:25:24 2003
@@ -438,8 +438,6 @@
 	struct rpc_auth * auth;
 
 	dprintk("RPC: creating GSS authenticator for client %p\n",clnt);
-	if (!try_module_get(THIS_MODULE))
-		return NULL;
 	if (!(gss_auth = kmalloc(sizeof(*gss_auth), GFP_KERNEL)))
 		goto out_dec;
 	gss_auth->mech = gss_pseudoflavor_to_mech(flavor);
@@ -470,7 +468,6 @@
 err_free:
 	kfree(gss_auth);
 out_dec:
-	module_put(THIS_MODULE);
 	return NULL;
 }
 
@@ -485,9 +482,6 @@
 	rpc_unlink(gss_auth->path);
 
 	rpcauth_free_credcache(auth);
-
-	kfree(auth);
-	module_put(THIS_MODULE);
 }
 
 /* gss_destroy_cred (and gss_destroy_ctx) are used to clean up after failure
@@ -691,6 +685,7 @@
 }
 
 static struct rpc_authops authgss_ops = {
+	.owner		= THIS_MODULE,
 	.au_flavor	= RPC_AUTH_GSS,
 #ifdef RPC_DEBUG
 	.au_name	= "RPCSEC_GSS",
diff -Nru a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c
--- a/net/sunrpc/auth_null.c	Sun Feb 23 22:25:27 2003
+++ b/net/sunrpc/auth_null.c	Sun Feb 23 22:25:27 2003
@@ -8,6 +8,7 @@
 
 #include <linux/types.h>
 #include <linux/socket.h>
+#include <linux/module.h>
 #include <linux/in.h>
 #include <linux/utsname.h>
 #include <linux/sunrpc/clnt.h>
@@ -41,7 +42,6 @@
 {
 	dprintk("RPC: destroying NULL authenticator %p\n", auth);
 	rpcauth_free_credcache(auth);
-	kfree(auth);
 }
 
 /*
@@ -125,6 +125,7 @@
 }
 
 struct rpc_authops	authnull_ops = {
+	.owner		= THIS_MODULE,
 	.au_flavor	= RPC_AUTH_NULL,
 #ifdef RPC_DEBUG
 	.au_name	= "NULL",
diff -Nru a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
--- a/net/sunrpc/auth_unix.c	Sun Feb 23 22:25:25 2003
+++ b/net/sunrpc/auth_unix.c	Sun Feb 23 22:25:25 2003
@@ -8,6 +8,7 @@
 
 #include <linux/types.h>
 #include <linux/sched.h>
+#include <linux/module.h>
 #include <linux/socket.h>
 #include <linux/in.h>
 #include <linux/sunrpc/clnt.h>
@@ -60,7 +61,6 @@
 {
 	dprintk("RPC: destroying UNIX authenticator %p\n", auth);
 	rpcauth_free_credcache(auth);
-	kfree(auth);
 }
 
 static struct rpc_cred *
@@ -219,6 +219,7 @@
 }
 
 struct rpc_authops	authunix_ops = {
+	.owner		= THIS_MODULE,
 	.au_flavor	= RPC_AUTH_UNIX,
 #ifdef RPC_DEBUG
 	.au_name	= "UNIX",
diff -Nru a/net/sunrpc/svcauth.c b/net/sunrpc/svcauth.c
--- a/net/sunrpc/svcauth.c	Sun Feb 23 22:25:25 2003
+++ b/net/sunrpc/svcauth.c	Sun Feb 23 22:25:25 2003
@@ -52,7 +52,7 @@
 	return aops->accept(rqstp, authp);
 }
 
-/* A reqeust, which was authenticated, has now executed.
+/* A request, which was authenticated, has now executed.
  * Time to finalise the the credentials and verifier
  * and release and resources
  */
diff -Nru a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
--- a/net/sunrpc/svcsock.c	Sun Feb 23 22:25:22 2003
+++ b/net/sunrpc/svcsock.c	Sun Feb 23 22:25:22 2003
@@ -388,7 +388,7 @@
 	/* send tail */
 	if (xdr->tail[0].iov_len) {
 		/* The tail *will* be in respages[0]; */
-		result = sock->ops->sendpage(sock, rqstp->rq_respages[0], 
+		result = sock->ops->sendpage(sock, rqstp->rq_respages[rqstp->rq_restailpage], 
 					     ((unsigned long)xdr->tail[0].iov_base)& (PAGE_SIZE-1),
 					     xdr->tail[0].iov_len, 0);
 
diff -Nru a/scripts/Makefile b/scripts/Makefile
--- a/scripts/Makefile	Sun Feb 23 22:25:24 2003
+++ b/scripts/Makefile	Sun Feb 23 22:25:24 2003
@@ -14,6 +14,8 @@
 
 modpost-objs  := modpost.o file2alias.o
 
+clean-files := elfconfig.h
+
 # Let clean descend into subdirs
 subdir-	:= lxdialog kconfig
 
diff -Nru a/scripts/checkhelp.pl b/scripts/checkhelp.pl
--- a/scripts/checkhelp.pl	Sun Feb 23 22:25:22 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,30 +0,0 @@
-#!/usr/bin/perl
-# checkhelp.pl - finds configuration options that have no
-#                corresponding section in the help file
-#
-# made by Meelis Roos (mroos@tartu.cyber.ee)
-
-# read the help file
-@options=split /\n/, `grep '^CONFIG' Documentation/Configure.help`;
-die "Can't read Documentation/Configure.help\n" if $#options == -1;
-
-#read all the files
-foreach $file (@ARGV)
-{
-	open (FILE, $file) || die "Can't open $file: $!\n";
-	while (<FILE>) {
-		# repeat until no CONFIG_* are left
-		while (/^\s*(bool|tristate|dep_tristate|string|int|hex).*' *(.*)'.*(CONFIG_\w*)/) {
-			$what=$3;
-			$name=$2;
-			s/$3//;
-			@found = grep (/$what$/, @options);
-			if ($#found == -1) {
-				next if $nohelp{$what};
-				print "$name\n$what\n  No help for $what\n\n";
-				$nohelp{$what}=1;
-			}
-		}
-	}
-	close (FILE);
-}
diff -Nru a/scripts/header.tk b/scripts/header.tk
--- a/scripts/header.tk	Sun Feb 23 22:25:27 2003
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,627 +0,0 @@
-# FILE: header.tk
-# This file is boilerplate TCL/TK function definitions for 'make xconfig'.
-#
-# CHANGES
-# =======
-#
-# 8 January 1999, Michael Elizabeth Chastain, <mec@shout.net>
-# - Remove unused do_cmd function (part of the 2.0 sound support).
-# - Arrange buttons in three columns for better screen fitting.
-# - Add CONSTANT_Y, CONSTANT_M, CONSTANT_N for commands like:
-#     dep_tristate 'foo' CONFIG_FOO m
-#
-# 23 January 1999, Michael Elizabeth Chastain, <mec@shout.net>
-# - Shut vfix the hell up.
-#
-# 24 January 1999, Michael Elizabeth Chastain, <mec@shout.net>
-# - Improve the exit message (Jeff Ronne).
-
-#
-# This is a handy replacement for ".widget cget" that requires neither tk4
-# nor additional source code uglification.
-#
-proc cget { w option } {
-	return "[lindex [$w configure $option] 4]"
-}
-
-#
-# Function to compensate for broken config.in scripts like the sound driver,
-# which make dependencies on variables that are never even conditionally
-# defined.
-#
-proc vfix { var } {
-	global $var
-	if [ catch {eval concat $$var} ] {
-		set $var 4
-	}
-}
-
-#
-# Constant values used by certain dep_tristate commands.
-#
-set CONSTANT_Y 1
-set CONSTANT_M 2
-set CONSTANT_N 0
-set CONSTANT_E 4
-
-#
-# Create a "reference" object to steal colors from.
-#
-button .ref
-
-#
-# On monochrome displays, -disabledforeground is blank by default; that's
-# bad.  Fill it with -foreground instead.
-#
-if { [cget .ref -disabledforeground] == "" } {
-	.ref configure -disabledforeground [cget .ref -foreground]
-}
-
-
-#
-# Define some macros we will need to parse the config.in file.
-#
-
-proc mainmenu_name { text } {
-	wm title . "$text"
-}
-
-proc menu_option { w menu_num text } {
-	global menus_per_column
-	global processed_top_level
-	set processed_top_level [expr $processed_top_level + 1]
-	if { $processed_top_level <= $menus_per_column } then {
-	    set myframe left
-	} elseif { $processed_top_level <= [expr 2 * $menus_per_column] } then {
-	    set myframe middle
-	} else {
-	    set myframe right
-	} 
-	button .f0.x$menu_num -anchor w -text "$text" \
-	    -command "$w .$w \"$text\""
-	pack .f0.x$menu_num -pady 0 -side top -fill x -in .f0.$myframe
-}
-
-proc load_configfile { w title func } {
-	catch {destroy $w}
-	toplevel $w -class Dialog
-	global loadfile
-	frame $w.x
-	label $w.bm -bitmap questhead
-	pack  $w.bm -pady 10 -side top -padx 10
-	label $w.x.l -text "Enter filename:" -relief raised
-	entry $w.x.x -width 35 -relief sunken -borderwidth 2 \
-		-textvariable loadfile
-	pack $w.x.l $w.x.x -anchor w -side left
-	pack $w.x -side top -pady 10
-	wm title $w "$title" 
-
-	set oldFocus [focus]
-	frame $w.f
-	button $w.f.back -text "OK" -width 20 \
-		-command "destroy $w; focus $oldFocus;$func .fileio"
-	button $w.f.canc -text "Cancel" \
-		-width 20 -command "destroy $w; focus $oldFocus"
-	pack $w.f.back $w.f.canc -side left -pady 10 -padx 45
-	pack $w.f -pady 10 -side bottom -padx 10 -anchor w
-	focus $w
-	global winx; global winy
-	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
-	wm geometry $w +$winx+$winy
-}
-
-bind all <Alt-q> {maybe_exit .maybe}
-
-proc maybe_exit { w } {
-	catch {destroy $w}
-	toplevel $w -class Dialog
-	label $w.bm -bitmap questhead
-	pack  $w.bm -pady 10 -side top -padx 10
-	message $w.m -width 400 -aspect 300 \
-		-text "Changes will be lost.  Are you sure?" -relief flat
-	pack  $w.m -pady 10 -side top -padx 10
-	wm title $w "Are you sure?" 
-
-	set oldFocus [focus]
-	frame $w.f
-	button $w.f.back -text "OK" -width 20 \
-		-command "exit"
-	button $w.f.canc -text "Cancel" \
-		-width 20 -command "destroy $w; focus $oldFocus"
-	pack $w.f.back $w.f.canc -side left -pady 10 -padx 45
-	pack $w.f -pady 10 -side bottom -padx 10 -anchor w
-  	bind $w <Return> "exit"
-    	bind $w <Escape> "destroy $w; focus $oldFocus"
-	focus $w
-	global winx; global winy
-	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
-	wm geometry $w +$winx+$winy
-}
-
-proc read_config_file { w } {
-	global loadfile
-	if { [string length $loadfile] != 0 && [file readable $loadfile] == 1 } then {
-		read_config $loadfile
-	} else {
-		catch {destroy $w}
-		toplevel $w -class Dialog
-		message $w.m -width 400 -aspect 300 -text \
-			"Unable to read file $loadfile" \
-			 -relief raised 
-		label $w.bm -bitmap error
-		pack $w.bm $w.m -pady 10 -side top -padx 10
-		wm title $w "Xconfig Internal Error" 
-
-		set oldFocus [focus]
-		frame $w.f
-		button $w.f.back -text "Bummer" \
-			-width 10 -command "destroy $w; focus $oldFocus"
-		pack $w.f.back -side bottom -pady 10 -anchor s
-		pack $w.f -pady 10 -side top -padx 10 -anchor s
-		focus $w
-		global winx; global winy
-		set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
-		wm geometry $w +$winx+$winy
-	}
-}
-
-proc write_config_file  { w } {
-	global loadfile
-	if { [string length $loadfile] != 0 
-    		&& ([file writable $loadfile] == 1 || ([file exists $loadfile] == 0 && [file writable [file dirname $loadfile]] == 1)) } then {
-		writeconfig $loadfile /dev/null
-	} else {
-		catch {destroy $w}
-		toplevel $w -class Dialog
-		message $w.m -width 400 -aspect 300 -text \
-			"Unable to write file $loadfile" \
-			 -relief raised 
-		label $w.bm -bitmap error
-		pack $w.bm $w.m -pady 10 -side top -padx 10
-		wm title $w "Xconfig Internal Error" 
-
-		set oldFocus [focus]
-		frame $w.f
-		button $w.f.back -text "OK" \
-			-width 10 -command "destroy $w; focus $oldFocus"
-		pack $w.f.back -side bottom -pady 10 -anchor s
-		pack $w.f -pady 10 -side top -padx 10 -anchor s
-		focus $w
-		global winx; global winy
-		set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
-		wm geometry $w +$winx+$winy
-	}
-}
-
-proc read_config { filename } {
-	set file1 [open $filename r]
-	clear_choices
-	while { [gets $file1 line] >= 0} {
-		if [regexp {([0-9A-Za-z_]+)=([ynm])} $line foo var value] {
-			if { $value == "y" } then { set cmd "global $var; set $var 1" }
-			if { $value == "n" } then { set cmd "global $var; set $var 0" }
-			if { $value == "m" } then { set cmd "global $var; set $var 2" }
-			eval $cmd
-		}
-		if [regexp {# ([0-9A-Za-z_]+) is not set} $line foo var] {
-			set cmd "global $var; set $var 0"
-			eval $cmd
-		}
-		if [regexp {([0-9A-Za-z_]+)=([0-9A-Fa-f]+)} $line foo var value] {
-			set cmd "global $var; set $var $value"
-			eval $cmd
-		}
-		if [regexp {([0-9A-Za-z_]+)="([^"]*)"} $line foo var value] {
-			set cmd "global $var; set $var \"$value\""
-			eval $cmd
-		}
-	}
-	close $file1
-	update_choices
-	update_mainmenu
-}
-proc write_comment { file1 file2 text } {
-    	puts $file1 ""
-	puts $file1 "#"
-	puts $file1 "# $text"
-	puts $file1 "#"
-	puts $file2 "/*"
-	puts $file2 " * $text"
-	puts $file2 " */"
-}
-
-proc effective_dep { deplist } {
-	global CONFIG_MODULES
-	set depend 1
-	foreach i $deplist {
-		if {$i == 0} then {set depend 0}
-		if {$i == 2 && $depend == 1} then {set depend 2}
-	}
-	if {$depend == 2 && $CONFIG_MODULES == 0} then {set depend 0}
-	return $depend
-}
-
-proc sync_tristate { var dep } {
-	global CONFIG_MODULES
-	if {$dep == 0 && ($var == 1 || $var == 2)} then {
-		set var 0
-	} elseif {$dep == 2 && $var == 1} then {
-		set var 2
-	} elseif {$var == 2 && $CONFIG_MODULES == 0} then {
-		if {$dep == 1} then {set var 1} else {set var 0}
-	}
-	return $var
-}
-
-proc sync_bool { var dep modset } {
-	set var [sync_tristate $var $dep]
-	if {$dep == 2 && $var == 2} then {
-		set var $modset
-	}
-	return $var
-}
-
-proc write_tristate { file1 file2 varname variable deplist modset } {
-	set variable [sync_tristate $variable [effective_dep $deplist]]
-	if { $variable == 2 } \
-		then { set variable $modset }
-	if { $variable == 1 } \
-		then { puts $file1 "$varname=y"; \
-		       puts $file2 "#define $varname 1" } \
-	elseif { $variable == 2 } \
-		then { puts $file1 "$varname=m"; \
-		       puts $file2 "#undef  $varname"; \
-		       puts $file2 "#define ${varname}_MODULE 1" } \
-	elseif { $variable == 0 } \
-		then { puts $file1 "# $varname is not set"; \
-		       puts $file2 "#undef  $varname"} \
-	else { \
-	    puts stdout "ERROR - Attempting to write value for unconfigured variable ($varname)." \
-	}
-}
-
-proc write_int { file1 file2 varname variable dep } {
-	if { $dep == 0 } \
-		then { puts $file1 "# $varname is not set"; \
-		       puts $file2 "#undef  $varname"} \
-	else {
-		puts $file1 "$varname=$variable"; \
-		puts $file2 "#define $varname ($variable)"; \
-	}
-}
-
-proc write_hex { file1 file2 varname variable dep } {
-	if { $dep == 0 } \
-		then { puts $file1 "# $varname is not set"; \
-		       puts $file2 "#undef  $varname"} \
-	else {
-		puts $file1 "$varname=$variable"; \
-		puts -nonewline $file2 "#define $varname 0x"; \
-		puts $file2 [exec echo $variable | sed s/^0\[xX\]//]; \
-	}
-}
-
-proc write_string { file1 file2 varname variable dep } {
-	if { $dep == 0 } \
-		then { puts $file1 "# $varname is not set"; \
-		       puts $file2 "#undef  $varname"} \
-	else {
-		puts $file1 "$varname=\"$variable\""; \
-		puts $file2 "#define $varname \"$variable\""; \
-	}
-}
-
-proc option_name {w mnum line text helpidx} {
-	button $w.x$line.l -text "$text" -relief groove -anchor w
-	$w.x$line.l configure -activefore [cget $w.x$line.l -fg] \
-				-activeback [cget $w.x$line.l -bg]
-	button $w.x$line.help -text "Help" -relief raised \
-		-command "dohelp .dohelp $helpidx .menu$mnum"
-	pack $w.x$line.help -side right -fill y
-	pack $w.x$line.l -side right -fill both -expand on
-}
-
-proc toggle_switch2 {w mnum line text variable} {
-	frame $w.x$line -relief sunken
-	radiobutton $w.x$line.y -text "y" -variable $variable -value 1 \
-		-relief groove -width 2 -command "update_active"
-	radiobutton $w.x$line.m -text "-"  -variable $variable -value 2 \
-		-relief groove -width 2 -command "update_active"
-	radiobutton $w.x$line.n -text "n"  -variable $variable -value 0 \
-		-relief groove -width 2 -command "update_active"
-
-	option_name $w $mnum $line $text $variable
-
-	pack $w.x$line.n $w.x$line.m $w.x$line.y -side right -fill y
-}
-
-proc toggle_switch3 {w mnum line text variable} {
-	frame $w.x$line -relief sunken
-	radiobutton $w.x$line.y -text "y" -variable $variable -value 1 \
-		-relief groove -width 2 -command "update_active"
-	radiobutton $w.x$line.m -text "m"  -variable $variable -value 2 \
-		-relief groove -width 2 -command "update_active"
-	radiobutton $w.x$line.n -text "n"  -variable $variable -value 0 \
-		-relief groove -width 2 -command "update_active"
-
-	option_name $w $mnum $line $text $variable
-
-	global CONFIG_MODULES
-	if {($CONFIG_MODULES == 0)} then {
-		$w.x$line.m configure -state disabled
-	}
-	pack $w.x$line.n $w.x$line.m $w.x$line.y -side right -fill y
-}
-
-proc bool {w mnum line text variable} {
-	toggle_switch2 $w $mnum $line $text $variable
-	$w.x$line.m configure -state disabled
-	pack $w.x$line -anchor w -fill both -expand on
-}
-
-proc tristate {w mnum line text variable } {
-	toggle_switch3 $w $mnum $line $text $variable
-	pack $w.x$line -anchor w -fill both -expand on
-}
-
-proc dep_tristate {w mnum line text variable } {
-	tristate $w $mnum $line $text $variable
-}
-
-proc dep_bool {w mnum line text variable } {
-	bool $w $mnum $line $text $variable
-}
-
-proc int { w mnum line text variable } {
-	frame $w.x$line
-	entry $w.x$line.x -width 18 -relief sunken -borderwidth 2 \
-		-textvariable $variable
-	option_name $w $mnum $line $text $variable
-	pack $w.x$line.x -anchor w -side right -fill y
-	pack $w.x$line -anchor w -fill both -expand on
-}
-
-proc hex { w mnum line text variable } {
-	int $w $mnum $line $text $variable
-}
-
-proc istring { w mnum line text variable } {
-	frame $w.x$line
-	entry $w.x$line.x -width 18 -relief sunken -borderwidth 2 \
-		-textvariable $variable
-	option_name $w $mnum $line $text $variable
-	pack $w.x$line.x -anchor w -side right -fill y
-	pack $w.x$line -anchor w -fill both -expand on
-}
-
-proc minimenu { w mnum line text variable helpidx } {
-	frame $w.x$line
-	menubutton $w.x$line.x -textvariable $variable -menu \
-		$w.x$line.x.menu -relief raised \
-		-anchor w
-	option_name $w $mnum $line $text $helpidx
-	pack $w.x$line.x -anchor w -side right -fill y
-	pack $w.x$line -anchor w -fill both -expand on
-}
-
-proc menusplit {w m n} {
-	if { $n > 2 } then {
-		update idletasks
-		set menuoptsize [expr [$m yposition 2] - [$m yposition 1]]   
-		set maxsize [winfo screenheight $w]
-		set splitpoint [expr $maxsize * 4 / 5 / $menuoptsize - 1]
-		for {set i [expr $splitpoint + 1]} {$i <= $n} {incr i $splitpoint} {
-			$m entryconfigure $i -columnbreak 1
-		}
-	}
-}
-
-proc menutitle {text menu w} {
-	wm title $w "$text"
-}
-
-proc submenu { w mnum line text subnum } {
-	frame $w.x$line
-	button $w.x$line.l -text "" -width 15 -relief groove
-	$w.x$line.l configure -activefore [cget $w.x$line.l -fg] \
-		-activeback [cget $w.x$line.l -bg] -state disabled
-	button $w.x$line.m -text "$text" -relief raised -anchor w \
-		-command "catch {destroy .menu$subnum}; menu$subnum .menu$subnum \"$text\""
-	pack $w.x$line.l -side left -fill both
-	pack $w.x$line.m -anchor w -side right -fill both -expand on
-	pack $w.x$line -anchor w -fill both -expand on
-}
-
-proc comment {w mnum line text } {
-	frame $w.x$line
-	button $w.x$line.l -text "" -width 15 -relief groove
-	$w.x$line.l configure -activefore [cget $w.x$line.l -fg] \
-		-activeback [cget $w.x$line.l -bg] -state disabled
-	button $w.x$line.m -text "$text" -relief groove -anchor w
-	$w.x$line.m configure -activefore [cget $w.x$line.m -fg] \
-		-activeback [cget $w.x$line.m -bg]
-	pack $w.x$line.l -side left -fill both
-	pack $w.x$line.m -anchor w -side right -fill both -expand on
-	pack $w.x$line -anchor w -fill both -expand on
-}
-
-proc dohelp {w var parent}  {
-	catch {destroy $w}
-	toplevel $w -class Dialog
-
-	set found 0
-
-	# First escape sed regexp special characters in var:
-	set var [exec echo "$var" | sed s/\[\]\[\/.^$*\]/\\\\&/g]
-	# Now pick out right help text:
-	set message [exec find . -name Config.help | xargs sed -n "
-		/^$var\[ 	\]*\$/,\${
-			/^$var\[ 	\]*\$/c\\
-${var}:\\
-
-			/^#/b
-			/^\[^ 	\]/q
-			s/^  //
-			/<file:\\(\[^>\]*\\)>/s//\\1/g
-			p
-		}
-		" /dev/null ]
-	set found [expr [string length "$message"] > 0]
-
-	frame $w.f1
-	pack $w.f1 -fill both -expand on
-
-	# Do the OK button
-	#
-	set oldFocus [focus]
-	frame $w.f2
-	button $w.f2.ok -text "OK" \
-		-width 10 -command "destroy $w; catch {focus $oldFocus}"
-	pack $w.f2.ok -side bottom -pady 6 -anchor n
-	pack $w.f2 -side bottom -padx 10 -anchor s
-
-	scrollbar $w.f1.vscroll -command "$w.f1.canvas yview"
-	pack $w.f1.vscroll -side right -fill y
-
-	canvas $w.f1.canvas -relief flat -borderwidth 0 \
-		-yscrollcommand "$w.f1.vscroll set"
-	frame $w.f1.f
-	pack $w.f1.canvas -side right -fill y -expand on
-
-	if { $found == 0 } then {
-		message $w.f1.f.m -width 400 -aspect 300 -relief flat -text \
-			"No help available for $var"
-		label $w.f1.bm -bitmap error
-		wm title $w "RTFM"
-	} else {
-		text $w.f1.f.m -width 73 -relief flat -wrap word
-		$w.f1.f.m insert 0.0 $message
-		$w.f1.f.m conf -state disabled -height [$w.f1.f.m index end]
-
-		label $w.f1.bm -bitmap info
-		wm title $w "Configuration help" 
-	}
-	pack $w.f1.f.m -side left
-	pack $w.f1.bm $w.f1.f -side left -padx 10
-
-	focus $w
-	set winx [expr [winfo x $parent]+20]
-	set winy [expr [winfo y $parent]+20]
-	wm geometry $w +$winx+$winy
-	set sizok [expr [winfo reqheight $w.f2.ok] + 12]
-	set maxy [expr [winfo screenheight .] * 3 / 4]
-	set canvtotal [winfo reqheight $w.f1.f.m]
-	if [expr $sizok + $canvtotal < $maxy] {
-		set sizy $canvtotal
-	} else {
-		set sizy [expr $maxy - $sizok]
-	}
-	$w.f1.canvas configure -height $sizy -width [winfo reqwidth $w.f1.f.m] \
-		-scrollregion "0 0 [winfo reqwidth $w.f1.f.m] \
-			[winfo reqheight $w.f1.f.m]"
-	$w.f1.canvas create window 0 0 -anchor nw -window $w.f1.f
-	update idletasks
-
-	set maxy [winfo screenheight .]
-	if [expr $sizok + $canvtotal < $maxy] {
-		set sizy [expr $sizok + $canvtotal]
-	} else {
-		set sizy $maxy
-	}
-	wm maxsize $w [winfo width $w] $sizy
-}
-
-bind all <Alt-s> { catch {exec cp -f .config .config.old}; \
-		writeconfig .config include/linux/autoconf.h; wrapup .wrap }
-
-proc wrapup {w }  {
-	catch {destroy $w}
-	toplevel $w -class Dialog
-
-	global CONFIG_MODVERSIONS; vfix CONFIG_MODVERSIONS
-	if { ([file exists .hdepend] != 1) || ($CONFIG_MODVERSIONS == 1) } then {
-	    message $w.m -width 400 -aspect 300 -relief raised -text \
-		"End of Linux kernel configuration.  Check the top-level Makefile for additional configuration.  Next, you must run 'make dep'."
-	} else {
-	    message $w.m -width 400 -aspect 300 -relief raised -text \
-		"End of Linux kernel configuration.  Check the top-level Makefile for additional configuration.  Next, you may 'make bzImage', 'make bzdisk', or 'make bzlilo.'"
-	}
-	label $w.bm -bitmap info
-	pack $w.bm $w.m -pady 10 -side top -padx 10
-	wm title $w "Kernel build instructions" 
-
-	set oldFocus [focus]
-	frame $w.f
-	button $w.f.back -text "OK" \
-		-width 10 -command "exit"
-	pack $w.f.back -side bottom -pady 10 -anchor s
-	pack $w.f -pady 10 -side top -padx 10 -anchor s
-	focus $w
-        bind $w <Return> "exit"
-	global winx; global winy
-	set winx [expr [winfo x .]+30]; set winy [expr [winfo y .]+30]
-	wm geometry $w +$winx+$winy
-
-}
-
-proc unregister_active {num} {
-	global active_menus
-	set index [lsearch -exact $active_menus $num]
-	if {$index != -1} then {set active_menus [lreplace $active_menus $index $index]}
-}
-
-proc update_active {} {
-	global active_menus total_menus
-	set max 0
-	if {[llength $active_menus] > 0} then {
-		set max [lindex $active_menus end]
-		update_define [toplevel_menu [lindex $active_menus 0]] $max 0
-	}
-	foreach i $active_menus {
-		if {[winfo exists .menu$i] == 0} then {
-			unregister_active $i
-		} else {
-			update_menu$i
-		}
-	}
-	update_define [expr $max + 1] $total_menus 1
-	update_mainmenu
-}
-
-proc configure_entry {w option items} {
-	foreach i $items {
-		$w.$i configure -state $option
-	}
-}
-
-proc validate_int {name val default} {
-	if {([exec echo $val | sed s/^-//g | tr -d \[:digit:\] ] != "")} then {
-		global $name; set $name $default
-	}
-}
-
-proc validate_hex {name val default} {
-	if {([exec echo $val | tr -d \[:xdigit:\] ] != "")} then {
-		global $name; set $name $default
-	}
-}
-
-proc update_define {first last allow_update} {
-	for {set i $first} {$i <= $last} {incr i} {
-		update_define_menu$i
-		if {$allow_update == 1} then update
-	}
-}
-
-#
-# Next set up the particulars for the top level menu, and define a few
-# buttons which we will stick down at the bottom.
-#
-
-frame .f0 
-frame .f0.left
-frame .f0.middle
-frame .f0.right
-
-set active_menus [list]
-set processed_top_level 0
diff -Nru a/scripts/modpost.c b/scripts/modpost.c
--- a/scripts/modpost.c	Sun Feb 23 22:25:22 2003
+++ b/scripts/modpost.c	Sun Feb 23 22:25:22 2003
@@ -384,6 +384,7 @@
 {
 	buf_printf(b, "#include <linux/module.h>\n");
 	buf_printf(b, "#include <linux/vermagic.h>\n");
+	buf_printf(b, "#include <linux/compiler.h>\n");
 	buf_printf(b, "\n");
 	buf_printf(b, "const char vermagic[]\n");
 	buf_printf(b, "__attribute__((section(\"__vermagic\"))) =\n");
@@ -449,6 +450,7 @@
 
 	buf_printf(b, "\n");
 	buf_printf(b, "static const char __module_depends[]\n");
+	buf_printf(b, "__attribute_used__\n");
 	buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n");
 	buf_printf(b, "\"depends=");
 	for (s = mod->unres; s; s = s->next) {
diff -Nru a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
--- a/sound/drivers/serial-u16550.c	Sun Feb 23 22:25:22 2003
+++ b/sound/drivers/serial-u16550.c	Sun Feb 23 22:25:22 2003
@@ -204,7 +204,7 @@
 
 /* This loop should be called with interrupts disabled
  * We don't want to interrupt this, 
- * as we're already handling an interupt 
+ * as we're already handling an interrupt 
  */
 static void snd_uart16550_io_loop(snd_uart16550_t * uart)
 {
@@ -274,16 +274,16 @@
  * ---------------------------
  * After receiving a interrupt, it is important to indicate to the UART that
  * this has been done. 
- * For a Rx interupt, this is done by reading the received byte.
- * For a Tx interupt this is done by either:
+ * For a Rx interrupt, this is done by reading the received byte.
+ * For a Tx interrupt this is done by either:
  * a) Writing a byte
  * b) Reading the IIR
- * It is particularly important to read the IIR if a Tx interupt is received
+ * It is particularly important to read the IIR if a Tx interrupt is received
  * when there is no data in tx_buff[], as in this case there no other
- * indication that the interupt has been serviced, and it remains outstanding
- * indefinitely. This has the curious side effect that and no further interupts
+ * indication that the interrupt has been serviced, and it remains outstanding
+ * indefinitely. This has the curious side effect that and no further interrupts
  * will be generated from this device AT ALL!!.
- * It is also desirable to clear outstanding interupts when the device is
+ * It is also desirable to clear outstanding interrupts when the device is
  * opened/closed.
  *
  *
@@ -300,7 +300,7 @@
 		spin_unlock(&uart->open_lock);
 		return;
 	}
-	inb(uart->base + UART_IIR);		/* indicate to the UART that the interupt has been serviced */
+	inb(uart->base + UART_IIR);		/* indicate to the UART that the interrupt has been serviced */
 	snd_uart16550_io_loop(uart);
 	spin_unlock(&uart->open_lock);
 }
@@ -378,7 +378,7 @@
 	     | UART_FCR_CLEAR_RCVR	/* Clear receiver FIFO */
 	     | UART_FCR_CLEAR_XMIT	/* Clear transmitter FIFO */
 	     | UART_FCR_TRIGGER_4	/* Set FIFO trigger at 4-bytes */
-	/* NOTE: interupt generated after T=(time)4-bytes
+	/* NOTE: interrupt generated after T=(time)4-bytes
 	 * if less than UART_FCR_TRIGGER bytes received
 	 */
 	     ,uart->base + UART_FCR);	/* FIFO Control Register */
@@ -430,8 +430,8 @@
 	}
 
 	if (uart->irq < 0) {
-		byte = (0 & UART_IER_RDI)	/* Disable Receiver data interupt */
-		    |(0 & UART_IER_THRI)	/* Disable Transmitter holding register empty interupt */
+		byte = (0 & UART_IER_RDI)	/* Disable Receiver data interrupt */
+		    |(0 & UART_IER_THRI)	/* Disable Transmitter holding register empty interrupt */
 		    ;
 	} else if (uart->adaptor == SNDRV_SERIAL_MS124W_SA) {
 		byte = UART_IER_RDI	/* Enable Receiver data interrupt */
@@ -440,11 +440,11 @@
 	} else if (uart->adaptor == SNDRV_SERIAL_GENERIC) {
 		byte = UART_IER_RDI	/* Enable Receiver data interrupt */
 		    | UART_IER_MSI	/* Enable Modem status interrupt */
-		    | UART_IER_THRI	/* Enable Transmitter holding register empty interupt */
+		    | UART_IER_THRI	/* Enable Transmitter holding register empty interrupt */
 		    ;
 	} else {
-		byte = UART_IER_RDI	/* Enable Receiver data interupt */
-		    | UART_IER_THRI	/* Enable Transmitter holding register empty interupt */
+		byte = UART_IER_RDI	/* Enable Receiver data interrupt */
+		    | UART_IER_THRI	/* Enable Transmitter holding register empty interrupt */
 		    ;
 	}
 	outb(byte, uart->base + UART_IER);	/* Interupt enable Register */
@@ -463,8 +463,8 @@
 	 * For now, the consequences are harmless.
 	 */
 
-	outb((0 & UART_IER_RDI)		/* Disable Receiver data interupt */
-	     |(0 & UART_IER_THRI)	/* Disable Transmitter holding register empty interupt */
+	outb((0 & UART_IER_RDI)		/* Disable Receiver data interrupt */
+	     |(0 & UART_IER_THRI)	/* Disable Transmitter holding register empty interrupt */
 	     ,uart->base + UART_IER);	/* Interupt enable Register */
 
 	switch (uart->adaptor) {
@@ -489,7 +489,7 @@
 		break;
 	}
 
-	inb(uart->base + UART_IIR);	/* Clear any outstanding interupts */
+	inb(uart->base + UART_IIR);	/* Clear any outstanding interrupts */
 
 	/* Restore old divisor */
 	if (uart->divisor != 0) {
diff -Nru a/sound/oss/Kconfig b/sound/oss/Kconfig
--- a/sound/oss/Kconfig	Sun Feb 23 22:25:26 2003
+++ b/sound/oss/Kconfig	Sun Feb 23 22:25:26 2003
@@ -225,7 +225,7 @@
 
 config SOUND_VWSND
 	tristate "SGI Visual Workstation Sound"
-	depends on SOUND_PRIME!=n && VISWS && SOUND
+	depends on SOUND_PRIME!=n && X86_VISWS && SOUND
 	help
 	  Say Y or M if you have an SGI Visual Workstation and you want to be
 	  able to use its on-board audio.  Read
diff -Nru a/sound/oss/mad16.c b/sound/oss/mad16.c
--- a/sound/oss/mad16.c	Sun Feb 23 22:25:25 2003
+++ b/sound/oss/mad16.c	Sun Feb 23 22:25:25 2003
@@ -17,7 +17,7 @@
  * to the PC bus and perform I/O, DMA and IRQ address decoding. There is
  * also a UART for the MPU-401 mode (not 82C928/Mozart).
  * The Mozart chip appears to be compatible with the 82C928, although later
- * issues of the card, using the OTI-605 chip, have an MPU-401 compatable Midi
+ * issues of the card, using the OTI-605 chip, have an MPU-401 compatible Midi
  * port. This port is configured differently to that of the OPTi audio chips.
  *
  *	Changes
diff -Nru a/sound/oss/maestro.c b/sound/oss/maestro.c
--- a/sound/oss/maestro.c	Sun Feb 23 22:25:26 2003
+++ b/sound/oss/maestro.c	Sun Feb 23 22:25:26 2003
@@ -1830,7 +1830,7 @@
 	if (s->dma_adc.ready) {
 		/* oh boy should this all be re-written.  everything in the current code paths think
 		that the various counters/pointers are expressed in bytes to the user but we have
-		two apus doing stereo stuff so we fix it up here.. it propogates to all the various
+		two apus doing stereo stuff so we fix it up here.. it propagates to all the various
 		counters from here.  */
 		if ( s->fmt & (ESS_FMT_STEREO << ESS_ADC_SHIFT)) {
 			hwptr = (get_dmac(s)*2) % s->dma_adc.dmasize;
diff -Nru a/sound/oss/rme96xx.c b/sound/oss/rme96xx.c
--- a/sound/oss/rme96xx.c	Sun Feb 23 22:25:23 2003
+++ b/sound/oss/rme96xx.c	Sun Feb 23 22:25:23 2003
@@ -604,7 +604,7 @@
 		     return 1;
 		}
 	}
-	COMM       ("interupt disabled");
+	COMM       ("interrupt disabled");
 	/* first initialize all pointers on card */
 	for(i=0;i<RME96xx_num_of_init_regs;i++){
 		writel(0,s->iobase + i);
diff -Nru a/sound/oss/sb_card.c b/sound/oss/sb_card.c
--- a/sound/oss/sb_card.c	Sun Feb 23 22:25:25 2003
+++ b/sound/oss/sb_card.c	Sun Feb 23 22:25:25 2003
@@ -1,1035 +1,329 @@
 /*
- * sound/sb_card.c
+ * sound/oss/sb_card.c
  *
- * Detection routine for the Sound Blaster cards.
+ * Detection routine for the ISA Sound Blaster and compatable sound
+ * cards.
  *
+ * This file is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
+ * Version 2 (June 1991). See the "COPYING" file distributed with this
+ * software for more info.
+ *
+ * This is a complete rewrite of the detection routines. This was
+ * prompted by the PnP API change during v2.5 and the ugly state the
+ * code was in.
+ *
+ * Copyright (C) by Paul Laufer 2002. Based on code originally by
+ * Hannu Savolainen which was modified by many others over the
+ * years. Authors specifically mentioned in the previous version were:
+ * Daniel Stone, Alessandro Zummo, Jeff Garzik, Arnaldo Carvalho de
+ * Melo, Daniel Church, and myself.
  *
- * Copyright (C) by Hannu Savolainen 1993-1997
- *
- * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
- * Version 2 (June 1991). See the "COPYING" file distributed with this software
- * for more info.
- *
- * 26-11-1999 Patched to compile without ISA PnP support in the
- * kernel - Daniel Stone (tamriel@ductape.net) 
- *
- * 06-01-2000 Refined and bugfixed ISA PnP support, added
- *  CMI 8330 support - Alessandro Zummo <azummo@ita.flashnet.it>
- *
- * 18-01-2000 Separated sb_card and sb_common
- *  Jeff Garzik <jgarzik@pobox.com>
- *
- * 04-02-2000 Added Soundblaster AWE 64 PnP support, isapnpjump
- *  Alessandro Zummo <azummo@ita.flashnet.it>
- *
- * 11-02-2000 Added Soundblaster AWE 32 PnP support, refined PnP code
- *  Alessandro Zummo <azummo@ita.flashnet.it>
- *
- * 13-02-2000 Hopefully fixed awe/sb16 related bugs, code cleanup
- *  Alessandro Zummo <azummo@ita.flashnet.it>
- *
- * 13-03-2000 Added some more cards, thanks to Torsten Werner.
- *  Removed joystick and wavetable code, there are better places for them.
- *  Code cleanup plus some fixes. 
- *  Alessandro Zummo <azummo@ita.flashnet.it>
- * 
- * 26-03-2000 Fixed acer, esstype and sm_games module options.
- *  Alessandro Zummo <azummo@ita.flashnet.it>
- *
- * 12-04-2000 ISAPnP cleanup, reorg, fixes, and multiple card support.
- *  Thanks to Gaël Quéri and Alessandro Zummo for testing and fixes.
- *  Paul E. Laufer <pelaufer@csupomona.edu>
- *
- * 06-05-2000 added another card. Daniel M. Newman <dmnewman@pobox.com>
- *
- * 25-05-2000 Added Creative SB AWE64 Gold (CTL00B2). 
- * 	Pål-Kristian Engstad <engstad@att.net>
- *
- * 12-08-2000 Added Creative SB32 PnP (CTL009F).
- * 	Kasatenko Ivan Alex. <skywriter@rnc.ru>
- *
- * 21-09-2000 Got rid of attach_sbmpu
- * 	Arnaldo Carvalho de Melo <acme@conectiva.com.br>
- *
- * 28-10-2000 Added pnplegacy support
- * 	Daniel Church <dchurch@mbhs.edu>
- *
- * 01-10-2001 Added a new flavor of Creative SB AWE64 PnP (CTL00E9).
- *      Jerome Cornet <jcornet@free.fr>
+ * 02-05-2003 Original Release, Paul Laufer <paul@laufernet.com>
+ * 02-07-2003 Bug made it into first release. Take two.
  */
 
 #include <linux/config.h>
-#include <linux/mca.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/init.h>
-#include <linux/isapnp.h>
-
+#ifdef CONFIG_MCA
+#include <linux/mca.h>
+#endif /* CONFIG_MCA */
 #include "sound_config.h"
-
 #include "sb_mixer.h"
 #include "sb.h"
-
-#ifdef __ISAPNP__
-#define SB_CARDS_MAX 5
-#else
-#define SB_CARDS_MAX 1
+#ifdef CONFIG_PNP_CARD
+#include <linux/pnp.h>
 #endif
+#include "sb_card.h"
 
-static int sbmpu[SB_CARDS_MAX] = {0};
-static int sb_cards_num = 0;
+MODULE_DESCRIPTION("OSS Soundblaster ISA PnP and legacy sound driver");
+MODULE_LICENSE("GPL");
 
 extern void *smw_free;
 
-/*
- *    Note DMA2 of -1 has the right meaning in the SB16 driver as well
- *    as here. It will cause either an error if it is needed or a fallback
- *    to the 8bit channel.
- */
-
 static int __initdata mpu_io	= 0;
 static int __initdata io	= -1;
 static int __initdata irq	= -1;
 static int __initdata dma	= -1;
-static int __initdata dma16	= -1;   /* Set this for modules that need it */
-static int __initdata type	= 0;    /* Can set this to a specific card type */
-static int __initdata esstype   = 0;	/* ESS chip type */
-static int __initdata acer 	= 0;	/* Do acer notebook init? */
-static int __initdata sm_games 	= 0;	/* Logitech soundman games? */
+static int __initdata dma16	= -1;
+static int __initdata type	= 0; /* Can set this to a specific card type */
+static int __initdata esstype   = 0; /* ESS chip type */
+static int __initdata acer 	= 0; /* Do acer notebook init? */
+static int __initdata sm_games 	= 0; /* Logitech soundman games? */
 
-static void __init attach_sb_card(struct address_info *hw_config)
-{
-	if(!sb_dsp_init(hw_config, THIS_MODULE))
-		hw_config->slots[0] = -1;
-}
+struct sb_card_config *legacy = NULL;
 
-static int __init probe_sb(struct address_info *hw_config)
-{
-	struct sb_module_options sbmo;
-
-	if (hw_config->io_base == -1 || hw_config->dma == -1 || hw_config->irq == -1)
-	{
-		printk(KERN_ERR "sb: I/O, IRQ, and DMA are mandatory\n");
-		return -EINVAL;
-	}
-
-#ifdef CONFIG_MCA
-	/* MCA code added by ZP Gu (zpg@castle.net) */
-	if (MCA_bus) {               /* no multiple REPLY card probing */
-		int slot;
-		u8 pos2, pos3, pos4;
-
-		slot = mca_find_adapter( 0x5138, 0 );
-		if( slot == MCA_NOTFOUND ) 
-		{
-			slot = mca_find_adapter( 0x5137, 0 );
-
-			if (slot != MCA_NOTFOUND)
-				mca_set_adapter_name( slot, "REPLY SB16 & SCSI Adapter" );
-		}
-		else
-		{
-			mca_set_adapter_name( slot, "REPLY SB16 Adapter" );
-		}
-
-		if (slot != MCA_NOTFOUND) 
-		{
-			mca_mark_as_used(slot);
-			pos2 = mca_read_stored_pos( slot, 2 );
-			pos3 = mca_read_stored_pos( slot, 3 );
-			pos4 = mca_read_stored_pos( slot, 4 );
-
-			if (pos2 & 0x4) 
-			{
-				/* enabled? */
-				static unsigned short irq[] = { 0, 5, 7, 10 };
-				/*
-				static unsigned short midiaddr[] = {0, 0x330, 0, 0x300 };
-       				*/
-
-				hw_config->io_base = 0x220 + 0x20 * (pos2 >> 6);
-				hw_config->irq = irq[(pos4 >> 5) & 0x3];
-				hw_config->dma = pos3 & 0xf;
-				/* Reply ADF wrong on High DMA, pos[1] should start w/ 00 */
-				hw_config->dma2 = (pos3 >> 4) & 0x3;
-				if (hw_config->dma2 == 0)
-					hw_config->dma2 = hw_config->dma;
-				else
-					hw_config->dma2 += 4;
-				/*
-					hw_config->driver_use_2 = midiaddr[(pos2 >> 3) & 0x3];
-				*/
-	
-				printk(KERN_INFO "sb: Reply MCA SB at slot=%d \
-iobase=0x%x irq=%d lo_dma=%d hi_dma=%d\n",
-						slot+1,
-				        	hw_config->io_base, hw_config->irq,
-	        				hw_config->dma, hw_config->dma2);
-			}
-			else
-			{
-				printk (KERN_INFO "sb: Reply SB Base I/O address disabled\n");
-			}
-		}
-	}
+#ifdef CONFIG_PNP_CARD
+static int __initdata pnp       = 1;
+/*
+static int __initdata uart401	= 0;
+*/
+#else
+static int __initdata pnp       = 0;
 #endif
 
-	/* Setup extra module options */
+module_param(io, int, 000);
+MODULE_PARM_DESC(io,       "Soundblaster i/o base address (0x220,0x240,0x260,0x280)");
+module_param(irq, int, 000);
+MODULE_PARM_DESC(irq,	   "IRQ (5,7,9,10)");
+module_param(dma, int, 000);
+MODULE_PARM_DESC(dma,	   "8-bit DMA channel (0,1,3)");
+module_param(dma16, int, 000);
+MODULE_PARM_DESC(dma16,	   "16-bit DMA channel (5,6,7)");
+module_param(mpu_io, int, 000);
+MODULE_PARM_DESC(mpu_io,   "MPU base address");
+module_param(type, int, 000);
+MODULE_PARM_DESC(type,	   "You can set this to specific card type (doesn't " \
+		 "work with pnp)");
+module_param(sm_games, int, 000);
+MODULE_PARM_DESC(sm_games, "Enable support for Logitech soundman games " \
+		 "(doesn't work with pnp)");
+module_param(esstype, int, 000);
+MODULE_PARM_DESC(esstype,  "ESS chip type (doesn't work with pnp)");
+module_param(acer, int, 000);
+MODULE_PARM_DESC(acer,	   "Set this to detect cards in some ACER notebooks "\
+		 "(doesn't work with pnp)");
+
+#ifdef CONFIG_PNP_CARD
+module_param(pnp, int, 000);
+MODULE_PARM_DESC(pnp,     "Went set to 0 will disable detection using PnP. "\
+		  "Default is 1.\n");
+/* Not done yet.... */
+/*
+module_param(uart401, int, 000);
+MODULE_PARM_DESC(uart401,  "When set to 1, will attempt to detect and enable"\
+		 "the mpu on some clones");
+*/
+#endif /* CONFIG_PNP_CARD */
 
-	sbmo.acer 	= acer;
-	sbmo.sm_games	= sm_games;
-	sbmo.esstype	= esstype;
+/* OSS subsystem card registration shared by PnP and legacy routines */
+static int sb_register_oss(struct sb_card_config *scc, struct sb_module_options *sbmo)
+{
+	if(!sb_dsp_detect(&scc->conf, 0, 0, sbmo)) {
+		printk(KERN_ERR "sb: Failed DSP Detect.\n");
+		kfree(scc);
+		return -ENODEV;
+	}
+	if(!sb_dsp_init(&scc->conf, THIS_MODULE)) {
+		printk(KERN_ERR "sb: Failed DSP init.\n");
+		kfree(scc);
+		return -ENODEV;
+	}
+	if(scc->mpucnf.io_base > 0) {
+		scc->mpu = 1;
+		printk(KERN_INFO "sb: Turning on MPU\n");
+		if(!probe_sbmpu(&scc->mpucnf, THIS_MODULE))
+			scc->mpu = 0;
+	}
 
-	return sb_dsp_detect(hw_config, 0, 0, &sbmo);
+	return 1;
 }
 
-static void __exit unload_sb(struct address_info *hw_config, int card)
+static void sb_unload(struct sb_card_config *scc)
 {
-	if(hw_config->slots[0]!=-1)
-		sb_dsp_unload(hw_config, sbmpu[card]);
+	sb_dsp_unload(&scc->conf, 0);
+	if(scc->mpu)
+		unload_sbmpu(&scc->mpucnf);
+	kfree(scc);
 }
 
-static struct address_info cfg[SB_CARDS_MAX];
-static struct address_info cfg_mpu[SB_CARDS_MAX];
-
-struct pci_dev 	*sb_dev[SB_CARDS_MAX] 	= {NULL}, 
-		*mpu_dev[SB_CARDS_MAX]	= {NULL},
-		*opl_dev[SB_CARDS_MAX]	= {NULL};
-
-
-#ifdef __ISAPNP__
-static int isapnp	= 1;
-static int isapnpjump	= 0;
-static int multiple	= 1;
-static int pnplegacy	= 0;
-static int reverse	= 0;
-static int uart401	= 0;
-
-static int audio_activated[SB_CARDS_MAX] = {0};
-static int mpu_activated[SB_CARDS_MAX]   = {0};
-static int opl_activated[SB_CARDS_MAX]   = {0};
-#else
-static int isapnp	= 0;
-static int multiple	= 0;
-static int pnplegacy	= 0;
-#endif
-
-MODULE_DESCRIPTION("Soundblaster driver");
-MODULE_LICENSE("GPL");
-
-MODULE_PARM(io,		"i");
-MODULE_PARM(irq,	"i");
-MODULE_PARM(dma,	"i");
-MODULE_PARM(dma16,	"i");
-MODULE_PARM(mpu_io,	"i");
-MODULE_PARM(type,	"i");
-MODULE_PARM(sm_games,	"i");
-MODULE_PARM(esstype,	"i");
-MODULE_PARM(acer,	"i");
-
-#ifdef __ISAPNP__
-MODULE_PARM(isapnp,	"i");
-MODULE_PARM(isapnpjump,	"i");
-MODULE_PARM(multiple,	"i");
-MODULE_PARM(pnplegacy,	"i");
-MODULE_PARM(reverse,	"i");
-MODULE_PARM(uart401,	"i");
-MODULE_PARM_DESC(isapnp,	"When set to 0, Plug & Play support will be disabled");
-MODULE_PARM_DESC(isapnpjump,	"Jumps to a specific slot in the driver's PnP table. Use the source, Luke.");
-MODULE_PARM_DESC(multiple,	"When set to 0, will not search for multiple cards");
-MODULE_PARM_DESC(pnplegacy,	"When set to 1, will search for a legacy SB card along with any PnP cards.");
-MODULE_PARM_DESC(reverse,	"When set to 1, will reverse ISAPnP search order");
-MODULE_PARM_DESC(uart401,	"When set to 1, will attempt to detect and enable the mpu on some clones");
-#endif
-
-MODULE_PARM_DESC(io,		"Soundblaster i/o base address (0x220,0x240,0x260,0x280)");
-MODULE_PARM_DESC(irq,		"IRQ (5,7,9,10)");
-MODULE_PARM_DESC(dma,		"8-bit DMA channel (0,1,3)");
-MODULE_PARM_DESC(dma16,		"16-bit DMA channel (5,6,7)");
-MODULE_PARM_DESC(mpu_io,	"Mpu base address");
-MODULE_PARM_DESC(type,		"You can set this to specific card type");
-MODULE_PARM_DESC(sm_games,	"Enable support for Logitech soundman games");
-MODULE_PARM_DESC(esstype,	"ESS chip type");
-MODULE_PARM_DESC(acer,		"Set this to detect cards in some ACER notebooks");
-
-#ifdef __ISAPNP__
-
-/* Please add new entries at the end of the table */
-static struct {
-	char *name; 
-	unsigned short	card_vendor, card_device, 
-			audio_vendor, audio_function,
-			mpu_vendor, mpu_function,
-			opl_vendor, opl_function;
-	short dma, dma2, mpu_io, mpu_irq; /* see sb_init() */
-} sb_isapnp_list[] __initdata = {
-	{"Sound Blaster 16", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0024),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster 16",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0025),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster 16", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0026), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster 16", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0027), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster 16", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0028), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster 16", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0029), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster 16",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002a),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster 16", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002b), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster 16", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002c), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster 16", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002c), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster 16", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00ed), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster 16", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0086), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster 16", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0086), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster Vibra16S", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0051), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0001),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster Vibra16C", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0070), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0001),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster Vibra16CL", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0080), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster Vibra16X", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00F0), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0043),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 32", 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0039), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 32",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0042), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 32",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0043), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 32",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0044),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-        {"Sound Blaster AWE 32",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0045),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 32",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0046),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 32",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0047),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 32",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0048), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 32",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0054), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 32",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x009C), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Creative SB32 PnP",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x009F),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 64",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x009D), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0042),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 64 Gold",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x009E), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0044),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 64 Gold",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00B2),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0044),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 64",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00C1), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0042),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 64",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00C3), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0045),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 64",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00C5), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0045),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 64",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00C7), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0045),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 64",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00E4), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0045),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 64",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00E9), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0045),
-		0,0,0,0,
-		0,1,1,-1},
-	{"ESS 1688",
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x0968), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x0968),
-		0,0,0,0,
-		0,1,2,-1},
-	{"ESS 1868",
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x1868), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x1868),
-		0,0,0,0,
-		0,1,2,-1},
-	{"ESS 1868",
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x1868), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x8611),
-		0,0,0,0,
-		0,1,2,-1},
-	{"ESS 1869 PnP AudioDrive", 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x0003), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x1869),
-		0,0,0,0,
-		0,1,2,-1},
-	{"ESS 1869",
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x1869), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x1869),
-		0,0,0,0,
-		0,1,2,-1},
-	{"ESS 1878",
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x1878), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x1878),
-		0,0,0,0,
-		0,1,2,-1},
-	{"ESS 1879",
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x1879), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x1879),
-		0,0,0,0,
-		0,1,2,-1},
-	{"CMI 8330 SoundPRO",
-		ISAPNP_VENDOR('C','M','I'), ISAPNP_DEVICE(0x0001), 
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x0001),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001),
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0001),
-		0,1,0,-1},
-	{"Diamond DT0197H",
-		ISAPNP_VENDOR('R','W','B'), ISAPNP_DEVICE(0x1688), 
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0001),
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x0001),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001),
-		0,-1,0,0},
-	{"ALS007",
-		ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0007),
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0001),
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x0001),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001),
-		0,-1,0,0},
-	{"ALS100",
-		ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0001), 
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0001),
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x0001),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001),
-		1,0,0,0},
-	{"ALS110",
-		ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0110),
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x1001),
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x1001),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001),
-		1,0,0,0},
-	{"ALS120",
-		ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0120),
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x2001),
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x2001),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001),
-		1,0,0,0},
-	{"ALS200",
-		ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0200),
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0020),
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x0020),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001),
-		1,0,0,0},
-	{"RTL3000",
-		ISAPNP_VENDOR('R','T','L'), ISAPNP_DEVICE(0x3000),
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x2001),
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x2001),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001),
-		1,0,0,0},
-	{0}
-};
-
-static struct isapnp_device_id id_table[] __devinitdata = {
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0024),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0025),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0026), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0027), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0028), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0029), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002a),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002b), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002c), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002c), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00ed), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0086), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0086), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0051), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0070), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0080), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00F0), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0043), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0039), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0042), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0043), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0044),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0045),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0048), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0054), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x009C), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x009F),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x009D), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0042), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x009E), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0044), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00B2),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0044), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00C1), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0042), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00C3), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0045), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00C5), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0045), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00C7), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0045), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00E4), 
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0045), 0 },
-
-	{	ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00E9),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0045), 0 },
-
-	{	ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x0968), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x0968), 0 },
-
-	{	ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x1868), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x1868), 0 },
-
-	{	ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x1868), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x8611), 0 },
-
-	{	ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x0003), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x1869), 0 },
-
-	{	ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x1869), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x1869), 0 },
-
-	{	ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x1878), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x1878), 0 },
-
-	{	ISAPNP_VENDOR('E','S','S'), ISAPNP_DEVICE(0x1879), 
-		ISAPNP_VENDOR('E','S','S'), ISAPNP_FUNCTION(0x1879), 0 },
-
-	{	ISAPNP_VENDOR('C','M','I'), ISAPNP_DEVICE(0x0001), 
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('C','M','I'), ISAPNP_DEVICE(0x0001), 
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('C','M','I'), ISAPNP_DEVICE(0x0001), 
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('R','W','B'), ISAPNP_DEVICE(0x1688), 
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('R','W','B'), ISAPNP_DEVICE(0x1688), 
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('R','W','B'), ISAPNP_DEVICE(0x1688), 
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0007),
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0007),
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0007),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0001), 
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0001), 
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0001), 
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0110),
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x1001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0110),
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x1001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0110),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0120),
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x2001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0120),
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x2001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0120),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0200),
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0020), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0200),
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x0020), 0 },
-
-	{	ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0200),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001), 0 },
-
-	{	ISAPNP_VENDOR('R','T','L'), ISAPNP_DEVICE(0x3000),
-		ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x2001), 0 },
+/* Register legacy card with OSS subsystem */
+static int sb_init_legacy(void)
+{
+	struct sb_module_options sbmo = {0};
 
-	{	ISAPNP_VENDOR('R','T','L'), ISAPNP_DEVICE(0x3000),
-		ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x2001), 0 },
+	if((legacy = kmalloc(sizeof(struct sb_card_config), GFP_KERNEL)) == NULL) {
+		printk(KERN_ERR "sb: Error: Could not allocate memory\n");
+		return -ENOMEM;
+	}
+	memset(legacy, 0, sizeof(struct sb_card_config));
+
+	legacy->conf.io_base      = io;
+	legacy->conf.irq          = irq;
+	legacy->conf.dma          = dma;
+	legacy->conf.dma2         = dma16;
+	legacy->conf.card_subtype = type;
+
+	legacy->mpucnf.io_base = mpu_io;
+	legacy->mpucnf.irq     = -1;
+	legacy->mpucnf.dma     = -1;
+	legacy->mpucnf.dma2    = -1;
+
+	sbmo.esstype  = esstype;
+	sbmo.sm_games = sm_games;
+	sbmo.acer     = acer;
 
-	{	ISAPNP_VENDOR('R','T','L'), ISAPNP_DEVICE(0x3000),
-		ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001), 0 },
-	{0}
-};
+	return sb_register_oss(legacy, &sbmo);
+}
 
-MODULE_DEVICE_TABLE(isapnp, id_table);
+#ifdef CONFIG_PNP_CARD
 
-static struct pci_dev *activate_dev(char *devname, char *resname, struct pci_dev *dev)
+/* Populate the OSS subsystem structures with information from PnP */
+static void sb_dev2cfg(struct pnp_dev *dev, struct sb_card_config *scc)
 {
-	int err;
-
-	/* Device already active? Let's use it */
-	if(dev->active)
-		return(dev);
-	
-	if((err = dev->activate(dev)) < 0) {
-		printk(KERN_ERR "sb: %s %s config failed (out of resources?)[%d]\n", devname, resname, err);
-
-		dev->deactivate(dev);
-
-		return(NULL);
+	scc->conf.io_base   = -1;
+	scc->conf.irq       = -1;
+	scc->conf.dma       = -1;
+	scc->conf.dma2      = -1;
+	scc->mpucnf.io_base = -1;
+	scc->mpucnf.irq     = -1;
+	scc->mpucnf.dma     = -1;
+	scc->mpucnf.dma2    = -1;
+
+	/* All clones layout their PnP tables differently and some use
+	   different logical devices for the MPU */
+	if(!strncmp("CTL",scc->card_id,3)) {
+		scc->conf.io_base   = pnp_port_start(dev,0);
+		scc->conf.irq       = pnp_irq(dev,0);
+		scc->conf.dma       = pnp_dma(dev,0);
+		scc->conf.dma2      = pnp_dma(dev,1);
+		scc->mpucnf.io_base = pnp_port_start(dev,1);
+		return;
+	}
+	if(!strncmp("ESS",scc->card_id,3)) {
+		scc->conf.io_base   = pnp_port_start(dev,0);
+		scc->conf.irq       = pnp_irq(dev,0);
+		scc->conf.dma       = pnp_dma(dev,0);
+		scc->conf.dma2      = pnp_dma(dev,1);
+	       	scc->mpucnf.io_base = pnp_port_start(dev,2);
+		return;
+	}
+	if(!strncmp("CMI",scc->card_id,3)) {
+		scc->conf.io_base = pnp_port_start(dev,0);
+		scc->conf.irq     = pnp_irq(dev,0);
+		scc->conf.dma     = pnp_dma(dev,0);
+		scc->conf.dma2    = pnp_dma(dev,1);
+		return;
+	}
+	if(!strncmp("RWB",scc->card_id,3)) {
+		scc->conf.io_base = pnp_port_start(dev,0);
+		scc->conf.irq     = pnp_irq(dev,0);
+		scc->conf.dma     = pnp_dma(dev,0);
+		return;
+	}
+	if(!strncmp("ALS",scc->card_id,3)) {
+		if(!strncmp("ALS0007",scc->card_id,7)) {
+			scc->conf.io_base = pnp_port_start(dev,0);
+			scc->conf.irq     = pnp_irq(dev,0);
+			scc->conf.dma     = pnp_dma(dev,0);
+		} else {
+			scc->conf.io_base = pnp_port_start(dev,0);
+			scc->conf.irq     = pnp_irq(dev,0);
+			scc->conf.dma     = pnp_dma(dev,1);
+			scc->conf.dma2    = pnp_dma(dev,0);
+		}
+		return;
+	}
+	if(!strncmp("RTL",scc->card_id,3)) {
+		scc->conf.io_base = pnp_port_start(dev,0);
+		scc->conf.irq     = pnp_irq(dev,0);
+		scc->conf.dma     = pnp_dma(dev,1);
+		scc->conf.dma2    = pnp_dma(dev,0);
 	}
-	return(dev);
 }
 
-static struct pci_dev *sb_init(struct pci_bus *bus, struct address_info *hw_config, struct address_info *mpu_config, int slot, int card)
+/* Probe callback function for the PnP API */
+static int sb_pnp_probe(struct pnp_card *card, const struct pnp_card_id *card_id)
 {
-
-	/* Configure Audio device */
-	if((sb_dev[card] = isapnp_find_dev(bus, sb_isapnp_list[slot].audio_vendor, sb_isapnp_list[slot].audio_function, NULL)))
-	{
-		int ret;
-		ret = sb_dev[card]->prepare(sb_dev[card]);
-		/* If device is active, assume configured with /proc/isapnp
-		 * and use anyway. Some other way to check this? */
-		if(ret && ret != -EBUSY) {
-			printk(KERN_ERR "sb: ISAPnP found device that could not be autoconfigured.\n");
-			return(NULL);
-		}
-		if(ret == -EBUSY)
-			audio_activated[card] = 1;
-		
-		if((sb_dev[card] = activate_dev(sb_isapnp_list[slot].name, "sb", sb_dev[card])))
-		{
-			hw_config->io_base 	= sb_dev[card]->resource[0].start;
-			hw_config->irq 		= sb_dev[card]->irq_resource[0].start;
-			hw_config->dma 		= sb_dev[card]->dma_resource[sb_isapnp_list[slot].dma].start;
-			if(sb_isapnp_list[slot].dma2 != -1)
-				hw_config->dma2 = sb_dev[card]->dma_resource[sb_isapnp_list[slot].dma2].start;
-			else
-				hw_config->dma2 = -1;
-		} else
-			return(NULL);
-	} else
-		return(NULL);
-
-	/* Cards with separate OPL3 device (ALS, CMI, etc.)
-	 * This is just to activate the device so the OPL module can use it */
-	if(sb_isapnp_list[slot].opl_vendor || sb_isapnp_list[slot].opl_function) {
-		if((opl_dev[card] = isapnp_find_dev(bus, sb_isapnp_list[slot].opl_vendor, sb_isapnp_list[slot].opl_function, NULL))) {
-			int ret = opl_dev[card]->prepare(opl_dev[card]);
-			/* If device is active, assume configured with
-			 * /proc/isapnp and use anyway */
-			if(ret && ret != -EBUSY) {
-				printk(KERN_ERR "sb: OPL device could not be autoconfigured.\n");
-				return(sb_dev[card]);
-			}
-			if(ret == -EBUSY)
-				opl_activated[card] = 1;
-
-			/* Some have irq and dma for opl. the opl3 driver wont
-			 * use 'em so don't configure 'em and hope it works -PEL */
-			opl_dev[card]->irq_resource[0].flags = 0;
-			opl_dev[card]->dma_resource[0].flags = 0;
-
-			opl_dev[card] = activate_dev(sb_isapnp_list[slot].name, "opl3", opl_dev[card]);
-		} else
-			printk(KERN_ERR "sb: %s isapnp panic: opl3 device not found\n", sb_isapnp_list[slot].name);
+	struct sb_card_config *scc;
+	struct sb_module_options sbmo = {0}; /* Default to 0 for PnP */
+	struct pnp_dev *dev = pnp_request_card_device(card, card_id->devs[0].id, NULL);
+	
+	if(!dev){
+		return -EBUSY;
 	}
 
-	/* Cards with MPU as part of Audio device (CTL and ESS) */
-	if(!sb_isapnp_list[slot].mpu_vendor) {
-		mpu_config->io_base	= sb_dev[card]->resource[sb_isapnp_list[slot].mpu_io].start;
-		return(sb_dev[card]);
-	}
-	
-	/* Cards with separate MPU device (ALS, CMI, etc.) */
-	if(!uart401)
-		return(sb_dev[card]);
-	if((mpu_dev[card] = isapnp_find_dev(bus, sb_isapnp_list[slot].mpu_vendor, sb_isapnp_list[slot].mpu_function, NULL)))
-	{
-		int ret = mpu_dev[card]->prepare(mpu_dev[card]);
-		/* If device is active, assume configured with /proc/isapnp
-		 * and use anyway */
-		if(ret && ret != -EBUSY) {
-			printk(KERN_ERR "sb: MPU device could not be autoconfigured.\n");
-			return(sb_dev[card]);
-		}
-		if(ret == -EBUSY)
-			mpu_activated[card] = 1;
-		
-		/* Some cards ask for irq but don't need them - azummo */
-		if(sb_isapnp_list[slot].mpu_irq == -1)
-			mpu_dev[card]->irq_resource[0].flags = 0;
-		
-		if((mpu_dev[card] = activate_dev(sb_isapnp_list[slot].name, "mpu", mpu_dev[card]))) {
-			mpu_config->io_base = mpu_dev[card]->resource[sb_isapnp_list[slot].mpu_io].start;
-			if(sb_isapnp_list[slot].mpu_irq != -1)
-				mpu_config->irq = mpu_dev[card]->irq_resource[sb_isapnp_list[slot].mpu_irq].start;
-		}
+	if((scc = kmalloc(sizeof(struct sb_card_config), GFP_KERNEL)) == NULL) {
+		printk(KERN_ERR "sb: Error: Could not allocate memory\n");
+		return -ENOMEM;
 	}
-	else
-		printk(KERN_ERR "sb: %s isapnp panic: mpu not found\n", sb_isapnp_list[slot].name);
-	
-	return(sb_dev[card]);
-}
+	memset(scc, 0, sizeof(struct sb_card_config));
 
-static int __init sb_isapnp_init(struct address_info *hw_config, struct address_info *mpu_config, struct pci_bus *bus, int slot, int card)
-{
-	char *busname = bus->name[0] ? bus->name : sb_isapnp_list[slot].name;
+	printk(KERN_INFO "sb: PnP: Found Card Named = \"%s\", Card PnP id = " \
+	       "%s, Device PnP id = %s\n", dev->dev.name, card_id->id,
+	       dev->id->id);
 
-	printk(KERN_INFO "sb: %s detected\n", busname); 
+	scc->card_id = card_id->id;
+	scc->dev_id = dev->id->id;
+	sb_dev2cfg(dev, scc);
 
-	/* Initialize this baby. */
+	printk(KERN_INFO "sb: PnP:      Detected at: io=0x%x, irq=%d, " \
+	       "dma=%d, dma16=%d\n", scc->conf.io_base, scc->conf.irq,
+	       scc->conf.dma, scc->conf.dma2);
 
-	if(sb_init(bus, hw_config, mpu_config, slot, card)) {
-		/* We got it. */
-		
-		printk(KERN_NOTICE "sb: ISAPnP reports '%s' at i/o %#x, irq %d, dma %d, %d\n",
-		       busname,
-		       hw_config->io_base, hw_config->irq, hw_config->dma,
-		       hw_config->dma2);
-		return 1;
-	}
-	else
-		printk(KERN_INFO "sb: Failed to initialize %s\n", busname);
+	pnpc_set_drvdata(card, scc);
 
-	return 0;
+	return sb_register_oss(scc, &sbmo);
 }
 
-static int __init sb_isapnp_probe(struct address_info *hw_config, struct address_info *mpu_config, int card)
+static void sb_pnp_remove(struct pnp_card *card)
 {
-	static int first = 1;
-	int i;
+	struct sb_card_config *scc = pnpc_get_drvdata(card);
 
-	/* Count entries in sb_isapnp_list */
-	for (i = 0; sb_isapnp_list[i].card_vendor != 0; i++);
-	i--;
-
-	/* Check and adjust isapnpjump */
-	if( isapnpjump < 0 || isapnpjump > i) {
-		isapnpjump = reverse ? i : 0;
-		printk(KERN_ERR "sb: Valid range for isapnpjump is 0-%d. Adjusted to %d.\n", i, isapnpjump);
-	}
+	if(!scc)
+		return;
 
-	if(!first || !reverse)
-		i = isapnpjump;
-	first = 0;
-	while(sb_isapnp_list[i].card_vendor != 0) {
-		static struct pci_bus *bus = NULL;
-
-		while ((bus = isapnp_find_card(
-				sb_isapnp_list[i].card_vendor,
-				sb_isapnp_list[i].card_device,
-				bus))) {
-	
-			if(sb_isapnp_init(hw_config, mpu_config, bus, i, card)) {
-				isapnpjump = i; /* start next search from here */
-				return 0;
-			}
-		}
-		i += reverse ? -1 : 1;
-	}
+	printk(KERN_INFO "sb: PnP: Removing %s\n", scc->card_id);
 
-	return -ENODEV;
+	sb_unload(scc);
 }
-#endif
 
-static int __init init_sb(void)
+static struct pnpc_driver sb_pnp_driver = {
+	.name          = "OSS SndBlstr", /* 16 character limit */
+	.id_table      = sb_pnp_card_table,
+	.probe         = sb_pnp_probe,
+	.remove        = sb_pnp_remove,
+};
+#endif /* CONFIG_PNP_CARD */
+
+static int __init sb_init(void)
 {
-	int card, max = (multiple && isapnp) ? SB_CARDS_MAX : 1;
+	int lres = 0;
+	int pres = 0;
 
-	printk(KERN_INFO "Soundblaster audio driver Copyright (C) by Hannu Savolainen 1993-1996\n");
-	
-	for(card = 0; card < max; card++, sb_cards_num++) {
-#ifdef __ISAPNP__
-		/* Please remember that even with __ISAPNP__ defined one
-		 * should still be able to disable PNP support for this 
-		 * single driver! */
-		if((!pnplegacy||card>0) && isapnp && (sb_isapnp_probe(&cfg[card], &cfg_mpu[card], card) < 0) ) {
-			if(!sb_cards_num) {
-				/* Found no ISAPnP cards, so check for a non-pnp
-				 * card and set the detection loop for 1 cycle
-				 */
-				printk(KERN_NOTICE "sb: No ISAPnP cards found, trying standard ones...\n");
-				isapnp = 0;
-				max = 1;
-			} else
-				/* found all the ISAPnP cards so exit the
-				 * detection loop. */
-				break;
-		}
-#endif
+	printk(KERN_INFO "sb: Init: Starting Probe...\n");
 
-		if(!isapnp || (pnplegacy&&card==0)) {
-			cfg[card].io_base	= io;
-			cfg[card].irq		= irq;
-			cfg[card].dma		= dma;
-			cfg[card].dma2		= dma16;
-		}
+	if(io != -1 && irq != -1 && dma != -1) {
+		printk(KERN_INFO "sb: Probing legacy card with io=%x, "\
+		       "irq=%d, dma=%d, dma16=%d\n",io, irq, dma, dma16);
+		lres = sb_init_legacy();
+	} else if((io != -1 || irq != -1 || dma != -1) ||
+		  (!pnp && (io == -1 && irq == -1 && dma == -1)))
+		printk(KERN_ERR "sb: Error: At least io, irq, and dma "\
+		       "must be set for legacy cards.\n");
+
+#ifdef CONFIG_PNP_CARD
+	if(pnp) {
+		pres = pnpc_register_driver(&sb_pnp_driver);
+	}
+#endif
+	printk(KERN_INFO "sb: Init: Done\n");
 
-		cfg[card].card_subtype = type;
+	/* If either PnP or Legacy registered a card then return
+	 * success */
+	return (pres > 0 || lres > 0) ? 0 : -ENODEV;
+}
 
-		if (!probe_sb(&cfg[card])) {
-			/* if one or more cards already registered, don't
-			 * return an error but print a warning. Note, this
-			 * should never really happen unless the hardware
-			 * or ISAPnP screwed up. */
-			if (sb_cards_num) {
-				printk(KERN_WARNING "sb.c: There was a " \
-				  "problem probing one of your SoundBlaster " \
-				  "ISAPnP soundcards. Continuing.\n");
-				card--;
-				sb_cards_num--;
-				continue;
-			} else if(pnplegacy && isapnp) {
-				printk(KERN_NOTICE "sb: No legacy SoundBlaster cards " \
-				  "found.  Continuing with PnP detection.\n");
-				pnplegacy=0;
-				card--;
-				continue;
-			} else
-				return -ENODEV;
-		}
-		attach_sb_card(&cfg[card]);
+static void __exit sb_exit(void)
+{
+	printk(KERN_INFO "sb: Unloading...\n");
 
-		if(cfg[card].slots[0]==-1) {
-			if(card==0 && pnplegacy && isapnp) {
-				printk(KERN_NOTICE "sb: No legacy SoundBlaster cards " \
-				  "found.  Continuing with PnP detection.\n");
-				pnplegacy=0;
-				card--;
-				continue;
-			} else
-				return -ENODEV;
-		}
-		
-		if (!isapnp||(pnplegacy&&card==0))
-			cfg_mpu[card].io_base = mpu_io;
-		if (probe_sbmpu(&cfg_mpu[card], THIS_MODULE))
-			sbmpu[card] = 1;
+	/* Unload legacy card */
+	if (legacy) {
+		printk (KERN_INFO "sb: Unloading legacy card\n");
+		sb_unload(legacy);
 	}
 
-	if(isapnp)
-		printk(KERN_NOTICE "sb: %d Soundblaster PnP card(s) found.\n", sb_cards_num);
-
-	return 0;
-}
+#ifdef CONFIG_PNP_CARD
+	pnpc_unregister_driver(&sb_pnp_driver);
+#endif
 
-static void __exit cleanup_sb(void)
-{
-	int i;
-	
 	if (smw_free) {
 		vfree(smw_free);
 		smw_free = NULL;
 	}
-
-	for(i = 0; i < sb_cards_num; i++) {
-		unload_sb(&cfg[i], i);
-		if (sbmpu[i])
-			unload_sbmpu(&cfg_mpu[i]);
-
-#ifdef __ISAPNP__
-		if(!audio_activated[i] && sb_dev[i])
-			sb_dev[i]->deactivate(sb_dev[i]);
-		if(!mpu_activated[i] && mpu_dev[i])
-			mpu_dev[i]->deactivate(mpu_dev[i]);
-		if(!opl_activated[i] && opl_dev[i])
-			opl_dev[i]->deactivate(opl_dev[i]);
-#endif
-	}
 }
 
-module_init(init_sb);
-module_exit(cleanup_sb);
-
-#ifndef MODULE
-static int __init setup_sb(char *str)
-{
-	/* io, irq, dma, dma2 - just the basics */
-	int ints[5];
-	
-	str = get_options(str, ARRAY_SIZE(ints), ints);
-	
-	io	= ints[1];
-	irq	= ints[2];
-	dma	= ints[3];
-	dma16	= ints[4];
-
-	return 1;
-}
-__setup("sb=", setup_sb);
-#endif
+module_init(sb_init);
+module_exit(sb_exit);
diff -Nru a/sound/oss/sb_card.h b/sound/oss/sb_card.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/sound/oss/sb_card.h	Sun Feb 23 22:25:27 2003
@@ -0,0 +1,147 @@
+/*
+ * sound/oss/sb_card.h
+ *
+ * This file is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
+ * Version 2 (June 1991). See the "COPYING" file distributed with this
+ * software for more info.
+ *
+ * 02-05-2002 Original Release, Paul Laufer <paul@laufernet.com>
+ */
+
+struct sb_card_config {
+	struct address_info conf;
+	struct address_info mpucnf;
+	const  char         *card_id;
+	const  char         *dev_id;
+	int                 mpu;
+};
+
+#ifdef CONFIG_PNP_CARD
+
+/*
+ * SoundBlaster PnP tables and structures.
+ */
+
+/* Card PnP ID Table */
+static struct pnp_card_id sb_pnp_card_table[] = {
+	/* Sound Blaster 16 */
+	{.id = "CTL0024", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster 16 */
+	{.id = "CTL0025", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster 16 */
+	{.id = "CTL0026", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster 16 */
+	{.id = "CTL0027", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster 16 */
+	{.id = "CTL0028", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster 16 */
+	{.id = "CTL0029", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster 16 */
+	{.id = "CTL002a", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster 16 */
+	{.id = "CTL002b", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster 16 */
+	{.id = "CTL002c", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster 16 */
+	{.id = "CTL00ed", .driver_data = 0, devs : { {.id="CTL0041"}, } },
+	/* Sound Blaster 16 */
+	{.id = "CTL0086", .driver_data = 0, devs : { {.id="CTL0041"}, } },
+	/* Sound Blaster Vibra16S */
+	{.id = "CTL0051", .driver_data = 0, devs : { {.id="CTL0001"}, } },
+	/* Sound Blaster Vibra16C */
+	{.id = "CTL0070", .driver_data = 0, devs : { {.id="CTL0001"}, } },
+	/* Sound Blaster Vibra16CL */
+	{.id = "CTL0080", .driver_data = 0, devs : { {.id="CTL0041"}, } },
+	/* Sound Blaster Vibra16CL */
+	{.id = "CTL00F0", .driver_data = 0, devs : { {.id="CTL0043"}, } },
+	/* Sound Blaster AWE 32 */
+	{.id = "CTL0039", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster AWE 32 */
+	{.id = "CTL0042", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster AWE 32 */
+	{.id = "CTL0043", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster AWE 32 */
+	{.id = "CTL0044", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster AWE 32 */
+	{.id = "CTL0045", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster AWE 32 */
+	{.id = "CTL0046", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster AWE 32 */
+	{.id = "CTL0047", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster AWE 32 */
+	{.id = "CTL0048", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster AWE 32 */
+	{.id = "CTL0054", .driver_data = 0, devs : { {.id="CTL0031"}, } },
+	/* Sound Blaster AWE 32 */
+	{.id = "CTL009C", .driver_data = 0, devs : { {.id="CTL0041"}, } },
+	/* Createive SB32 PnP */
+	{.id = "CTL009F", .driver_data = 0, devs : { {.id="CTL0041"}, } },
+	/* Sound Blaster AWE 64 */
+	{.id = "CTL009D", .driver_data = 0, devs : { {.id="CTL0042"}, } },
+	/* Sound Blaster AWE 64 Gold */
+	{.id = "CTL009E", .driver_data = 0, devs : { {.id="CTL0044"}, } },
+	/* Sound Blaster AWE 64 Gold */
+	{.id = "CTL00B2", .driver_data = 0, devs : { {.id="CTL0044"}, } },
+	/* Sound Blaster AWE 64 */
+	{.id = "CTL00C1", .driver_data = 0, devs : { {.id="CTL0042"}, } },
+	/* Sound Blaster AWE 64 */
+	{.id = "CTL00C3", .driver_data = 0, devs : { {.id="CTL0045"}, } },
+	/* Sound Blaster AWE 64 */
+	{.id = "CTL00C5", .driver_data = 0, devs : { {.id="CTL0045"}, } },
+	/* Sound Blaster AWE 64 */
+	{.id = "CTL00C7", .driver_data = 0, devs : { {.id="CTL0045"}, } },
+	/* Sound Blaster AWE 64 */
+	{.id = "CTL00E4", .driver_data = 0, devs : { {.id="CTL0045"}, } },
+	/* Sound Blaster AWE 64 */
+	{.id = "CTL00E9", .driver_data = 0, devs : { {.id="CTL0045"}, } },
+	/* ESS 1868 */
+	{.id = "ESS0968", .driver_data = 0, devs : { {.id="ESS0968"}, } },
+	/* ESS 1868 */
+	{.id = "ESS1868", .driver_data = 0, devs : { {.id="ESS1868"}, } },
+	/* ESS 1868 */
+	{.id = "ESS1868", .driver_data = 0, devs : { {.id="ESS8611"}, } },
+	/* ESS 1869 PnP AudioDrive */
+	{.id = "ESS0003", .driver_data = 0, devs : { {.id="ESS1869"}, } },
+	/* ESS 1869 */
+	{.id = "ESS1869", .driver_data = 0, devs : { {.id="ESS1869"}, } },
+	/* ESS 1878 */
+	{.id = "ESS1878", .driver_data = 0, devs : { {.id="ESS1878"}, } },
+	/* ESS 1879 */
+	{.id = "ESS1879", .driver_data = 0, devs : { {.id="ESS1879"}, } },
+	/* CMI 8330 SoundPRO */
+	{.id = "CMI0001", .driver_data = 0, devs : { {.id="@X@0001"},
+						     {.id="@H@0001"},
+						     {.id="@@@0001"}, } },
+	/* Diamond DT0197H */
+	{.id = "RWR1688", .driver_data = 0, devs : { {.id="@@@0001"},
+						     {.id="@X@0001"},
+						     {.id="@H@0001"}, } },
+	/* ALS007 */
+	{.id = "ALS0007", .driver_data = 0, devs : { {.id="@@@0001"},
+						     {.id="@X@0001"},
+						     {.id="@H@0001"}, } },
+	/* ALS100 */
+	{.id = "ALS0001", .driver_data = 0, devs : { {.id="@@@0001"},
+						     {.id="@X@0001"},
+						     {.id="@H@0001"}, } },
+	/* ALS110 */
+	{.id = "ALS0110", .driver_data = 0, devs : { {.id="@@@1001"},
+						     {.id="@X@1001"},
+						     {.id="@H@0001"}, } },
+	/* ALS120 */
+	{.id = "ALS0120", .driver_data = 0, devs : { {.id="@@@2001"},
+						     {.id="@X@2001"},
+						     {.id="@H@0001"}, } },
+	/* ALS200 */
+	{.id = "ALS0200", .driver_data = 0, devs : { {.id="@@@0020"},
+						     {.id="@X@0030"},
+						     {.id="@H@0001"}, } },
+	/* ALS200 */
+	{.id = "RTL3000", .driver_data = 0, devs : { {.id="@@@2001"},
+						     {.id="@X@2001"},
+						     {.id="@H@0001"}, } },
+	/* -end- */
+	{.id = "", }
+};
+
+#endif
diff -Nru a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c
--- a/sound/oss/vwsnd.c	Sun Feb 23 22:25:24 2003
+++ b/sound/oss/vwsnd.c	Sun Feb 23 22:25:24 2003
@@ -144,14 +144,12 @@
 #include <linux/module.h>
 #include <linux/init.h>
 
-#include <linux/sched.h>
-#include <linux/semaphore.h>
-#include <linux/stddef.h>
 #include <linux/spinlock.h>
 #include <linux/smp_lock.h>
-#include <asm/fixmap.h>
-#include <asm/cobalt.h>
+#include <linux/wait.h>
+#include <linux/interrupt.h>
 #include <asm/semaphore.h>
+#include <asm/mach-visws/cobalt.h>
 
 #include "sound_config.h"
 
@@ -256,7 +254,7 @@
  * Returns 0 on success, -errno on failure.
  */
 
-static int li_create(lithium_t *lith, unsigned long baseaddr)
+static int __init li_create(lithium_t *lith, unsigned long baseaddr)
 {
 	static void li_destroy(lithium_t *);
 
@@ -3040,15 +3038,15 @@
 }
 
 static struct file_operations vwsnd_audio_fops = {
-	owner:		THIS_MODULE,
-	llseek:		no_llseek,
-	read:		vwsnd_audio_read,
-	write:		vwsnd_audio_write,
-	poll:		vwsnd_audio_poll,
-	ioctl:		vwsnd_audio_ioctl,
-	mmap:		vwsnd_audio_mmap,
-	open:		vwsnd_audio_open,
-	release:	vwsnd_audio_release,
+	.owner =	THIS_MODULE,
+	.llseek =	no_llseek,
+	.read =		vwsnd_audio_read,
+	.write =	vwsnd_audio_write,
+	.poll =		vwsnd_audio_poll,
+	.ioctl =	vwsnd_audio_ioctl,
+	.mmap =		vwsnd_audio_mmap,
+	.open =		vwsnd_audio_open,
+	.release =	vwsnd_audio_release,
 };
 
 /*****************************************************************************/
@@ -3230,11 +3228,11 @@
 }
 
 static struct file_operations vwsnd_mixer_fops = {
-	owner:		THIS_MODULE,
-	llseek:		no_llseek,
-	ioctl:		vwsnd_mixer_ioctl,
-	open:		vwsnd_mixer_open,
-	release:	vwsnd_mixer_release,
+	.owner =	THIS_MODULE,
+	.llseek =	no_llseek,
+	.ioctl =	vwsnd_mixer_ioctl,
+	.open =		vwsnd_mixer_open,
+	.release =	vwsnd_mixer_release,
 };
 
 /*****************************************************************************/
@@ -3281,7 +3279,8 @@
 		return 0;
 	}
 
-	printk(KERN_INFO "probe_vwsnd: lithium audio found\n");
+	printk(KERN_INFO "vwsnd: lithium audio at mmio %#x irq %d\n",
+		hw_config->io_base, hw_config->irq);
 
 	return 1;
 }
@@ -3309,7 +3308,7 @@
 	if (err)
 		goto fail1;
 
-	init_waitqueue(&devc->open_wait);
+	init_waitqueue_head(&devc->open_wait);
 
 	devc->rport.hwbuf_size = HWBUF_SIZE;
 	devc->rport.hwbuf_vaddr = __get_free_pages(GFP_KERNEL, HWBUF_ORDER);
@@ -3378,18 +3377,18 @@
 
 	/* Initialize as much of *devc as possible */
 
-	devc->open_sema = MUTEX;
-	devc->io_sema = MUTEX;
-	devc->mix_sema = MUTEX;
+	init_MUTEX(&devc->open_sema);
+	init_MUTEX(&devc->io_sema);
+	init_MUTEX(&devc->mix_sema);
 	devc->open_mode = 0;
 	devc->rport.lock = SPIN_LOCK_UNLOCKED;
-	init_waitqueue(&devc->rport.queue);
+	init_waitqueue_head(&devc->rport.queue);
 	devc->rport.swstate = SW_OFF;
 	devc->rport.hwstate = HW_STOPPED;
 	devc->rport.flags = 0;
 	devc->rport.swbuf = NULL;
 	devc->wport.lock = SPIN_LOCK_UNLOCKED;
-	init_waitqueue(&devc->wport.queue);
+	init_waitqueue_head(&devc->wport.queue);
 	devc->wport.swstate = SW_OFF;
 	devc->wport.hwstate = HW_STOPPED;
 	devc->wport.flags = 0;
@@ -3468,8 +3467,9 @@
 	DBGXV("\n");
 	DBGXV("sound::vwsnd::init_module()\n");
 
-	if(!probe_vwsnd(&the_hw_config))
+	if (!probe_vwsnd(&the_hw_config))
 		return -ENODEV;
+
 	err = attach_vwsnd(&the_hw_config);
 	if (err < 0)
 		return err;
diff -Nru a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
--- a/sound/pci/ac97/ac97_codec.c	Sun Feb 23 22:25:23 2003
+++ b/sound/pci/ac97/ac97_codec.c	Sun Feb 23 22:25:23 2003
@@ -26,6 +26,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/pci.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
@@ -2474,7 +2475,6 @@
 int snd_ac97_tune_hardware(ac97_t *ac97, struct pci_dev *pci, struct ac97_quirk *quirk)
 {
 	unsigned short vendor, device;
-	struct ac97_quirk *q;
 
 	pci_read_config_word(pci, PCI_SUBSYSTEM_VENDOR_ID, &vendor);
 	pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &device);
diff -Nru a/sound/pci/als4000.c b/sound/pci/als4000.c
--- a/sound/pci/als4000.c	Sun Feb 23 22:25:26 2003
+++ b/sound/pci/als4000.c	Sun Feb 23 22:25:26 2003
@@ -370,7 +370,7 @@
 		snd_pcm_period_elapsed(chip->playback_substream);
 	if ((gcr_status & 0x40) && (chip->capture_substream)) /* capturing */
 		snd_pcm_period_elapsed(chip->capture_substream);
-	if ((gcr_status & 0x10) && (chip->rmidi)) /* MPU401 interupt */
+	if ((gcr_status & 0x10) && (chip->rmidi)) /* MPU401 interrupt */
 		snd_mpu401_uart_interrupt(irq, chip->rmidi, regs);
 	/* release the gcr */
 	outb(gcr_status, chip->alt_port + 0xe);
diff -Nru a/sound/pci/cs4281.c b/sound/pci/cs4281.c
--- a/sound/pci/cs4281.c	Sun Feb 23 22:25:26 2003
+++ b/sound/pci/cs4281.c	Sun Feb 23 22:25:26 2003
@@ -87,7 +87,7 @@
 #define BA0_HISR_MIDI		(1<<22)	/* MIDI port interrupt */
 #define BA0_HISR_FIFOI		(1<<20)	/* FIFO polled interrupt */
 #define BA0_HISR_DMAI		(1<<18)	/* DMA interrupt (half or end) */
-#define BA0_HISR_FIFO(c)	(1<<(12+(c))) /* FIFO channel interupt */
+#define BA0_HISR_FIFO(c)	(1<<(12+(c))) /* FIFO channel interrupt */
 #define BA0_HISR_DMA(c)		(1<<(8+(c)))  /* DMA channel interrupt */
 #define BA0_HISR_GPPI		(1<<5)	/* General Purpose Input (Primary chip) */
 #define BA0_HISR_GPSI		(1<<4)	/* General Purpose Input (Secondary chip) */
diff -Nru a/sound/pci/es1968.c b/sound/pci/es1968.c
--- a/sound/pci/es1968.c	Sun Feb 23 22:25:25 2003
+++ b/sound/pci/es1968.c	Sun Feb 23 22:25:25 2003
@@ -1132,7 +1132,7 @@
 	}
 
 	spin_lock_irqsave(&chip->reg_lock, flags);
-	/* clear WP interupts */
+	/* clear WP interrupts */
 	outw(1, chip->io_port + 0x04);
 	/* enable WP ints */
 	outw(inw(chip->io_port + ESM_PORT_HOST_IRQ) | ESM_HIRQ_DSIE, chip->io_port + ESM_PORT_HOST_IRQ);
@@ -1263,7 +1263,7 @@
 	}
 
 	spin_lock_irqsave(&chip->reg_lock, flags);
-	/* clear WP interupts */
+	/* clear WP interrupts */
 	outw(1, chip->io_port + 0x04);
 	/* enable WP ints */
 	outw(inw(chip->io_port + ESM_PORT_HOST_IRQ) | ESM_HIRQ_DSIE, chip->io_port + ESM_PORT_HOST_IRQ);
@@ -1414,7 +1414,7 @@
    * DMA memory management *
    *************************/
 
-/* Because the Maestro can only take addresses relative to the PCM base adress
+/* Because the Maestro can only take addresses relative to the PCM base address
    register :( */
 
 static int calc_available_memory_size(es1968_t *chip)
@@ -1828,7 +1828,7 @@
 	apu_set_register(chip, apu, 10, 0x8F08);
 	apu_set_register(chip, apu, 11, 0x0000);
 	spin_lock_irqsave(&chip->reg_lock, flags);
-	outw(1, chip->io_port + 0x04); /* clear WP interupts */
+	outw(1, chip->io_port + 0x04); /* clear WP interrupts */
 	outw(inw(chip->io_port + ESM_PORT_HOST_IRQ) | ESM_HIRQ_DSIE, chip->io_port + ESM_PORT_HOST_IRQ); /* enable WP ints */
 	spin_unlock_irqrestore(&chip->reg_lock, flags);
 
diff -Nru a/sound/pci/rme9652/hammerfall_mem.c b/sound/pci/rme9652/hammerfall_mem.c
--- a/sound/pci/rme9652/hammerfall_mem.c	Sun Feb 23 22:25:22 2003
+++ b/sound/pci/rme9652/hammerfall_mem.c	Sun Feb 23 22:25:22 2003
@@ -150,8 +150,6 @@
 	for (i = 0; i < NBUFS; i++) {
 		rbuf = &hammerfall_buffers[i];
 		if (rbuf->flags == HAMMERFALL_BUF_ALLOCATED) {
-			if (! try_module_get(THIS_MODULE))
-				return NULL;
 			rbuf->flags |= HAMMERFALL_BUF_USED;
 			rbuf->pci = pcidev;
 			*dmaaddr = rbuf->addr;
@@ -171,7 +169,6 @@
 		rbuf = &hammerfall_buffers[i];
 		if (rbuf->buf == addr && rbuf->pci == pcidev) {
 			rbuf->flags &= ~HAMMERFALL_BUF_USED;
-			module_put(THIS_MODULE);
 			return;
 		}
 	}
diff -Nru a/sound/pci/via82xx.c b/sound/pci/via82xx.c
--- a/sound/pci/via82xx.c	Sun Feb 23 22:25:26 2003
+++ b/sound/pci/via82xx.c	Sun Feb 23 22:25:26 2003
@@ -683,7 +683,7 @@
 			}
 		}
 	}
-	viadev->lastpos = res; /* remember the last positiion */
+	viadev->lastpos = res; /* remember the last position */
 	if (res >= viadev->bufsize)
 		res -= viadev->bufsize;
 	return res;
